summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2014-09-03 11:01:11 -0230
committerMatthew Newhook <matthew@zeroc.com>2014-09-03 11:01:11 -0230
commit3b0588532354adf7bf3b86e611a8ae4996bfe6ad (patch)
tree253961cb83af7bc3b1dfc7633a8f934789476cd1 /cpp/src
parentMore work on ICE-2400: the send log thread now uses a separate communicator t... (diff)
downloadice-3b0588532354adf7bf3b86e611a8ae4996bfe6ad.tar.bz2
ice-3b0588532354adf7bf3b86e611a8ae4996bfe6ad.tar.xz
ice-3b0588532354adf7bf3b86e611a8ae4996bfe6ad.zip
- C#, Java: Removed Outgoing, fixed generated code to make synchronous
requests using AMI. - Java: AsyncResult is now an interface. - Added --arg to allTests.py. - Fixed operations, adapterDeactivation and metrics test to work with background IO. - Added Collocated interrupt test. - Added support for batch oneway requests using AMI. - Added test in operations for batch oneway requests using AMI.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/CollocatedRequestHandler.cpp8
-rw-r--r--cpp/src/Ice/CollocatedRequestHandler.h3
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.cpp45
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.h3
-rw-r--r--cpp/src/Ice/ConnectionRequestHandler.cpp8
-rw-r--r--cpp/src/Ice/ConnectionRequestHandler.h3
-rw-r--r--cpp/src/Ice/Outgoing.cpp6
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp77
-rw-r--r--cpp/src/Ice/Proxy.cpp28
-rw-r--r--cpp/src/Ice/RequestHandler.h3
-rw-r--r--cpp/src/slice2cs/Gen.cpp191
-rw-r--r--cpp/src/slice2java/Gen.cpp279
12 files changed, 260 insertions, 394 deletions
diff --git a/cpp/src/Ice/CollocatedRequestHandler.cpp b/cpp/src/Ice/CollocatedRequestHandler.cpp
index fde2cbcb0b1..452511591a5 100644
--- a/cpp/src/Ice/CollocatedRequestHandler.cpp
+++ b/cpp/src/Ice/CollocatedRequestHandler.cpp
@@ -561,7 +561,13 @@ CollocatedRequestHandler::invokeException(Int requestId, const LocalException& e
}
ConnectionIPtr
-CollocatedRequestHandler::getConnection(bool /*wait*/)
+CollocatedRequestHandler::getConnection()
+{
+ return 0;
+}
+
+ConnectionIPtr
+CollocatedRequestHandler::waitForConnection()
{
return 0;
}
diff --git a/cpp/src/Ice/CollocatedRequestHandler.h b/cpp/src/Ice/CollocatedRequestHandler.h
index 3e106a1f280..7b80a2a036a 100644
--- a/cpp/src/Ice/CollocatedRequestHandler.h
+++ b/cpp/src/Ice/CollocatedRequestHandler.h
@@ -61,7 +61,8 @@ public:
const ReferencePtr& getReference() const { return _reference; } // Inlined for performances.
- virtual Ice::ConnectionIPtr getConnection(bool);
+ virtual Ice::ConnectionIPtr getConnection();
+ virtual Ice::ConnectionIPtr waitForConnection();
void invokeRequest(Outgoing*);
AsyncStatus invokeAsyncRequest(OutgoingAsync*);
diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp
index a8e83697996..10f756be30c 100644
--- a/cpp/src/Ice/ConnectRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectRequestHandler.cpp
@@ -287,25 +287,37 @@ ConnectRequestHandler::asyncRequestTimedOut(const OutgoingAsyncMessageCallbackPt
}
Ice::ConnectionIPtr
-ConnectRequestHandler::getConnection(bool waitInit)
+ConnectRequestHandler::getConnection()
{
Lock sync(*this);
- if(waitInit)
+ if(_exception.get())
{
- if(_exception.get())
- {
- throw RetryException(*_exception.get());
- }
-
- //
- // Wait for the connection establishment to complete or fail.
- //
- while(!_initialized && !_exception.get())
- {
- wait();
- }
+ _exception->ice_throw();
+ return 0; // Keep the compiler happy.
+ }
+ else
+ {
+ return _connection;
+ }
+}
+
+Ice::ConnectionIPtr
+ConnectRequestHandler::waitForConnection()
+{
+ Lock sync(*this);
+ if(_exception.get())
+ {
+ throw RetryException(*_exception.get());
}
-
+
+ //
+ // Wait for the connection establishment to complete or fail.
+ //
+ while(!_initialized && !_exception.get())
+ {
+ wait();
+ }
+
if(_exception.get())
{
_exception->ice_throw();
@@ -313,9 +325,8 @@ ConnectRequestHandler::getConnection(bool waitInit)
}
else
{
- assert(!waitInit || _initialized);
return _connection;
- }
+ }
}
void
diff --git a/cpp/src/Ice/ConnectRequestHandler.h b/cpp/src/Ice/ConnectRequestHandler.h
index 4776d985ff3..a95f62f8717 100644
--- a/cpp/src/Ice/ConnectRequestHandler.h
+++ b/cpp/src/Ice/ConnectRequestHandler.h
@@ -47,7 +47,8 @@ public:
virtual void requestTimedOut(OutgoingMessageCallback*);
virtual void asyncRequestTimedOut(const OutgoingAsyncMessageCallbackPtr&);
- virtual Ice::ConnectionIPtr getConnection(bool);
+ virtual Ice::ConnectionIPtr getConnection();
+ virtual Ice::ConnectionIPtr waitForConnection();
virtual void setConnection(const Ice::ConnectionIPtr&, bool);
virtual void setException(const Ice::LocalException&);
diff --git a/cpp/src/Ice/ConnectionRequestHandler.cpp b/cpp/src/Ice/ConnectionRequestHandler.cpp
index 0d503201310..fba1ee9dc34 100644
--- a/cpp/src/Ice/ConnectionRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectionRequestHandler.cpp
@@ -81,7 +81,13 @@ ConnectionRequestHandler::asyncRequestTimedOut(const OutgoingAsyncMessageCallbac
}
Ice::ConnectionIPtr
-ConnectionRequestHandler::getConnection(bool /*wait*/)
+ConnectionRequestHandler::getConnection()
+{
+ return _connection;
+}
+
+Ice::ConnectionIPtr
+ConnectionRequestHandler::waitForConnection()
{
return _connection;
}
diff --git a/cpp/src/Ice/ConnectionRequestHandler.h b/cpp/src/Ice/ConnectionRequestHandler.h
index 234dbf5f5a6..d8d4b1f2ae5 100644
--- a/cpp/src/Ice/ConnectionRequestHandler.h
+++ b/cpp/src/Ice/ConnectionRequestHandler.h
@@ -34,7 +34,8 @@ public:
virtual void requestTimedOut(OutgoingMessageCallback*);
virtual void asyncRequestTimedOut(const OutgoingAsyncMessageCallbackPtr&);
- virtual Ice::ConnectionIPtr getConnection(bool);
+ virtual Ice::ConnectionIPtr getConnection();
+ virtual Ice::ConnectionIPtr waitForConnection();
private:
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index fce704f0fe9..66509a2bedc 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -54,7 +54,7 @@ IceInternal::Outgoing::Outgoing(IceProxy::Ice::Object* proxy, const string& oper
{
try
{
- _handler = proxy->__getRequestHandler(true);
+ _handler = proxy->__getRequestHandler();
_handler->prepareBatchRequest(&_os);
break;
}
@@ -150,7 +150,7 @@ IceInternal::Outgoing::invoke()
_exception.reset(0);
_sent = false;
- _handler = _proxy->__getRequestHandler(false);
+ _handler = _proxy->__getRequestHandler();
if(_handler->sendRequest(this)) // Request sent and no response expected, we're done.
{
@@ -542,7 +542,7 @@ IceInternal::BatchOutgoing::invoke()
RequestHandlerPtr handler;
try
{
- handler = _proxy->__getRequestHandler(false);
+ handler = _proxy->__getRequestHandler();
if(handler->sendRequest(this))
{
return;
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index 749384821f4..c9d0ac28234 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -456,15 +456,42 @@ IceInternal::OutgoingAsync::__prepare(const std::string& operation, OperationMod
_observer.attach(_proxy.get(), operation, context);
- //
- // Can't call async via a batch proxy.
- //
- if(_proxy->ice_isBatchOneway() || _proxy->ice_isBatchDatagram())
+ switch(_proxy->__reference()->getMode())
{
- throw Ice::FeatureNotSupportedException(__FILE__, __LINE__, "can't send batch requests with AMI");
- }
+ case Reference::ModeTwoway:
+ case Reference::ModeOneway:
+ case Reference::ModeDatagram:
+ {
+ _os.writeBlob(requestHdr, sizeof(requestHdr));
+ break;
+ }
- _os.writeBlob(requestHdr, sizeof(requestHdr));
+ case Reference::ModeBatchOneway:
+ case Reference::ModeBatchDatagram:
+ {
+ while(true)
+ {
+ try
+ {
+ _handler = _proxy->__getRequestHandler();
+ _handler->prepareBatchRequest(&_os);
+ break;
+ }
+ catch(const RetryException&)
+ {
+ _proxy->__setRequestHandler(_handler, 0); // Clear request handler and retry.
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ _observer.failed(ex.ice_name());
+ _proxy->__setRequestHandler(_handler, 0); // Clear request handler
+ _handler = 0;
+ throw;
+ }
+ }
+ break;
+ }
+ }
Reference* ref = _proxy->__reference().get();
@@ -535,7 +562,7 @@ IceInternal::OutgoingAsync::__sent()
_sent = true;
assert(!(_state & Done));
- if(_proxy->__reference()->getMode() != Reference::ModeTwoway)
+ if(!_proxy->ice_isTwoway())
{
_childObserver.detach();
if(!_callback || !_callback->hasSentCallback())
@@ -595,6 +622,25 @@ IceInternal::OutgoingAsync::__finished(const Ice::Exception& exc)
}
void
+IceInternal::OutgoingAsync::__invokeExceptionAsync(const Ice::Exception& ex)
+{
+ if((_state & Done) == 0 && _handler)
+ {
+ //
+ // If we didn't finish a batch oneway or datagram request, we
+ // must notify the connection about that we give up ownership
+ // of the batch stream.
+ //
+ int mode = _proxy->__reference()->getMode();
+ if(mode == Reference::ModeBatchOneway || mode == Reference::ModeBatchDatagram)
+ {
+ _handler->abortBatchRequest();
+ }
+ }
+ AsyncResult::__invokeExceptionAsync(ex);
+}
+
+void
IceInternal::OutgoingAsync::__finished()
{
assert(_proxy->ice_isTwoway()); // Can only be called for twoways.
@@ -757,12 +803,21 @@ IceInternal::OutgoingAsync::__finished()
bool
IceInternal::OutgoingAsync::__invoke(bool synchronous)
{
+ const Reference::Mode mode = _proxy->__reference()->getMode();
+ if(mode == Reference::ModeBatchOneway || mode == Reference::ModeBatchDatagram)
+ {
+ _state |= Done | OK;
+ _handler->finishBatchRequest(&_os);
+ _observer.detach();
+ return true;
+ }
+
while(true)
{
try
{
_sent = false;
- _handler = _proxy->__getRequestHandler(true);
+ _handler = _proxy->__getRequestHandler();
AsyncStatus status = _handler->sendAsyncRequest(this);
if(status & AsyncStatusSent)
{
@@ -783,7 +838,7 @@ IceInternal::OutgoingAsync::__invoke(bool synchronous)
}
}
- if(_proxy->ice_isTwoway() || !(status & AsyncStatusSent))
+ if(mode == Reference::ModeTwoway || !(status & AsyncStatusSent))
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
if(!(_state & Done))
@@ -921,7 +976,7 @@ IceInternal::ProxyBatchOutgoingAsync::__invoke()
RequestHandlerPtr handler;
try
{
- handler = _proxy->__getRequestHandler(true);
+ handler = _proxy->__getRequestHandler();
AsyncStatus status = handler->sendAsyncRequest(this);
if(status & AsyncStatusSent)
{
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index 20b04eee154..720099b6927 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -1413,8 +1413,8 @@ IceProxy::Ice::Object::ice_getConnection()
RequestHandlerPtr handler;
try
{
- handler = __getRequestHandler(false);
- return handler->getConnection(true); // Wait for the connection to be established.
+ handler = __getRequestHandler();
+ return handler->waitForConnection(); // Wait for the connection to be established.
}
catch(const IceInternal::RetryException&)
{
@@ -1453,7 +1453,7 @@ IceProxy::Ice::Object::ice_getCachedConnection() const
{
try
{
- return __handler->getConnection(false);
+ return __handler->getConnection();
}
catch(const LocalException&)
{
@@ -1668,7 +1668,7 @@ operator<<(ostream& os, const ::IceProxy::Ice::Object& p)
}
::IceInternal::RequestHandlerPtr
-IceProxy::Ice::Object::__getRequestHandler(bool async)
+IceProxy::Ice::Object::__getRequestHandler()
{
if(_reference->getCacheConnection())
{
@@ -1677,12 +1677,11 @@ IceProxy::Ice::Object::__getRequestHandler(bool async)
{
return _requestHandler;
}
- _requestHandler = createRequestHandler(true); // async = true to avoid blocking with the proxy mutex locked.
+ _requestHandler = createRequestHandler(); // async = true to avoid blocking with the proxy mutex locked.
return _requestHandler;
}
- const Reference::Mode mode = _reference->getMode();
- return createRequestHandler(async || mode == Reference::ModeBatchOneway || mode == Reference::ModeBatchDatagram);
+ return createRequestHandler();
}
void
@@ -1705,7 +1704,7 @@ IceProxy::Ice::Object::__setRequestHandler(const ::IceInternal::RequestHandlerPt
// update the request handler. See bug ICE-5489 for reasons why
// this can be useful.
//
- if(previous->getConnection(false) == _requestHandler->getConnection(false))
+ if(previous->getConnection() == _requestHandler->getConnection())
{
_requestHandler = handler;
}
@@ -1725,7 +1724,7 @@ IceProxy::Ice::Object::__newInstance() const
}
RequestHandlerPtr
-IceProxy::Ice::Object::createRequestHandler(bool async)
+IceProxy::Ice::Object::createRequestHandler()
{
if(_reference->getCollocationOptimized())
{
@@ -1736,15 +1735,8 @@ IceProxy::Ice::Object::createRequestHandler(bool async)
}
}
- if(async)
- {
- ConnectRequestHandlerPtr handler = new ::IceInternal::ConnectRequestHandler(_reference, this);
- return handler->connect();
- }
- else
- {
- return new ::IceInternal::ConnectionRequestHandler(_reference, this);
- }
+ ConnectRequestHandlerPtr handler = new ::IceInternal::ConnectRequestHandler(_reference, this);
+ return handler->connect();
}
void
diff --git a/cpp/src/Ice/RequestHandler.h b/cpp/src/Ice/RequestHandler.h
index 23ce100c2e4..e2d83c63e20 100644
--- a/cpp/src/Ice/RequestHandler.h
+++ b/cpp/src/Ice/RequestHandler.h
@@ -70,7 +70,8 @@ public:
const ReferencePtr& getReference() const { return _reference; } // Inlined for performances.
- virtual Ice::ConnectionIPtr getConnection(bool) = 0;
+ virtual Ice::ConnectionIPtr getConnection() = 0;
+ virtual Ice::ConnectionIPtr waitForConnection() = 0;
protected:
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 80cc517890a..7f0ffd539a2 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -5159,138 +5159,33 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << nl << "checkTwowayOnly__(__" << op->name() << "_name);";
}
- _out << nl << "IceInternal.Outgoing og__ = getOutgoing(__" << op->name() << "_name, "
- << sliceModeToIceMode(op->sendMode()) << ", context__, explicitCtx__);";
- _out << nl << "try";
- _out << sb;
- if(!inParams.empty())
+
+ if(ret)
{
- _out << nl << "try";
- _out << sb;
- _out << nl << "IceInternal.BasicStream os__ = og__.startWriteParams(" << opFormatTypeToString(op) << ");";
- writeMarshalUnmarshalParams(inParams, 0, true);
- if(op->sendsClasses(false))
- {
- _out << nl << "os__.writePendingObjects();";
- }
- _out << nl << "og__.endWriteParams();";
- _out << eb;
- _out << nl << "catch(Ice.LocalException ex__)";
- _out << sb;
- _out << nl << "og__.abort(ex__);";
- _out << eb;
+ _out << nl << "return ";
}
else
{
- _out << nl << "og__.writeEmptyParams();";
+ _out << nl;
}
- if(!op->returnsData())
- {
- _out << "invoke__(og__);";
+ _out << "end_" << op->name() << "(";
+ if(!outParams.empty()) {
+ for(ParamDeclList::const_iterator p = outParams.begin(); p != outParams.end(); ++p) {
+ _out << "out " << fixId((*p)->name()) << ", ";
+ }
}
- else
+ _out << "begin_" << op->name() << "(";
+ if(!inParams.empty())
{
- _out << nl << "if(!og__.invoke())";
- _out << sb;
- //
- // The try/catch block is necessary because throwException()
- // can raise UserException.
- //
- _out << nl << "try";
- _out << sb;
- _out << nl << "og__.throwUserException();";
- _out << eb;
- for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
- {
- _out << nl << "catch(" << fixId((*t)->scoped()) << ')';
- _out << sb;
- _out << nl << "throw;";
- _out << eb;
- }
- _out << nl << "catch(Ice.UserException ex__)";
- _out << sb;
- _out << nl << "throw new Ice.UnknownUserException(ex__.ice_name(), ex__);";
- _out << eb;
- _out << eb;
- if(ret || !outParams.empty())
- {
- _out << nl << "IceInternal.BasicStream is__ = og__.startReadParams();";
- for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- const bool isClass = isClassType((*pli)->type());
-
- if(!(*pli)->optional() && !isClass)
- {
- StructPtr st = StructPtr::dynamicCast((*pli)->type());
- if(st)
- {
- string param = fixId((*pli)->name());
- string typeS = typeToString(st, (*pli)->optional());
- if(isValueType(st))
- {
- _out << nl << param << " = new " << typeS << "();";
- }
- else
- {
- _out << nl << param << " = null;";
- }
- }
- }
- }
- if(ret)
- {
- string typeS = typeToString(ret, op->returnIsOptional());
- const bool isClass = isClassType(ret);
-
- _out << nl << typeS << " ret__;";
-
- if(op->returnIsOptional())
- {
- BuiltinPtr b = BuiltinPtr::dynamicCast(ret);
- if(!b || isClass)
- {
- _out << nl << "ret__ = new " << typeS << "();";
- }
- }
- else if(!isClass)
- {
- StructPtr st = StructPtr::dynamicCast(ret);
- if(st)
- {
- if(isValueType(st))
- {
- _out << nl << "ret__ = new " << typeS << "();";
- }
- else
- {
- _out << nl << "ret__ = null;";
- }
- }
- }
- }
- writeMarshalUnmarshalParams(outParams, op, false);
- if(op->returnsClasses(false))
- {
- _out << nl << "is__.readPendingObjects();";
- }
- _out << nl << "og__.endReadParams();";
- writePostUnmarshalParams(outParams, op);
- if(ret)
- {
- _out << nl << "return ret__;";
- }
+ for(ParamDeclList::const_iterator p = inParams.begin(); p != inParams.end(); ++p) {
+ _out << fixId((*p)->name()) << ", ";
}
}
- _out << eb;
- _out << nl << "finally";
- _out << sb;
- _out << nl << "reclaimOutgoing(og__);";
- _out << eb;
-
+ _out << "context__, explicitCtx__, true, null, null));";
_out << eb;
}
-
+
if(!ops.empty())
{
_out << sp << nl << "#endregion"; // Synchronous operations
@@ -5336,7 +5231,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp;
_out << nl << "public Ice.AsyncResult<" << delType << "> begin_" << opName << spar << paramsAMI << epar;
_out << sb;
- _out << nl << "return begin_" << opName << spar << argsAMI << "null" << "false" << "null" << "null"
+ _out << nl << "return begin_" << opName << spar << argsAMI << "null" << "false" << "false" << "null" << "null"
<< epar << ';';
_out << eb;
@@ -5346,7 +5241,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "public Ice.AsyncResult<" << delType << "> begin_" << opName << spar << paramsAMI
<< "_System.Collections.Generic.Dictionary<string, string> ctx__" << epar;
_out << sb;
- _out << nl << "return begin_" << opName << spar << argsAMI << "ctx__" << "true" << "null" << "null"
+ _out << nl << "return begin_" << opName << spar << argsAMI << "ctx__" << "true" << "false" << "null" << "null"
<< epar << ';';
_out << eb;
@@ -5354,7 +5249,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "public Ice.AsyncResult begin_" << opName << spar << paramsAMI
<< "Ice.AsyncCallback cb__" << "object cookie__" << epar;
_out << sb;
- _out << nl << "return begin_" << opName << spar << argsAMI << "null" << "false" << "cb__" << "cookie__"
+ _out << nl << "return begin_" << opName << spar << argsAMI << "null" << "false" << "false" << "cb__" << "cookie__"
<< epar << ';';
_out << eb;
@@ -5364,7 +5259,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
<< "_System.Collections.Generic.Dictionary<string, string> ctx__" << "Ice.AsyncCallback cb__"
<< "object cookie__" << epar;
_out << sb;
- _out << nl << "return begin_" << opName << spar << argsAMI << "ctx__" << "true" << "cb__" << "cookie__"
+ _out << nl << "return begin_" << opName << spar << argsAMI << "ctx__" << "true" << "false" << "cb__" << "cookie__"
<< epar << ';';
_out << eb;
@@ -5382,8 +5277,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(op->returnsData())
{
_out << nl << "IceInternal.OutgoingAsync outAsync__ = (IceInternal.OutgoingAsync)r__;";
- _out << nl << "IceInternal.OutgoingAsync.check__(outAsync__, this, " << flatName << ");";
- _out << nl << "if(!outAsync__.wait__())";
+ _out << nl << "IceInternal.OutgoingAsync.check(outAsync__, this, " << flatName << ");";
+
+ _out << nl << "try";
+ _out << sb;
+
+ _out << nl << "if(!outAsync__.wait())";
_out << sb;
ExceptionList throws = op->throws();
@@ -5404,7 +5303,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "try";
_out << sb;
- _out << nl << "outAsync__.throwUserException__();";
+ _out << nl << "outAsync__.throwUserException();";
_out << eb;
for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
{
@@ -5425,7 +5324,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << nl << retS << " ret__;";
}
- _out << nl << "IceInternal.BasicStream is__ = outAsync__.startReadParams__();";
+ _out << nl << "IceInternal.BasicStream is__ = outAsync__.startReadParams();";
for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
{
string param = fixId((*pli)->name());
@@ -5474,7 +5373,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << nl << "is__.readPendingObjects();";
}
- _out << nl << "outAsync__.endReadParams__();";
+ _out << nl << "outAsync__.endReadParams();";
writePostUnmarshalParams(outParams, op);
if(ret)
{
@@ -5483,8 +5382,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else
{
- _out << nl << "outAsync__.readEmptyParams__();";
+ _out << nl << "outAsync__.readEmptyParams();";
}
+
+ _out << eb;
+ _out << nl << "finally";
+ _out << sb;
+ _out << nl << "outAsync__.cacheMessageBuffers();";
+ _out << eb;
}
else
{
@@ -5498,19 +5403,19 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp;
_out << nl << "private Ice.AsyncResult<" << delType << "> begin_" << opName << spar << paramsAMI
<< "_System.Collections.Generic.Dictionary<string, string> ctx__"
- << "bool explicitContext__" << "Ice.AsyncCallback cb__" << "object cookie__" << epar;
+ << "bool explicitContext__" << "bool synchronous__" << "Ice.AsyncCallback cb__" << "object cookie__" << epar;
_out << sb;
if(op->returnsData())
{
_out << nl << "checkAsyncTwowayOnly__(" << flatName << ");";
_out << nl << "IceInternal.TwowayOutgoingAsync<" << delType << "> result__ = "
- << " new IceInternal.TwowayOutgoingAsync<" << delType << ">(this, " << flatName << ", " << op->name()
+ << " getTwowayOutgoingAsync<" << delType << ">(" << flatName << ", " << op->name()
<< "_completed__";
}
else
{
_out << nl << "IceInternal.OnewayOutgoingAsync<" << delType << "> result__ = "
- << "new IceInternal.OnewayOutgoingAsync<" << delType << ">(this, " << flatName << ", " << op->name()
+ << "getOnewayOutgoingAsync<" << delType << ">(" << flatName << ", " << op->name()
<< "_completed__";
}
_out << ", cookie__);";
@@ -5520,28 +5425,30 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << eb;
_out << nl << "try";
_out << sb;
- _out << nl << "result__.prepare__(" << flatName << ", "
- << sliceModeToIceMode(op->sendMode()) << ", ctx__, explicitContext__);";
+ _out << nl << "result__.prepare(" << flatName << ", "
+ << sliceModeToIceMode(op->sendMode()) << ", ctx__, explicitContext__, synchronous__);";
+
if(!inParams.empty())
{
- _out << nl << "IceInternal.BasicStream os__ = result__.startWriteParams__("
+ _out << nl << "IceInternal.BasicStream os__ = result__.startWriteParams("
<< opFormatTypeToString(op) << ");";
writeMarshalUnmarshalParams(inParams, 0, true);
if(op->sendsClasses(false))
{
_out << nl << "os__.writePendingObjects();";
}
- _out << nl << "result__.endWriteParams__();";
+ _out << nl << "result__.endWriteParams();";
}
else
{
- _out << nl << "result__.writeEmptyParams__();";
+ _out << nl << "result__.writeEmptyParams();";
}
- _out << nl << "result__.invoke__(true);";
+
+ _out << nl << "result__.invoke(true);";
_out << eb;
_out << nl << "catch(Ice.Exception ex__)";
_out << sb;
- _out << nl << "result__.invokeExceptionAsync__(ex__);";
+ _out << nl << "result__.invokeExceptionAsync(ex__);";
_out << eb;
_out << nl << "return result__;";
_out << eb;
@@ -5642,7 +5549,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sb;
_out << nl << "result__ = new IceInternal.TwowayOutgoingAsync<" << delType << ">(this, "
<< flatName << ", " << op->name() << "_completed__, null);";
- _out << nl << "((IceInternal.OutgoingAsyncBase)result__).invokeExceptionAsync__(ex);";
+ _out << nl << "((IceInternal.OutgoingAsyncBase)result__).invokeExceptionAsync(ex);";
_out << eb;
}
else
@@ -5676,7 +5583,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sb;
_out << nl << "result__ = new IceInternal.TwowayOutgoingAsync<" << delType << ">(this, "
<< flatName << ", " << op->name() << "_completed__, null);";
- _out << nl << "((IceInternal.OutgoingAsyncBase)result__).invokeExceptionAsync__(ex);";
+ _out << nl << "((IceInternal.OutgoingAsyncBase)result__).invokeExceptionAsync(ex);";
_out << eb;
}
else
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 48f3af304c8..9de67726eb9 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -529,6 +529,7 @@ Slice::JavaVisitor::getArgsAsyncLambda(const OperationPtr& op, const string& pac
vector<string> args = getInOutArgs(op, InParam);
args.push_back(context ? "__ctx" : "null");
args.push_back(context ? "true" : "false");
+ args.push_back("false"); // __synchronous
args.push_back("__responseCb");
if(!op->throws().empty())
{
@@ -4733,18 +4734,22 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp;
writeDocCommentAsync(out, op, OutParam);
- out << nl << "public " << retS << " end_" << op->name() << spar << outParams << "Ice.AsyncResult __result"
+ out << nl << "public " << retS << " end_" << op->name() << spar << outParams << "Ice.AsyncResult __iresult"
<< epar;
writeThrowsClause(package, throws);
out << sb;
if(op->returnsData())
{
- out << nl << "Ice.AsyncResult.__check(__result, this, __" << op->name() << "_name);";
+ out << nl << "IceInternal.AsyncResultI __result = (IceInternal.AsyncResultI)__iresult;";
+ out << nl << "IceInternal.AsyncResultI.check(__result, this, __" << op->name() << "_name);";
+ out << nl << "try";
+ out << sb;
+
out << nl << "if(!__result.__wait())";
out << sb;
out << nl << "try";
out << sb;
- out << nl << "__result.__throwUserException();";
+ out << nl << "__result.throwUserException();";
out << eb;
//
// Arrange exceptions into most-derived to least-derived order. If we don't
@@ -4772,7 +4777,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(ret || !outParams.empty())
{
- out << nl << "IceInternal.BasicStream __is = __result.__startReadParams();";
+ out << nl << "IceInternal.BasicStream __is = __result.startReadParams();";
const ParamDeclList paramList = op->parameters();
ParamDeclList pl;
for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
@@ -4787,11 +4792,11 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << nl << "__is.readPendingObjects();";
}
- out << nl << "__result.__endReadParams();";
+ out << nl << "__result.endReadParams();";
}
else
{
- out << nl << "__result.__readEmptyParams();";
+ out << nl << "__result.readEmptyParams();";
}
if(ret)
@@ -4807,10 +4812,19 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "return __ret;";
}
}
+
+ out << eb;
+ out << nl << "finally";
+ out << sb;
+ out << nl << "if(__result != null)";
+ out << sb;
+ out << nl << "__result.cacheMessageBuffers();";
+ out << eb;
+ out << eb;
}
else
{
- out << nl << "__end(__result, __" << op->name() << "_name);";
+ out << nl << "__end(__iresult, __" << op->name() << "_name);";
}
out << eb;
@@ -4921,18 +4935,19 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
out << nl << "__checkTwowayOnly(__" << op->name() << "_name);";
out << nl << "__r = begin_" << op->name() << spar << argsAMI << "null" << "false"
- << "__cb" << epar << ';';
+ << "false" << "__cb" << epar << ';';
out << eb;
out << nl << "catch(Ice.TwowayOnlyException ex)";
out << sb;
- out << nl << "__r = new IceInternal.OutgoingAsync(this, __" << op->name() << "_name, __cb);";
- out << nl << "__r.__invokeExceptionAsync(ex);";
+ out << nl << "IceInternal.OutgoingAsync __r2 = getOutgoingAsync(__" << op->name() << "_name, __cb);";
+ out << nl << "__r = __r2;";
+ out << nl << "__r2.invokeExceptionAsync(ex);";
out << eb;
}
else
{
out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "null" << "false"
- << "__cb" << epar << ';';
+ << "false" << "__cb" << epar << ';';
}
out << nl << "return __r.sentSynchronously();";
out << eb;
@@ -4948,18 +4963,19 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
out << nl << "__checkTwowayOnly(__" << op->name() << "_name);";
out << nl << "__r = begin_" << op->name() << spar << argsAMI << "__ctx" << "true"
- << "__cb" << epar << ';';
+ << "false" << "__cb" << epar << ';';
out << eb;
out << nl << "catch(Ice.TwowayOnlyException ex)";
out << sb;
- out << nl << "__r = new IceInternal.OutgoingAsync(this, __" << op->name() << "_name, __cb);";
- out << nl << "__r.__invokeExceptionAsync(ex);";
+ out << nl << "IceInternal.OutgoingAsync __r2 = getOutgoingAsync(__" << op->name() << "_name, __cb);";
+ out << nl << "__r = __r2;";
+ out << nl << "__r2.invokeExceptionAsync(ex);";
out << eb;
}
else
{
out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "__ctx" << "true"
- << "__cb" << epar << ';';
+ << "false" << "__cb" << epar << ';';
}
out << nl << "return __r.sentSynchronously();";
out << eb;
@@ -4968,123 +4984,39 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj)";
out << sb;
- out << nl << name << "Prx __d = null;";
- out << nl << "if(__obj != null)";
- out << sb;
- out << nl << "if(__obj instanceof " << name << "Prx)";
- out << sb;
- out << nl << "__d = (" << name << "Prx)__obj;";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << "if(__obj.ice_isA(ice_staticId()))";
- out << sb;
- out << nl << name << "PrxHelper __h = new " << name << "PrxHelper();";
- out << nl << "__h.__copyFrom(__obj);";
- out << nl << "__d = __h;";
- out << eb;
- out << eb;
- out << eb;
- out << nl << "return __d;";
+ out << nl << "return checkedCastImpl(__obj, ice_staticId(), " << name << "Prx.class, "
+ << name << "PrxHelper.class);";
out << eb;
out << sp << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, " << contextParam << ')';
out << sb;
- out << nl << name << "Prx __d = null;";
- out << nl << "if(__obj != null)";
- out << sb;
- out << nl << "if(__obj instanceof " << name << "Prx)";
- out << sb;
- out << nl << "__d = (" << name << "Prx)__obj;";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << "if(__obj.ice_isA(ice_staticId(), __ctx))";
- out << sb;
- out << nl << name << "PrxHelper __h = new " << name << "PrxHelper();";
- out << nl << "__h.__copyFrom(__obj);";
- out << nl << "__d = __h;";
- out << eb;
- out << eb;
- out << eb;
- out << nl << "return __d;";
+ out << nl << "return checkedCastImpl(__obj, __ctx, ice_staticId(), " << name
+ << "Prx.class, " << name << "PrxHelper.class);";
out << eb;
out << sp << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, String __facet)";
out << sb;
- out << nl << name << "Prx __d = null;";
- out << nl << "if(__obj != null)";
- out << sb;
- out << nl << "Ice.ObjectPrx __bb = __obj.ice_facet(__facet);";
- out << nl << "try";
- out << sb;
- out << nl << "if(__bb.ice_isA(ice_staticId()))";
- out << sb;
- out << nl << name << "PrxHelper __h = new " << name << "PrxHelper();";
- out << nl << "__h.__copyFrom(__bb);";
- out << nl << "__d = __h;";
- out << eb;
- out << eb;
- out << nl << "catch(Ice.FacetNotExistException ex)";
- out << sb;
- out << eb;
- out << eb;
- out << nl << "return __d;";
+ out << nl << "return checkedCastImpl(__obj, __facet, ice_staticId(), " << name
+ << "Prx.class, " << name << "PrxHelper.class);";
out << eb;
out << sp << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, String __facet, "
<< contextParam << ')';
out << sb;
- out << nl << name << "Prx __d = null;";
- out << nl << "if(__obj != null)";
- out << sb;
- out << nl << "Ice.ObjectPrx __bb = __obj.ice_facet(__facet);";
- out << nl << "try";
- out << sb;
- out << nl << "if(__bb.ice_isA(ice_staticId(), __ctx))";
- out << sb;
- out << nl << name << "PrxHelper __h = new " << name << "PrxHelper();";
- out << nl << "__h.__copyFrom(__bb);";
- out << nl << "__d = __h;";
- out << eb;
- out << eb;
- out << nl << "catch(Ice.FacetNotExistException ex)";
- out << sb;
- out << eb;
- out << eb;
- out << nl << "return __d;";
+ out << nl << "return checkedCastImpl(__obj, __facet, __ctx, ice_staticId(), " << name
+ << "Prx.class, " << name << "PrxHelper.class);";
out << eb;
out << sp << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx __obj)";
out << sb;
- out << nl << name << "Prx __d = null;";
- out << nl << "if(__obj != null)";
- out << sb;
- out << nl << "if(__obj instanceof " << name << "Prx)";
- out << sb;
- out << nl << "__d = (" << name << "Prx)__obj;";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << name << "PrxHelper __h = new " << name << "PrxHelper();";
- out << nl << "__h.__copyFrom(__obj);";
- out << nl << "__d = __h;";
- out << eb;
- out << eb;
- out << nl << "return __d;";
+ out << nl << "return uncheckedCastImpl(__obj, " << name << "Prx.class, " << name
+ << "PrxHelper.class);";
out << eb;
out << sp << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx __obj, String __facet)";
out << sb;
- out << nl << name << "Prx __d = null;";
- out << nl << "if(__obj != null)";
- out << sb;
- out << nl << "Ice.ObjectPrx __bb = __obj.ice_facet(__facet);";
- out << nl << name << "PrxHelper __h = new " << name << "PrxHelper();";
- out << nl << "__h.__copyFrom(__bb);";
- out << nl << "__d = __h;";
- out << eb;
- out << nl << "return __d;";
+ out << nl << "return uncheckedCastImpl(__obj, __facet, " << name << "Prx.class, " << name
+ << "PrxHelper.class);";
out << eb;
ClassList allBases = p->allBases();
@@ -5494,8 +5426,6 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
vector<string> params = getParamsProxy(op, package, false, optionalMapping);
vector<string> args = getArgs(op);
- int iter = 0;
-
ParamDeclList inParams;
ParamDeclList outParams;
ParamDeclList paramList = op->parameters();
@@ -5553,91 +5483,38 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
<< explicitContextParam << epar;
writeThrowsClause(package, throws);
out << sb;
+
+ // This code replaces the synchronous calls with chained AMI calls.
if(op->returnsData())
{
out << nl << "__checkTwowayOnly(__" << op->name() << "_name);";
}
- out << nl << "IceInternal.Outgoing __og = getOutgoing(__" << op->name() << "_name, " <<
- sliceModeToIceMode(op->sendMode()) << ", __ctx, __explicitCtx);";
- out << nl << "try";
- out << sb;
- if(!inParams.empty())
+ if(ret)
{
- out << nl << "try";
- out << sb;
- out << nl << "IceInternal.BasicStream __os = __og.startWriteParams(" << opFormatTypeToString(op) << ");";
- writeMarshalUnmarshalParams(out, package, inParams, 0, iter, true, optionalMapping);
- if(op->sendsClasses(false))
- {
- out << nl << "__os.writePendingObjects();";
- }
- out << nl << "__og.endWriteParams();";
- out << eb;
- out << nl << "catch(Ice.LocalException __ex)";
- out << sb;
- out << nl << "__og.abort(__ex);";
- out << eb;
+ out << nl << "return ";
}
else
{
- out << nl << "__og.writeEmptyParams();";
+ out << nl;
}
- if(!op->returnsData())
- {
- out << nl << "__invoke(__og);";
+ out << "end_" << op->name() << "(";
+ vector<string> inOutArgs = getInOutArgs(op, OutParam);
+ if(!inOutArgs.empty()) {
+ for(vector<string>::const_iterator p = inOutArgs.begin(); p != inOutArgs.end(); ++p) {
+ out << *p << ", ";
+ }
}
- else
+ vector<string> inArgs = getInOutArgs(op, InParam);
+ out << "begin_" << op->name() << "(";
+ if(!inArgs.empty())
{
- out << nl << "if(!__og.invoke())";
- out << sb;
- out << nl << "try";
- out << sb;
- out << nl << "__og.throwUserException();";
- out << eb;
- for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
- {
- out << nl << "catch(" << getAbsolute(*t, package) << " __ex)";
- out << sb;
- out << nl << "throw __ex;";
- out << eb;
- }
- out << nl << "catch(Ice.UserException __ex)";
- out << sb;
- out << nl << "throw new Ice.UnknownUserException(__ex.ice_name(), __ex);";
- out << eb;
- out << eb;
- if(ret || !outParams.empty())
- {
- out << nl << "IceInternal.BasicStream __is = __og.startReadParams();";
- writeMarshalUnmarshalParams(out, package, outParams, op, iter, false, true);
- if(op->returnsClasses(false))
- {
- out << nl << "__is.readPendingObjects();";
- }
- out << nl << "__og.endReadParams();";
- }
-
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if(!op->returnIsOptional() &&
- ((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret)))
- {
- out << nl << "return __ret.value;";
- }
- else
- {
- out << nl << "return __ret;";
- }
+ for(vector<string>::const_iterator p = inArgs.begin(); p != inArgs.end(); ++p) {
+ out << *p << ", ";
}
}
- out << eb;
- out << nl << "finally";
- out << sb;
- out << nl << "reclaimOutgoing(__og);";
- out << eb;
+ out << "__ctx, __explicitCtx, true, null));";
out << eb;
{
@@ -5657,21 +5534,21 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
writeDocCommentAsync(out, op, InParam);
out << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "null" << epar << ';';
+ out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "null" << epar << ';';
out << eb;
out << sp;
writeDocCommentAsync(out, op, InParam, contextDoc);
out << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam << epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "null" << epar << ';';
+ out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "null" << epar << ';';
out << eb;
out << sp;
writeDocCommentAsync(out, op, InParam);
out << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << callbackParam << epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "__cb" << epar << ';';
+ out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "__cb" << epar << ';';
out << eb;
out << sp;
@@ -5679,7 +5556,7 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
out << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
<< callbackParam << epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "__cb" << epar << ';';
+ out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "__cb" << epar << ';';
out << eb;
//
@@ -5701,7 +5578,7 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
out << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << typeSafeCallbackParam
<< epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "__cb" << epar << ';';
+ out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "__cb" << epar << ';';
out << eb;
out << sp;
@@ -5709,7 +5586,7 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
out << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
<< typeSafeCallbackParam << epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "__cb" << epar << ';';
+ out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "__cb" << epar << ';';
out << eb;
//
@@ -5747,6 +5624,7 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
vector<string> params = inParams;
params.push_back(contextParam);
params.push_back("boolean __explicitCtx");
+ params.push_back("boolean __synchronous");
vector<string> asyncParams = getParamsAsyncLambda(op, package, false, true, optionalMapping, false);
copy(asyncParams.begin(), asyncParams.end(), back_inserter(params));
@@ -5762,6 +5640,7 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
params = getInOutArgs(op, InParam);
params.push_back("__ctx");
params.push_back("__explicitCtx");
+ params.push_back("__synchronous");
params.push_back("new IceInternal.Functional_OnewayCallback(__responseCb, __exceptionCb, __sentCb)");
out << nl << "return begin_" << op->name();
writeParamList(out, params);
@@ -5819,6 +5698,7 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
out << nl << "return begin_" << op->name() << spar << getInOutArgs(op, InParam) << "__ctx"
<< "__explicitCtx"
+ << "__synchronous"
<< (throws.empty() ? "new CB(__responseCb, __exceptionCb, __sentCb)" :
"new CB(__responseCb, __userExceptionCb, __exceptionCb, __sentCb)")
<< epar << ';';
@@ -5828,6 +5708,7 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
params = getInOutArgs(op, InParam);
params.push_back("__ctx");
params.push_back("__explicitCtx");
+ params.push_back("__synchronous");
const string baseClass = getAsyncCallbackBaseClass(op, true);
out << nl << "return begin_" << op->name();
@@ -5853,6 +5734,7 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
params = inParams;
params.push_back(contextParam);
params.push_back("boolean __explicitCtx");
+ params.push_back("boolean __synchronous");
params.push_back("IceInternal.CallbackBase __cb");
out << sp;
@@ -5863,16 +5745,18 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
{
out << nl << "__checkAsyncTwowayOnly(__" << op->name() << "_name);";
}
- out << nl << "IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __" << op->name()
+ out << nl << "IceInternal.OutgoingAsync __result = getOutgoingAsync(__" << op->name()
<< "_name, __cb);";
out << nl << "try";
out << sb;
- out << nl << "__result.__prepare(__" << op->name() << "_name, " << sliceModeToIceMode(op->sendMode())
- << ", __ctx, __explicitCtx);";
+
+ out << nl << "__result.prepare(__" << op->name() << "_name, " << sliceModeToIceMode(op->sendMode())
+ << ", __ctx, __explicitCtx, __synchronous);";
+
iter = 0;
if(!inArgs.empty())
{
- out << nl << "IceInternal.BasicStream __os = __result.__startWriteParams("
+ out << nl << "IceInternal.BasicStream __os = __result.startWriteParams("
<< opFormatTypeToString(op) << ");";
ParamDeclList pl;
for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
@@ -5887,17 +5771,18 @@ Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& pa
{
out << nl << "__os.writePendingObjects();";
}
- out << nl << "__result.__endWriteParams();";
+ out << nl << "__result.endWriteParams();";
}
else
{
- out << nl << "__result.__writeEmptyParams();";
+ out << nl << "__result.writeEmptyParams();";
}
- out << nl << "__result.__invoke(true);";
+
+ out << nl << "__result.invoke(true);";
out << eb;
out << nl << "catch(Ice.Exception __ex)";
out << sb;
- out << nl << "__result.__invokeExceptionAsync(__ex);";
+ out << nl << "__result.invokeExceptionAsync(__ex);";
out << eb;
out << nl << "return __result;";
out << eb;