summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-06-27 10:31:41 +0200
committerBenoit Foucher <benoit@zeroc.com>2014-06-27 10:31:41 +0200
commita4f93259dc3494d98addf38e69b87eb557d432b3 (patch)
treed2b78bb5cea24e33dc1b46be22dba6167e96c9ed /java
parentFix for ICE-5515 (ice_staticId on proxies) in Java, C#, Python, Ruby and PHP ... (diff)
downloadice-a4f93259dc3494d98addf38e69b87eb557d432b3.tar.bz2
ice-a4f93259dc3494d98addf38e69b87eb557d432b3.tar.xz
ice-a4f93259dc3494d98addf38e69b87eb557d432b3.zip
Better collocation optimization, fix for ICE-5489, ICE-5484
Diffstat (limited to 'java')
-rw-r--r--java/src/Ice/AsyncResult.java25
-rw-r--r--java/src/Ice/CommunicatorI.java8
-rw-r--r--java/src/Ice/ConnectionI.java181
-rw-r--r--java/src/Ice/DispatchInterceptor.java9
-rw-r--r--java/src/Ice/Exception.java74
-rw-r--r--java/src/Ice/LocalException.java48
-rw-r--r--java/src/Ice/Object.java2
-rw-r--r--java/src/Ice/ObjectImpl.java33
-rw-r--r--java/src/Ice/ObjectPrx.java42
-rw-r--r--java/src/Ice/ObjectPrxHelperBase.java833
-rw-r--r--java/src/Ice/OnewayCallback.java15
-rw-r--r--java/src/Ice/PropertiesI.java2
-rw-r--r--java/src/Ice/Request.java8
-rw-r--r--java/src/Ice/SystemException.java33
-rw-r--r--java/src/Ice/TwowayCallback.java7
-rw-r--r--java/src/Ice/UserException.java2
-rw-r--r--java/src/Ice/_ObjectDel.java36
-rw-r--r--java/src/Ice/_ObjectDelD.java314
-rw-r--r--java/src/Ice/_ObjectDelM.java271
-rw-r--r--java/src/IceDiscovery/PluginI.java46
-rw-r--r--java/src/IceInternal/BatchOutgoing.java163
-rw-r--r--java/src/IceInternal/BatchOutgoingAsync.java10
-rw-r--r--java/src/IceInternal/CollocatedRequestHandler.java735
-rw-r--r--java/src/IceInternal/CommunicatorObserverI.java14
-rw-r--r--java/src/IceInternal/ConnectRequestHandler.java204
-rw-r--r--java/src/IceInternal/ConnectionRequestHandler.java20
-rw-r--r--java/src/IceInternal/Direct.java140
-rw-r--r--java/src/IceInternal/DispatchObserverI.java14
-rw-r--r--java/src/IceInternal/DispatchWorkItem.java14
-rw-r--r--java/src/IceInternal/Functional_CallbackBase.java12
-rw-r--r--java/src/IceInternal/Functional_OnewayCallback.java12
-rw-r--r--java/src/IceInternal/Functional_TwowayCallback.java20
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackArg1.java10
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackArg1UE.java4
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackBool.java10
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackBoolUE.java4
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackByte.java10
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackByteUE.java4
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackDouble.java10
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackDoubleUE.java4
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackFloat.java10
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackFloatUE.java4
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackInt.java10
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackIntUE.java4
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackLong.java10
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackLongUE.java4
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackShort.java10
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackShortUE.java4
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackUE.java6
-rw-r--r--java/src/IceInternal/Functional_TwowayCallbackVoidUE.java4
-rw-r--r--java/src/IceInternal/IPEndpointI.java5
-rw-r--r--java/src/IceInternal/Incoming.java35
-rw-r--r--java/src/IceInternal/IncomingAsync.java14
-rw-r--r--java/src/IceInternal/IncomingBase.java79
-rw-r--r--java/src/IceInternal/InvocationObserverI.java133
-rw-r--r--java/src/IceInternal/LocalExceptionWrapper.java71
-rw-r--r--java/src/IceInternal/LocatorInfo.java5
-rw-r--r--java/src/IceInternal/MetricsMap.java2
-rw-r--r--java/src/IceInternal/Outgoing.java279
-rw-r--r--java/src/IceInternal/OutgoingAsync.java163
-rw-r--r--java/src/IceInternal/OutgoingAsyncMessageCallback.java6
-rw-r--r--java/src/IceInternal/OutgoingMessageCallback.java7
-rw-r--r--java/src/IceInternal/ProxyBatchOutgoingAsync.java45
-rw-r--r--java/src/IceInternal/ProxyFactory.java20
-rw-r--r--java/src/IceInternal/RequestHandler.java12
-rw-r--r--java/src/IceInternal/ResponseHandler.java17
-rw-r--r--java/src/IceInternal/RetryException.java27
-rw-r--r--java/src/IceInternal/RouterInfo.java39
-rw-r--r--java/src/IceInternal/TwowayCallback.java7
-rw-r--r--java/test/Ice/ami/AMI.java1008
-rw-r--r--java/test/Ice/ami/Collocated.java47
-rw-r--r--java/test/Ice/ami/lambda/AMI.java394
-rwxr-xr-xjava/test/Ice/ami/run.py3
-rw-r--r--java/test/Ice/defaultServant/AllTests.java4
-rw-r--r--java/test/Ice/defaultServant/MyObjectI.java8
-rw-r--r--java/test/Ice/exceptions/AllTests.java530
-rw-r--r--java/test/Ice/exceptions/Client.java2
-rw-r--r--java/test/Ice/exceptions/Collocated.java4
-rw-r--r--java/test/Ice/invoke/lambda/AllTests.java24
-rw-r--r--java/test/Ice/location/AllTests.java19
-rw-r--r--java/test/Ice/metrics/AllTests.java2
-rw-r--r--java/test/Ice/metrics/InvocationObserverI.java11
-rw-r--r--java/test/Ice/objects/AllTests.java83
-rw-r--r--java/test/Ice/objects/Client.java2
-rw-r--r--java/test/Ice/objects/Collocated.java61
-rw-r--r--java/test/Ice/operations/AllTests.java163
-rw-r--r--java/test/Ice/operations/BatchOneways.java59
-rw-r--r--java/test/Ice/operations/Client.java2
-rw-r--r--java/test/Ice/operations/Collocated.java19
-rw-r--r--java/test/Ice/operations/TwowaysAMI.java1
-rw-r--r--java/test/Ice/operations/lambda/OnewaysLambdaAMI.java116
-rw-r--r--java/test/Ice/operations/lambda/TwowaysLambdaAMI.java319
-rw-r--r--java/test/Ice/optional/lambda/AllTests.java120
-rw-r--r--java/test/Ice/proxy/AllTests.java16
-rw-r--r--java/test/Ice/retry/AllTests.java92
-rw-r--r--java/test/Ice/retry/Client.java8
-rw-r--r--java/test/Ice/retry/Collocated.java57
-rw-r--r--java/test/Ice/retry/Instrumentation.java184
-rw-r--r--java/test/Ice/retry/RetryI.java55
-rw-r--r--java/test/Ice/retry/SystemFailure.java19
-rw-r--r--java/test/Ice/retry/Test.ice5
-rwxr-xr-xjava/test/Ice/retry/run.py3
-rw-r--r--java/test/Ice/servantLocator/AllTests.java19
-rw-r--r--java/test/Ice/servantLocator/Client.java2
-rw-r--r--java/test/Ice/servantLocator/Collocated.java2
-rw-r--r--java/test/Ice/timeout/AllTests.java63
-rw-r--r--java/test/Slice/generation/list-generated.out6
107 files changed, 4109 insertions, 3858 deletions
diff --git a/java/src/Ice/AsyncResult.java b/java/src/Ice/AsyncResult.java
index 029e191336f..bf636fa6872 100644
--- a/java/src/Ice/AsyncResult.java
+++ b/java/src/Ice/AsyncResult.java
@@ -243,7 +243,7 @@ public class AsyncResult
}
}
- public final void __invokeExceptionAsync(final LocalException ex)
+ public final void __invokeExceptionAsync(final Ice.Exception ex)
{
//
// This is called when it's not safe to call the exception callback synchronously
@@ -252,7 +252,7 @@ public class AsyncResult
//
try
{
- _instance.clientThreadPool().execute(new IceInternal.DispatchWorkItem(_instance)
+ _instance.clientThreadPool().execute(new IceInternal.DispatchWorkItem()
{
public void
run()
@@ -267,7 +267,7 @@ public class AsyncResult
}
}
- public final void __invokeException(LocalException ex)
+ public final void __invokeException(Ice.Exception ex)
{
synchronized(_monitor)
{
@@ -342,6 +342,19 @@ public class AsyncResult
}
}
+ public void __attachCollocatedObserver(int requestId)
+ {
+ if(_observer != null)
+ {
+ _remoteObserver = _observer.getCollocatedObserver(requestId,
+ _os.size() - IceInternal.Protocol.headerSize - 4);
+ if(_remoteObserver != null)
+ {
+ _remoteObserver.attach();
+ }
+ }
+ }
+
public Ice.Instrumentation.InvocationObserver __getObserver()
{
return _observer;
@@ -356,7 +369,7 @@ public class AsyncResult
//
try
{
- _instance.clientThreadPool().execute(new IceInternal.DispatchWorkItem(_instance)
+ _instance.clientThreadPool().execute(new IceInternal.DispatchWorkItem()
{
public void
run()
@@ -476,7 +489,7 @@ public class AsyncResult
{
final IceInternal.RequestHandler h = handler;
_instance.clientThreadPool().execute(
- new IceInternal.DispatchWorkItem(_instance)
+ new IceInternal.DispatchWorkItem()
{
public void
run()
@@ -519,7 +532,7 @@ public class AsyncResult
protected byte _state;
protected boolean _sentSynchronously;
- protected LocalException _exception;
+ protected Ice.Exception _exception;
protected Ice.Instrumentation.InvocationObserver _observer;
protected Ice.Instrumentation.RemoteObserver _remoteObserver;
diff --git a/java/src/Ice/CommunicatorI.java b/java/src/Ice/CommunicatorI.java
index af0ad562325..918f5bdffaf 100644
--- a/java/src/Ice/CommunicatorI.java
+++ b/java/src/Ice/CommunicatorI.java
@@ -202,11 +202,11 @@ public final class CommunicatorI implements Communicator
public AsyncResult
begin_flushBatchRequests(IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __localExceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_flushBatchRequestsInternal(
- new IceInternal.Functional_CallbackBase(false, __localExceptionCb, __sentCb)
+ new IceInternal.Functional_CallbackBase(false, __exceptionCb, __sentCb)
{
public final void __completed(AsyncResult __result)
{
@@ -214,9 +214,9 @@ public final class CommunicatorI implements Communicator
{
__result.getCommunicator().end_flushBatchRequests(__result);
}
- catch(LocalException __ex)
+ catch(Exception __ex)
{
- __localExceptionCb.apply(__ex);
+ __exceptionCb.apply(__ex);
}
}
});
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java
index a39905470ac..a2c9e9d1060 100644
--- a/java/src/Ice/ConnectionI.java
+++ b/java/src/Ice/ConnectionI.java
@@ -11,7 +11,7 @@ package Ice;
import Ice.Instrumentation.InvocationObserver;
-public final class ConnectionI extends IceInternal.EventHandler implements Connection
+public final class ConnectionI extends IceInternal.EventHandler implements Connection, IceInternal.ResponseHandler
{
public interface StartCallback
{
@@ -339,7 +339,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
synchronized public boolean
sendRequest(IceInternal.Outgoing out, boolean compress, boolean response)
- throws IceInternal.LocalExceptionWrapper
+ throws IceInternal.RetryException
{
final IceInternal.BasicStream os = out.os();
@@ -350,7 +350,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
// to send our request, we always try to send the request
// again.
//
- throw new IceInternal.LocalExceptionWrapper((Ice.LocalException)_exception.fillInStackTrace(), true);
+ throw new IceInternal.RetryException((Ice.LocalException)_exception.fillInStackTrace());
}
assert(_state > StateNotValidated);
@@ -416,7 +416,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
synchronized public int
sendAsyncRequest(IceInternal.OutgoingAsync out, boolean compress, boolean response)
- throws IceInternal.LocalExceptionWrapper
+ throws IceInternal.RetryException
{
final IceInternal.BasicStream os = out.__getOs();
@@ -427,7 +427,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
// to send our request, we always try to send the request
// again.
//
- throw new IceInternal.LocalExceptionWrapper((Ice.LocalException)_exception.fillInStackTrace(), true);
+ throw new IceInternal.RetryException((Ice.LocalException)_exception.fillInStackTrace());
}
assert(_state > StateNotValidated);
@@ -486,7 +486,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public synchronized void
prepareBatchRequest(IceInternal.BasicStream os)
- throws IceInternal.LocalExceptionWrapper
+ throws IceInternal.RetryException
{
//
// Wait if flushing is currently in progress.
@@ -511,7 +511,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
//
if(_batchStream.isEmpty())
{
- throw new IceInternal.LocalExceptionWrapper((Ice.LocalException)_exception.fillInStackTrace(), true);
+ throw new IceInternal.RetryException((Ice.LocalException)_exception.fillInStackTrace());
}
else
{
@@ -559,7 +559,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
if(_exception != null)
{
- throw (Ice.LocalException)_exception.fillInStackTrace();
+ return;
}
boolean flush = false;
@@ -690,8 +690,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public void
flushBatchRequests()
{
- final InvocationObserver observer = IceInternal.ObserverHelper.get(_instance, __flushBatchRequests_name);
- IceInternal.BatchOutgoing out = new IceInternal.BatchOutgoing(this, _instance, observer);
+ IceInternal.BatchOutgoing out = new IceInternal.BatchOutgoing(this, _instance, __flushBatchRequests_name);
out.invoke();
}
@@ -717,11 +716,11 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public AsyncResult
begin_flushBatchRequests(IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __localExceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_flushBatchRequestsInternal(
- new IceInternal.Functional_CallbackBase(false, __localExceptionCb, __sentCb)
+ new IceInternal.Functional_CallbackBase(false, __exceptionCb, __sentCb)
{
public final void __completed(AsyncResult __result)
{
@@ -729,9 +728,9 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
__result.getConnection().end_flushBatchRequests(__result);
}
- catch(LocalException __ex)
+ catch(Exception __ex)
{
- __localExceptionCb.apply(__ex);
+ __exceptionCb.apply(__ex);
}
}
});
@@ -950,15 +949,12 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
// If the request is being sent, don't remove it from the send streams,
// it will be removed once the sending is finished.
//
- if(o == _sendStreams.getFirst())
- {
- o.timedOut();
- }
- else
+ boolean isSent = o.timedOut();
+ if(o != _sendStreams.getFirst())
{
it.remove();
}
- o.finished(new InvocationTimeoutException());
+ out.finished(new InvocationTimeoutException(), isSent);
return; // We're done.
}
}
@@ -979,55 +975,68 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
}
- synchronized public void
+ public void
asyncRequestTimedOut(IceInternal.OutgoingAsyncMessageCallback outAsync)
{
- java.util.Iterator<OutgoingMessage> it = _sendStreams.iterator();
- while(it.hasNext())
+ boolean isSent = false;
+ boolean finished = false;
+
+ synchronized(this)
{
- OutgoingMessage o = it.next();
- if(o.outAsync == outAsync)
+ java.util.Iterator<OutgoingMessage> it = _sendStreams.iterator();
+ while(it.hasNext())
{
- if(o.requestId > 0)
+ OutgoingMessage o = it.next();
+ if(o.outAsync == outAsync)
{
- _asyncRequests.remove(o.requestId);
- }
+ if(o.requestId > 0)
+ {
+ _asyncRequests.remove(o.requestId);
+ }
- //
- // If the request is being sent, don't remove it from the send streams,
- // it will be removed once the sending is finished.
- //
- if(o == _sendStreams.getFirst())
- {
- o.timedOut();
- }
- else
- {
- it.remove();
+ //
+ // If the request is being sent, don't remove it from the send streams,
+ // it will be removed once the sending is finished.
+ //
+ isSent = o.timedOut();
+ if(o != _sendStreams.getFirst())
+ {
+ it.remove();
+ }
+ finished = true;
+ break; // We're done.
}
- o.finished(new InvocationTimeoutException());
- return; // We're done.
}
}
- if(outAsync instanceof IceInternal.OutgoingAsync)
+ if(!finished)
{
- IceInternal.OutgoingAsync o = (IceInternal.OutgoingAsync)outAsync;
- java.util.Iterator<IceInternal.OutgoingAsync> it2 = _asyncRequests.values().iterator();
- while(it2.hasNext())
+ if(outAsync instanceof IceInternal.OutgoingAsync)
{
- if(it2.next() == o)
+ IceInternal.OutgoingAsync o = (IceInternal.OutgoingAsync)outAsync;
+ java.util.Iterator<IceInternal.OutgoingAsync> it2 = _asyncRequests.values().iterator();
+ while(it2.hasNext())
{
- o.__finished(new InvocationTimeoutException(), true);
- it2.remove();
- return; // We're done.
+ if(it2.next() == o)
+ {
+ it2.remove();
+ finished = true;
+ isSent = true;
+ break; // We're done.
+ }
}
}
}
+
+ if(finished)
+ {
+ outAsync.__finished(new InvocationTimeoutException(), isSent);
+ }
}
+
synchronized public void
- sendResponse(IceInternal.BasicStream os, byte compressFlag)
+ sendResponse(int requestId, IceInternal.BasicStream os, byte compressFlag)
{
assert(_state > StateNotValidated);
@@ -1748,7 +1757,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
public synchronized void
- invokeException(LocalException ex, int invokeNum)
+ invokeException(int requestId, LocalException ex, int invokeNum)
{
//
// Fatal exception while invoking a request. Since sendResponse/sendNoResponse isn't
@@ -2815,7 +2824,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
catch(LocalException ex)
{
- invokeException(ex, invokeNum);
+ invokeException(requestId, ex, invokeNum);
}
catch(java.lang.AssertionError ex) // Upon assertion, we print the stack trace.
{
@@ -2826,7 +2835,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
pw.flush();
uex.unknown = sw.toString();
_logger.error(uex.unknown);
- invokeException(uex, invokeNum);
+ invokeException(requestId, uex, invokeNum);
}
catch(java.lang.OutOfMemoryError ex)
{
@@ -2837,7 +2846,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
pw.flush();
uex.unknown = sw.toString();
_logger.error(uex.unknown);
- invokeException(uex, invokeNum);
+ invokeException(requestId, uex, invokeNum);
}
finally
{
@@ -2959,7 +2968,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
private void
- warning(String msg, Exception ex)
+ warning(String msg, java.lang.Exception ex)
{
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
@@ -3028,20 +3037,20 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
if(_incomingCache == null)
{
- in = new IceInternal.Incoming(_instance, this, adapter, response, compress, requestId);
+ in = new IceInternal.Incoming(_instance, this, this, adapter, response, compress, requestId);
}
else
{
in = _incomingCache;
_incomingCache = _incomingCache.next;
- in.reset(_instance, this, adapter, response, compress, requestId);
+ in.reset(_instance, this, this, adapter, response, compress, requestId);
in.next = null;
}
}
}
else
{
- in = new IceInternal.Incoming(_instance, this, adapter, response, compress, requestId);
+ in = new IceInternal.Incoming(_instance, this, this, adapter, response, compress, requestId);
}
return in;
@@ -3077,56 +3086,6 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
}
- public IceInternal.Outgoing
- getOutgoing(IceInternal.RequestHandler handler, String operation, OperationMode mode,
- java.util.Map<String, String> context, InvocationObserver observer)
- throws IceInternal.LocalExceptionWrapper
- {
- IceInternal.Outgoing out = null;
-
- if(_cacheBuffers > 0)
- {
- synchronized(_outgoingCacheMutex)
- {
- if(_outgoingCache == null)
- {
- out = new IceInternal.Outgoing(handler, operation, mode, context, observer);
- }
- else
- {
- out = _outgoingCache;
- _outgoingCache = _outgoingCache.next;
- out.reset(handler, operation, mode, context, observer);
- out.next = null;
- }
- }
- }
- else
- {
- out = new IceInternal.Outgoing(handler, operation, mode, context, observer);
- }
-
- return out;
- }
-
- public void
- reclaimOutgoing(IceInternal.Outgoing out)
- {
- if(_cacheBuffers > 0)
- {
- //
- // Clear references to Ice objects as soon as possible.
- //
- out.reclaim();
-
- synchronized(_outgoingCacheMutex)
- {
- out.next = _outgoingCache;
- _outgoingCache = out;
- }
- }
- }
-
private static class OutgoingMessage
{
OutgoingMessage(IceInternal.BasicStream stream, boolean compress, boolean adopt)
@@ -3158,12 +3117,13 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
this.isSent = false;
}
- public void
+ public boolean
timedOut()
{
assert((out != null || outAsync != null) && !isSent);
out = null;
outAsync = null;
+ return isSent;
}
public void
@@ -3289,9 +3249,6 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
private IceInternal.Incoming _incomingCache;
private java.lang.Object _incomingCacheMutex = new java.lang.Object();
- private IceInternal.Outgoing _outgoingCache;
- private java.lang.Object _outgoingCacheMutex = new java.lang.Object();
-
private Ice.ProtocolVersion _readProtocol = new Ice.ProtocolVersion();
private Ice.EncodingVersion _readProtocolEncoding = new Ice.EncodingVersion();
diff --git a/java/src/Ice/DispatchInterceptor.java b/java/src/Ice/DispatchInterceptor.java
index f7e9cc4fc8f..38f89f2ec3b 100644
--- a/java/src/Ice/DispatchInterceptor.java
+++ b/java/src/Ice/DispatchInterceptor.java
@@ -67,13 +67,4 @@ public abstract class DispatchInterceptor extends ObjectImpl
}
}
}
-
- public DispatchStatus
- __collocDispatch(IceInternal.Direct request)
- {
- //
- // Should only return DispatchOK or DispatchUserException
- //
- return dispatch(request);
- }
}
diff --git a/java/src/Ice/Exception.java b/java/src/Ice/Exception.java
new file mode 100644
index 00000000000..00ed87da5df
--- /dev/null
+++ b/java/src/Ice/Exception.java
@@ -0,0 +1,74 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package Ice;
+
+/**
+ * Base class for Ice local and system exceptions. Those exceptions
+ * are not checked so we inherit from java.lang.RuntimeException. User
+ * exceptions are checked exceptions and therefore inherit directly
+ * from java.lang.Exception.
+ **/
+public abstract class Exception extends RuntimeException implements Cloneable
+{
+ public Exception()
+ {
+ }
+
+ public Exception(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * Creates a copy of this exception.
+ *
+ * @return The copy of this exception.
+ **/
+ public java.lang.Object clone()
+ {
+ java.lang.Object o = null;
+ try
+ {
+ o = super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert false; // Impossible
+ }
+ return o;
+ }
+
+ /**
+ * Returns the name of this exception.
+ *
+ * @return The name of this exception.
+ **/
+ public abstract String
+ ice_name();
+
+ /**
+ * Returns a string representation of this exception.
+ *
+ * @return A string representation of this exception.
+ **/
+ public String
+ toString()
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ IceUtilInternal.OutputBase out = new IceUtilInternal.OutputBase(pw);
+ out.setUseTab(false);
+ out.print(getClass().getName());
+ out.inc();
+ IceInternal.ValueWriter.write(this, out);
+ pw.flush();
+ return sw.toString();
+ }
+}
diff --git a/java/src/Ice/LocalException.java b/java/src/Ice/LocalException.java
index 9564e1df2ac..f521ce01fe5 100644
--- a/java/src/Ice/LocalException.java
+++ b/java/src/Ice/LocalException.java
@@ -12,7 +12,7 @@ package Ice;
/**
* Base class for all Ice run-time exceptions.
**/
-public abstract class LocalException extends RuntimeException implements Cloneable
+public abstract class LocalException extends Exception
{
public LocalException()
{
@@ -22,50 +22,4 @@ public abstract class LocalException extends RuntimeException implements Cloneab
{
super(cause);
}
-
- /**
- * Creates a copy of this exception.
- *
- * @return The copy of this exception.
- **/
- public java.lang.Object clone()
- {
- java.lang.Object o = null;
- try
- {
- o = super.clone();
- }
- catch(CloneNotSupportedException ex)
- {
- assert false; // Impossible
- }
- return o;
- }
-
- /**
- * Returns the name of this exception.
- *
- * @return The name of this exception.
- **/
- public abstract String
- ice_name();
-
- /**
- * Returns a string representation of this exception.
- *
- * @return A string representation of this exception.
- **/
- public String
- toString()
- {
- java.io.StringWriter sw = new java.io.StringWriter();
- java.io.PrintWriter pw = new java.io.PrintWriter(sw);
- IceUtilInternal.OutputBase out = new IceUtilInternal.OutputBase(pw);
- out.setUseTab(false);
- out.print(getClass().getName());
- out.inc();
- IceInternal.ValueWriter.write(this, out);
- pw.flush();
- return sw.toString();
- }
}
diff --git a/java/src/Ice/Object.java b/java/src/Ice/Object.java
index 9fac75feaa2..e4c4bbf0d79 100644
--- a/java/src/Ice/Object.java
+++ b/java/src/Ice/Object.java
@@ -155,8 +155,6 @@ public interface Object
DispatchStatus __dispatch(IceInternal.Incoming in, Current current);
- DispatchStatus __collocDispatch(IceInternal.Direct request);
-
void __write(IceInternal.BasicStream __os);
void __read(IceInternal.BasicStream __is);
diff --git a/java/src/Ice/ObjectImpl.java b/java/src/Ice/ObjectImpl.java
index 6b051e2a4b0..dcc4acdd52d 100644
--- a/java/src/Ice/ObjectImpl.java
+++ b/java/src/Ice/ObjectImpl.java
@@ -269,28 +269,21 @@ public abstract class ObjectImpl implements Object, java.lang.Cloneable, java.io
public DispatchStatus
ice_dispatch(Request request, DispatchInterceptorAsyncCallback cb)
{
- if(request.isCollocated())
+ IceInternal.Incoming in = (IceInternal.Incoming)request;
+ if(cb != null)
{
- return __collocDispatch((IceInternal.Direct)request);
+ in.push(cb);
}
- else
+ try
+ {
+ in.startOver(); // may raise ResponseSentException
+ return __dispatch(in, in.getCurrent());
+ }
+ finally
{
- IceInternal.Incoming in = (IceInternal.Incoming)request;
if(cb != null)
{
- in.push(cb);
- }
- try
- {
- in.startOver(); // may raise ResponseSentException
- return __dispatch(in, in.getCurrent());
- }
- finally
- {
- if(cb != null)
- {
- in.pop();
- }
+ in.pop();
}
}
}
@@ -344,12 +337,6 @@ public abstract class ObjectImpl implements Object, java.lang.Cloneable, java.io
throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);
}
- public DispatchStatus
- __collocDispatch(IceInternal.Direct request)
- {
- return request.run(this);
- }
-
public void
__write(IceInternal.BasicStream os)
{
diff --git a/java/src/Ice/ObjectPrx.java b/java/src/Ice/ObjectPrx.java
index 74735d75265..113addd7daf 100644
--- a/java/src/Ice/ObjectPrx.java
+++ b/java/src/Ice/ObjectPrx.java
@@ -106,7 +106,7 @@ public interface ObjectPrx
* @return The asynchronous result object.
**/
AsyncResult begin_ice_isA(String __id, IceInternal.Functional_BoolCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
/**
* Tests whether this proxy supports a given interface.
@@ -118,7 +118,7 @@ public interface ObjectPrx
* @return The asynchronous result object.
**/
AsyncResult begin_ice_isA(String __id, IceInternal.Functional_BoolCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
@@ -132,7 +132,7 @@ public interface ObjectPrx
**/
AsyncResult begin_ice_isA(String __id, java.util.Map<String, String> __context,
IceInternal.Functional_BoolCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
/**
* Tests whether this proxy supports a given interface.
@@ -146,7 +146,7 @@ public interface ObjectPrx
**/
AsyncResult begin_ice_isA(String __id, java.util.Map<String, String> __context,
IceInternal.Functional_BoolCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
@@ -226,7 +226,7 @@ public interface ObjectPrx
* @return The asynchronous result object.
**/
AsyncResult begin_ice_ping(IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
/**
* Tests whether the target object of this proxy can be reached.
@@ -237,7 +237,7 @@ public interface ObjectPrx
* @return The asynchronous result object.
**/
AsyncResult begin_ice_ping(IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
@@ -250,7 +250,7 @@ public interface ObjectPrx
**/
AsyncResult begin_ice_ping(java.util.Map<String, String> __context,
IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
/**
* Tests whether the target object of this proxy can be reached.
@@ -263,7 +263,7 @@ public interface ObjectPrx
**/
AsyncResult begin_ice_ping(java.util.Map<String, String> __context,
IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
@@ -347,7 +347,7 @@ public interface ObjectPrx
* @return The asynchronous result object.
**/
AsyncResult begin_ice_ids(IceInternal.Functional_GenericCallback1<String[]> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
/**
* Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
@@ -358,7 +358,7 @@ public interface ObjectPrx
* @return The asynchronous result object.
**/
AsyncResult begin_ice_ids(IceInternal.Functional_GenericCallback1<String[]> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
@@ -371,7 +371,7 @@ public interface ObjectPrx
**/
AsyncResult begin_ice_ids(java.util.Map<String, String> __context,
IceInternal.Functional_GenericCallback1<String[]> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
/**
* Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
@@ -384,7 +384,7 @@ public interface ObjectPrx
**/
AsyncResult begin_ice_ids(java.util.Map<String, String> __context,
IceInternal.Functional_GenericCallback1<String[]> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
@@ -468,7 +468,7 @@ public interface ObjectPrx
* @return The asynchronous result object.
**/
AsyncResult begin_ice_id(IceInternal.Functional_GenericCallback1<String> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
/**
* Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
@@ -479,7 +479,7 @@ public interface ObjectPrx
* @return The asynchronous result object.
**/
AsyncResult begin_ice_id(IceInternal.Functional_GenericCallback1<String> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
@@ -492,7 +492,7 @@ public interface ObjectPrx
**/
AsyncResult begin_ice_id(java.util.Map<String, String> __context,
IceInternal.Functional_GenericCallback1<String> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
/**
* Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
@@ -505,7 +505,7 @@ public interface ObjectPrx
**/
AsyncResult begin_ice_id(java.util.Map<String, String> __context,
IceInternal.Functional_GenericCallback1<String> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
@@ -672,7 +672,7 @@ public interface ObjectPrx
**/
AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams,
FunctionalCallback_Object_ice_invoke_Response __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
@@ -691,7 +691,7 @@ public interface ObjectPrx
**/
AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams,
FunctionalCallback_Object_ice_invoke_Response __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
/**
* Invokes an operation dynamically and asynchronously.
@@ -712,7 +712,7 @@ public interface ObjectPrx
AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams,
java.util.Map<String, String> __context,
FunctionalCallback_Object_ice_invoke_Response __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
@@ -733,7 +733,7 @@ public interface ObjectPrx
AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams,
java.util.Map<String, String> __context,
FunctionalCallback_Object_ice_invoke_Response __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb);
/**
* Completes the asynchronous ice_invoke request.
@@ -1191,7 +1191,7 @@ public interface ObjectPrx
* @return The asynchronous result object.
**/
AsyncResult begin_ice_flushBatchRequests(IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb);
/**
diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java
index 8bf9d9ec26d..af4db1468fc 100644
--- a/java/src/Ice/ObjectPrxHelperBase.java
+++ b/java/src/Ice/ObjectPrxHelperBase.java
@@ -79,40 +79,39 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
private boolean
ice_isA(String __id, java.util.Map<String, String> __context, boolean __explicitCtx)
{
- if(__explicitCtx && __context == null)
- {
- __context = _emptyContext;
- }
-
- final InvocationObserver __observer = IceInternal.ObserverHelper.get(this, __ice_isA_name, __context);
- int __cnt = 0;
+ __checkTwowayOnly(__ice_isA_name);
+ IceInternal.Outgoing __og = getOutgoing(__ice_isA_name, OperationMode.Nonmutating, __context, __explicitCtx);
try
{
- while(true)
+ try
+ {
+ IceInternal.BasicStream __os = __og.startWriteParams(Ice.FormatType.DefaultFormat);
+ __os.writeString(__id);
+ __og.endWriteParams();
+ }
+ catch(LocalException __ex)
+ {
+ __og.abort(__ex);
+ }
+ if(!__og.invoke())
{
- _ObjectDel __del = null;
try
{
- __checkTwowayOnly(__ice_isA_name);
- __del = __getDelegate(false);
- return __del.ice_isA(__id, __context, __observer);
- }
- catch(IceInternal.LocalExceptionWrapper __ex)
- {
- __cnt = __handleExceptionWrapperRelaxed(__del, __ex, null, __cnt, __observer);
+ __og.throwUserException();
}
- catch(LocalException __ex)
+ catch(UserException __ex)
{
- __cnt = __handleException(__del, __ex, null, __cnt, __observer);
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
+ IceInternal.BasicStream __is = __og.startReadParams();
+ boolean __ret = __is.readBool();
+ __og.endReadParams();
+ return __ret;
}
finally
{
- if(__observer != null)
- {
- __observer.detach();
- }
+ reclaimOutgoing(__og);
}
}
@@ -206,7 +205,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final AsyncResult
begin_ice_isA(String __id,
IceInternal.Functional_BoolCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb)
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb)
{
return begin_ice_isA(__id, null, false, __responseCb, __exceptionCb, null);
}
@@ -223,7 +222,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final AsyncResult
begin_ice_isA(String __id,
IceInternal.Functional_BoolCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_isA(__id, null, false, __responseCb, __exceptionCb, __sentCb);
@@ -242,7 +241,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
begin_ice_isA(String __id,
java.util.Map<String, String> __context,
IceInternal.Functional_BoolCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb)
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb)
{
return begin_ice_isA(__id, __context, true, __responseCb, __exceptionCb, null);
}
@@ -261,7 +260,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
begin_ice_isA(String __id,
java.util.Map<String, String> __context,
IceInternal.Functional_BoolCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_isA(__id, __context, true, __responseCb, __exceptionCb, __sentCb);
@@ -272,7 +271,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
java.util.Map<String, String> __context,
boolean __explicitCtx,
IceInternal.Functional_BoolCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_isA(__id, __context, __explicitCtx,
@@ -289,8 +288,8 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
begin_ice_isA(String __id, java.util.Map<String, String> __context, boolean __explicitCtx,
IceInternal.CallbackBase __cb)
{
- IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __ice_isA_name, __cb);
__checkAsyncTwowayOnly(__ice_isA_name);
+ IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __ice_isA_name, __cb);
try
{
__result.__prepare(__ice_isA_name, OperationMode.Nonmutating, __context, __explicitCtx);
@@ -299,7 +298,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
__result.__endWriteParams();
__result.__invoke(true);
}
- catch(LocalException __ex)
+ catch(Exception __ex)
{
__result.__invokeExceptionAsync(__ex);
}
@@ -316,35 +315,22 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
end_ice_isA(AsyncResult __result)
{
AsyncResult.__check(__result, this, __ice_isA_name);
- boolean __ok = __result.__wait();
- try
+ if(!__result.__wait())
{
- if(!__ok)
+ try
{
- try
- {
- __result.__throwUserException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name(), __ex);
- }
+ __result.__throwUserException();
}
- boolean __ret;
- IceInternal.BasicStream __is = __result.__startReadParams();
- __ret = __is.readBool();
- __result.__endReadParams();
- return __ret;
- }
- catch(Ice.LocalException ex)
- {
- InvocationObserver obsv = __result.__getObserver();
- if(obsv != null)
+ catch(UserException __ex)
{
- obsv.failed(ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
- throw ex;
}
+ boolean __ret;
+ IceInternal.BasicStream __is = __result.__startReadParams();
+ __ret = __is.readBool();
+ __result.__endReadParams();
+ return __ret;
}
static public final void __ice_isA_completed(TwowayCallbackBool __cb, Ice.AsyncResult __result)
@@ -359,6 +345,11 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
__cb.exception(__ex);
return;
}
+ catch(SystemException __ex)
+ {
+ __cb.exception(__ex);
+ return;
+ }
__cb.response(__ret);
}
@@ -387,40 +378,15 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
private void
ice_ping(java.util.Map<String, String> __context, boolean __explicitCtx)
{
- if(__explicitCtx && __context == null)
- {
- __context = _emptyContext;
- }
-
- final InvocationObserver __observer = IceInternal.ObserverHelper.get(this, __ice_ping_name, __context);
- int __cnt = 0;
+ IceInternal.Outgoing __og = getOutgoing(__ice_ping_name, OperationMode.Nonmutating, __context, __explicitCtx);
try
{
- while(true)
- {
- _ObjectDel __del = null;
- try
- {
- __del = __getDelegate(false);
- __del.ice_ping(__context, __observer);
- return;
- }
- catch(IceInternal.LocalExceptionWrapper __ex)
- {
- __cnt = __handleExceptionWrapperRelaxed(__del, __ex, null, __cnt, __observer);
- }
- catch(LocalException __ex)
- {
- __cnt = __handleException(__del, __ex, null, __cnt, __observer);
- }
- }
+ __og.writeEmptyParams();
+ __invoke(__og);
}
finally
{
- if(__observer != null)
- {
- __observer.detach();
- }
+ reclaimOutgoing(__og);
}
}
@@ -506,7 +472,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
**/
public final AsyncResult
begin_ice_ping(IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb)
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb)
{
return begin_ice_ping(null, false,
new IceInternal.Functional_OnewayCallback(__responseCb, __exceptionCb, null));
@@ -522,7 +488,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
**/
public final AsyncResult
begin_ice_ping(IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_ping(null, false, new
@@ -540,7 +506,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final AsyncResult
begin_ice_ping(java.util.Map<String, String> __context,
IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb)
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb)
{
return begin_ice_ping(__context, true,
new IceInternal.Functional_OnewayCallback(__responseCb, __exceptionCb, null));
@@ -558,7 +524,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final AsyncResult
begin_ice_ping(java.util.Map<String, String> __context,
IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_ping(__context, true,
@@ -575,7 +541,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
__result.__writeEmptyParams();
__result.__invoke(true);
}
- catch(LocalException __ex)
+ catch(Exception __ex)
{
__result.__invokeExceptionAsync(__ex);
}
@@ -623,40 +589,30 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
private String[]
ice_ids(java.util.Map<String, String> __context, boolean __explicitCtx)
{
- if(__explicitCtx && __context == null)
- {
- __context = _emptyContext;
- }
-
- final InvocationObserver __observer = IceInternal.ObserverHelper.get(this, __ice_ids_name, __context);
- int __cnt = 0;
+ __checkTwowayOnly(__ice_id_name);
+ IceInternal.Outgoing __og = getOutgoing(__ice_ids_name, OperationMode.Nonmutating, __context, __explicitCtx);
try
{
- while(true)
+ __og.writeEmptyParams();
+ if(!__og.invoke())
{
- _ObjectDel __del = null;
try
{
- __checkTwowayOnly(__ice_ids_name);
- __del = __getDelegate(false);
- return __del.ice_ids(__context, __observer);
+ __og.throwUserException();
}
- catch(IceInternal.LocalExceptionWrapper __ex)
- {
- __cnt = __handleExceptionWrapperRelaxed(__del, __ex, null, __cnt, __observer);
- }
- catch(LocalException __ex)
+ catch(UserException __ex)
{
- __cnt = __handleException(__del, __ex, null, __cnt, __observer);
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
+ IceInternal.BasicStream __is = __og.startReadParams();
+ String[] __ret = __is.readStringSeq();
+ __og.endReadParams();
+ return __ret;
}
finally
{
- if(__observer != null)
- {
- __observer.detach();
- }
+ reclaimOutgoing(__og);
}
}
@@ -736,7 +692,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
class FunctionalCallback_Object_ice_ids extends IceInternal.Functional_TwowayCallbackArg1<String[]>
{
FunctionalCallback_Object_ice_ids(IceInternal.Functional_GenericCallback1<String[]> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
super(__responseCb, __exceptionCb, __sentCb);
@@ -757,7 +713,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
**/
public final AsyncResult
begin_ice_ids(IceInternal.Functional_GenericCallback1<String[]> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb)
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb)
{
return begin_ice_ids(null, false, new FunctionalCallback_Object_ice_ids(__responseCb, __exceptionCb, null));
}
@@ -772,7 +728,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
**/
public final AsyncResult
begin_ice_ids(IceInternal.Functional_GenericCallback1<String[]> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_ids(null, false,
@@ -790,7 +746,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final AsyncResult
begin_ice_ids(java.util.Map<String, String> __context,
IceInternal.Functional_GenericCallback1<String[]> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb)
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb)
{
return begin_ice_ids(__context, true,
new FunctionalCallback_Object_ice_ids(__responseCb, __exceptionCb, null));
@@ -808,7 +764,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final AsyncResult
begin_ice_ids(java.util.Map<String, String> __context,
IceInternal.Functional_GenericCallback1<String[]> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_ids(__context, true,
@@ -819,7 +775,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
begin_ice_ids(java.util.Map<String, String> __context,
boolean __explicitCtx,
IceInternal.Functional_GenericCallback1<String[]> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_ids(__context, true,
@@ -835,15 +791,15 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
private AsyncResult
begin_ice_ids(java.util.Map<String, String> __context, boolean __explicitCtx, IceInternal.CallbackBase __cb)
{
- IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __ice_ids_name, __cb);
__checkAsyncTwowayOnly(__ice_ids_name);
+ IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __ice_ids_name, __cb);
try
{
__result.__prepare(__ice_ids_name, OperationMode.Nonmutating, __context, __explicitCtx);
__result.__writeEmptyParams();
__result.__invoke(true);
}
- catch(LocalException __ex)
+ catch(Exception __ex)
{
__result.__invokeExceptionAsync(__ex);
}
@@ -861,35 +817,22 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
end_ice_ids(AsyncResult __result)
{
AsyncResult.__check(__result, this, __ice_ids_name);
- boolean __ok = __result.__wait();
- try
+ if(!__result.__wait())
{
- if(!__ok)
+ try
{
- try
- {
- __result.__throwUserException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name(), __ex);
- }
+ __result.__throwUserException();
}
- String[] __ret = null;
- IceInternal.BasicStream __is = __result.__startReadParams();
- __ret = StringSeqHelper.read(__is);
- __result.__endReadParams();
- return __ret;
- }
- catch(Ice.LocalException ex)
- {
- InvocationObserver obsv = __result.__getObserver();
- if(obsv != null)
+ catch(UserException __ex)
{
- obsv.failed(ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
- throw ex;
}
+ String[] __ret = null;
+ IceInternal.BasicStream __is = __result.__startReadParams();
+ __ret = StringSeqHelper.read(__is);
+ __result.__endReadParams();
+ return __ret;
}
static public final void __ice_ids_completed(TwowayCallbackArg1<String[]> __cb, AsyncResult __result)
@@ -904,6 +847,11 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
__cb.exception(__ex);
return;
}
+ catch(SystemException __ex)
+ {
+ __cb.exception(__ex);
+ return;
+ }
__cb.response(__ret);
}
@@ -935,40 +883,30 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
private String
ice_id(java.util.Map<String, String> __context, boolean __explicitCtx)
{
- if(__explicitCtx && __context == null)
- {
- __context = _emptyContext;
- }
-
- final InvocationObserver __observer = IceInternal.ObserverHelper.get(this, __ice_id_name, __context);
- int __cnt = 0;
+ __checkTwowayOnly(__ice_id_name);
+ IceInternal.Outgoing __og = getOutgoing(__ice_id_name, OperationMode.Nonmutating, __context, __explicitCtx);
try
{
- while(true)
+ __og.writeEmptyParams();
+ if(!__og.invoke())
{
- _ObjectDel __del = null;
try
{
- __checkTwowayOnly(__ice_id_name);
- __del = __getDelegate(false);
- return __del.ice_id(__context, __observer);
- }
- catch(IceInternal.LocalExceptionWrapper __ex)
- {
- __cnt = __handleExceptionWrapperRelaxed(__del, __ex, null, __cnt, __observer);
+ __og.throwUserException();
}
- catch(LocalException __ex)
+ catch(UserException __ex)
{
- __cnt = __handleException(__del, __ex, null, __cnt, __observer);
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
+ IceInternal.BasicStream __is = __og.startReadParams();
+ String __ret = __is.readString();
+ __og.endReadParams();
+ return __ret;
}
finally
{
- if(__observer != null)
- {
- __observer.detach();
- }
+ reclaimOutgoing(__og);
}
}
@@ -1048,7 +986,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
class FunctionalCallback_Object_ice_id extends IceInternal.Functional_TwowayCallbackArg1<String>
{
FunctionalCallback_Object_ice_id(IceInternal.Functional_GenericCallback1<String> responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb,
IceInternal.Functional_BoolCallback sentCb)
{
super(responseCb, exceptionCb, sentCb);
@@ -1069,7 +1007,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
**/
public final AsyncResult
begin_ice_id(IceInternal.Functional_GenericCallback1<String> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb)
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb)
{
return begin_ice_id(null, false, new FunctionalCallback_Object_ice_id(__responseCb, __exceptionCb, null));
}
@@ -1084,7 +1022,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
**/
public final AsyncResult
begin_ice_id(IceInternal.Functional_GenericCallback1<String> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_id(null, false, new FunctionalCallback_Object_ice_id(__responseCb, __exceptionCb, __sentCb));
@@ -1101,7 +1039,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final AsyncResult
begin_ice_id(java.util.Map<String, String> __context,
IceInternal.Functional_GenericCallback1<String> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb)
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb)
{
return begin_ice_id(__context, true, new FunctionalCallback_Object_ice_id(__responseCb, __exceptionCb, null));
}
@@ -1118,7 +1056,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final AsyncResult
begin_ice_id(java.util.Map<String, String> __context,
IceInternal.Functional_GenericCallback1<String> __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_id(__context, true,
@@ -1128,15 +1066,15 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
private AsyncResult
begin_ice_id(java.util.Map<String, String> __context, boolean __explicitCtx, IceInternal.CallbackBase __cb)
{
- IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __ice_id_name, __cb);
__checkAsyncTwowayOnly(__ice_id_name);
+ IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __ice_id_name, __cb);
try
{
__result.__prepare(__ice_id_name, OperationMode.Nonmutating, __context, __explicitCtx);
__result.__writeEmptyParams();
__result.__invoke(true);
}
- catch(LocalException __ex)
+ catch(Exception __ex)
{
__result.__invokeExceptionAsync(__ex);
}
@@ -1153,35 +1091,22 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
end_ice_id(AsyncResult __result)
{
AsyncResult.__check(__result, this, __ice_id_name);
- boolean __ok = __result.__wait();
- try
+ if(!__result.__wait())
{
- if(!__ok)
+ try
{
- try
- {
- __result.__throwUserException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name(), __ex);
- }
+ __result.__throwUserException();
}
- String __ret = null;
- IceInternal.BasicStream __is = __result.__startReadParams();
- __ret = __is.readString();
- __result.__endReadParams();
- return __ret;
- }
- catch(Ice.LocalException ex)
- {
- InvocationObserver obsv = __result.__getObserver();
- if(obsv != null)
+ catch(UserException __ex)
{
- obsv.failed(ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
- throw ex;
}
+ String __ret = null;
+ IceInternal.BasicStream __is = __result.__startReadParams();
+ __ret = __is.readString();
+ __result.__endReadParams();
+ return __ret;
}
static public final void __ice_id_completed(TwowayCallbackArg1<String> __cb, AsyncResult __result)
@@ -1196,6 +1121,11 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
__cb.exception(__ex);
return;
}
+ catch(SystemException __ex)
+ {
+ __cb.exception(__ex);
+ return;
+ }
__cb.response(__ret);
}
@@ -1249,46 +1179,23 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams,
java.util.Map<String, String> context, boolean explicitCtx)
{
- if(explicitCtx && context == null)
- {
- context = _emptyContext;
- }
-
- final InvocationObserver __observer = IceInternal.ObserverHelper.get(this, operation, context);
- int __cnt = 0;
+ IceInternal.Outgoing __og = getOutgoing(operation, mode, context, explicitCtx);
try
{
- while(true)
+ __og.writeParamEncaps(inParams);
+ boolean ok = __og.invoke();
+ if(_reference.getMode() == IceInternal.Reference.ModeTwoway)
{
- _ObjectDel __del = null;
- try
- {
- __del = __getDelegate(false);
- return __del.ice_invoke(operation, mode, inParams, outParams, context, __observer);
- }
- catch(IceInternal.LocalExceptionWrapper __ex)
- {
- if(mode == OperationMode.Nonmutating || mode == OperationMode.Idempotent)
- {
- __cnt = __handleExceptionWrapperRelaxed(__del, __ex, null, __cnt, __observer);
- }
- else
- {
- __handleExceptionWrapper(__del, __ex, __observer);
- }
- }
- catch(LocalException __ex)
+ if(outParams != null)
{
- __cnt = __handleException(__del, __ex, null, __cnt, __observer);
+ outParams.value = __og.readParamEncaps();
}
}
+ return ok;
}
finally
{
- if(__observer != null)
- {
- __observer.detach();
- }
+ reclaimOutgoing(__og);
}
}
@@ -1428,7 +1335,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
**/
public final AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams,
FunctionalCallback_Object_ice_invoke_Response responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb,
IceInternal.Functional_BoolCallback sentCb)
{
return begin_ice_invoke(operation, mode, inParams, null, false, responseCb, exceptionCb, sentCb);
@@ -1450,7 +1357,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
**/
public final AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams,
FunctionalCallback_Object_ice_invoke_Response responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> exceptionCb)
+ IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb)
{
return begin_ice_invoke(operation, mode, inParams, null, false, responseCb, exceptionCb, null);
}
@@ -1474,7 +1381,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams,
java.util.Map<String, String> context,
FunctionalCallback_Object_ice_invoke_Response responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb,
IceInternal.Functional_BoolCallback sentCb)
{
return begin_ice_invoke(operation, mode, inParams, context, true, responseCb, exceptionCb, sentCb);
@@ -1498,7 +1405,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams,
java.util.Map<String, String> context,
FunctionalCallback_Object_ice_invoke_Response responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> exceptionCb)
+ IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb)
{
return begin_ice_invoke(operation, mode, inParams, context, true, responseCb, exceptionCb, null);
}
@@ -1507,13 +1414,13 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
java.util.Map<String, String> __context,
boolean __explicitCtx,
FunctionalCallback_Object_ice_invoke_Response __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
class CB extends IceInternal.Functional_TwowayCallback implements _Callback_Object_ice_invoke
{
CB(FunctionalCallback_Object_ice_invoke_Response responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb,
IceInternal.Functional_BoolCallback sentCb)
{
super(responseCb != null, exceptionCb, sentCb);
@@ -1547,7 +1454,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
__result.__writeParamEncaps(inParams);
__result.__invoke(true);
}
- catch(LocalException __ex)
+ catch(Exception __ex)
{
__result.__invokeExceptionAsync(__ex);
}
@@ -1572,21 +1479,9 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
boolean ok = __result.__wait();
if(_reference.getMode() == IceInternal.Reference.ModeTwoway)
{
- try
+ if(outParams != null)
{
- if(outParams != null)
- {
- outParams.value = __result.__readParamEncaps();
- }
- }
- catch(Ice.LocalException ex)
- {
- InvocationObserver obsv = __result.__getObserver();
- if(obsv != null)
- {
- obsv.failed(ex.ice_name());
- }
- throw ex;
+ outParams.value = __result.__readParamEncaps();
}
}
return ok;
@@ -1605,6 +1500,11 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
__cb.exception(__ex);
return;
}
+ catch(SystemException __ex)
+ {
+ __cb.exception(__ex);
+ return;
+ }
__cb.response(__ret, outParams.value);
}
@@ -1683,7 +1583,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
else
{
ObjectPrxHelperBase proxy = new ObjectPrxHelperBase();
- proxy.setup(_reference.changeIdentity(newIdentity));
+ proxy.__setup(_reference.changeIdentity(newIdentity));
return proxy;
}
}
@@ -1744,7 +1644,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
else
{
ObjectPrxHelperBase proxy = new ObjectPrxHelperBase();
- proxy.setup(_reference.changeFacet(newFacet));
+ proxy.__setup(_reference.changeFacet(newFacet));
return proxy;
}
}
@@ -2361,31 +2261,55 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final Connection
ice_getConnection()
{
- final InvocationObserver __observer = IceInternal.ObserverHelper.get(this, "ice_getConnection");
- int __cnt = 0;
+ final InvocationObserver observer = IceInternal.ObserverHelper.get(this, "ice_getConnection");
+ int cnt = 0;
try
{
while(true)
{
- _ObjectDel __del = null;
+ IceInternal.RequestHandler handler = null;
try
{
- __del = __getDelegate(false);
- // Wait for the connection to be established.
- return __del.__getRequestHandler().getConnection(true);
-
+ handler = __getRequestHandler(false);
+ return handler.getConnection(true);
}
- catch(LocalException __ex)
+ catch(Ice.Exception ex)
{
- __cnt = __handleException(__del, __ex, null, __cnt, __observer);
+ try
+ {
+ Ice.IntHolder interval = new Ice.IntHolder();
+ cnt = __handleException(ex, handler, OperationMode.Idempotent, false, interval, cnt);
+ if(observer != null)
+ {
+ observer.retried();
+ }
+ if(interval.value > 0)
+ {
+ try
+ {
+ Thread.sleep(interval.value);
+ }
+ catch(InterruptedException ex1)
+ {
+ }
+ }
+ }
+ catch(Ice.Exception exc)
+ {
+ if(observer != null)
+ {
+ observer.failed(exc.ice_name());
+ }
+ throw exc;
+ }
}
}
}
finally
{
- if(__observer != null)
+ if(observer != null)
{
- __observer.detach();
+ observer.detach();
}
}
}
@@ -2404,18 +2328,17 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final Connection
ice_getCachedConnection()
{
- _ObjectDel __del = null;
+ IceInternal.RequestHandler handler = null;
synchronized(this)
{
- __del = _delegate;
+ handler = _requestHandler;
}
- if(__del != null)
+ if(handler != null)
{
try
{
- // Don't wait for the connection to be established.
- return __del.__getRequestHandler().getConnection(false);
+ return handler.getConnection(false);
}
catch(LocalException ex)
{
@@ -2430,23 +2353,8 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public void
ice_flushBatchRequests()
{
- //
- // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch
- // requests were queued with the connection, they would be lost without being noticed.
- //
- final InvocationObserver __observer = IceInternal.ObserverHelper.get(this, __ice_flushBatchRequests_name);
- _ObjectDel __del = null;
- int __cnt = -1; // Don't retry.
- try
- {
- __del = __getDelegate(false);
- __del.ice_flushBatchRequests(__observer);
- return;
- }
- catch(LocalException __ex)
- {
- __cnt = __handleException(__del, __ex, null, __cnt, __observer);
- }
+ IceInternal.BatchOutgoing __og = new IceInternal.BatchOutgoing(this, __ice_flushBatchRequests_name);
+ __og.invoke();
}
/**
@@ -2511,7 +2419,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
**/
public AsyncResult
begin_ice_flushBatchRequests(IceInternal.Functional_VoidCallback __responseCb,
- IceInternal.Functional_GenericCallback1<Ice.LocalException> __exceptionCb,
+ IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb,
IceInternal.Functional_BoolCallback __sentCb)
{
return begin_ice_flushBatchRequestsInternal(
@@ -2529,7 +2437,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
{
__result.__invoke();
}
- catch(LocalException __ex)
+ catch(Exception __ex)
{
__result.__invokeExceptionAsync(__ex);
}
@@ -2575,156 +2483,58 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
public final void
__copyFrom(ObjectPrx from)
{
- ObjectPrxHelperBase h = (ObjectPrxHelperBase)from;
- IceInternal.Reference ref = null;
- _ObjectDelM delegateM = null;
- _ObjectDelD delegateD = null;
-
synchronized(from)
{
- ref = h._reference;
- try
- {
- delegateM = (_ObjectDelM)h._delegate;
- }
- catch(ClassCastException ex)
- {
- }
- try
- {
- delegateD = (_ObjectDelD)h._delegate;
- }
- catch(ClassCastException ex)
- {
- }
- }
-
- //
- // No need to synchronize "*this", as this operation is only
- // called upon initialization.
- //
-
- assert(_reference == null);
- assert(_delegate == null);
-
- _reference = ref;
-
- if(_reference.getCacheConnection())
- {
- //
- // The _delegate attribute is only used if "cache connection"
- // is enabled. If it's not enabled, we don't keep track of the
- // delegate -- a new delegate is created for each invocation.
- //
-
- if(delegateD != null)
- {
- _ObjectDelD delegate = __createDelegateD();
- delegate.__copyFrom(delegateD);
- _delegate = delegate;
- }
- else if(delegateM != null)
- {
- _ObjectDelM delegate = __createDelegateM();
- delegate.__copyFrom(delegateM);
- _delegate = delegate;
- }
+ ObjectPrxHelperBase h = (ObjectPrxHelperBase)from;
+ _reference = h._reference;
+ _requestHandler = h._requestHandler;
}
}
public final int
- __handleException(_ObjectDel delegate, LocalException ex, Ice.IntHolder interval, int cnt,
- InvocationObserver obsv)
+ __handleException(Exception ex, IceInternal.RequestHandler handler, OperationMode mode, boolean sent, Ice.IntHolder interval,
+ int cnt)
{
+ __setRequestHandler(handler, null); // Clear the request handler
+
//
- // Only _delegate needs to be mutex protected here.
+ // We only retry local exception, system exceptions aren't retried.
//
- synchronized(this)
- {
- if(delegate == _delegate)
- {
- _delegate = null;
- }
- }
-
- try
+ // A CloseConnectionException indicates graceful server shutdown, and is therefore
+ // always repeatable without violating "at-most-once". That's because by sending a
+ // close connection message, the server guarantees that all outstanding requests
+ // can safely be repeated.
+ //
+ // An ObjectNotExistException can always be retried as well without violating
+ // "at-most-once" (see the implementation of the checkRetryAfterException method
+ // of the ProxyFactory class for the reasons why it can be useful).
+ //
+ // If the request didn't get sent or if it's non-mutating or idempotent it can
+ // also always be retried if the retry count isn't reached.
+ //
+ if(ex instanceof LocalException && (!sent ||
+ mode == OperationMode.Nonmutating || mode == OperationMode.Idempotent ||
+ ex instanceof CloseConnectionException ||
+ ex instanceof ObjectNotExistException))
{
- if(cnt == -1) // Don't retry if the retry count is -1.
- {
- throw ex;
- }
-
try
{
- cnt = _reference.getInstance().proxyFactory().checkRetryAfterException(ex, _reference, interval,
- cnt);
+ return _reference.getInstance().proxyFactory().checkRetryAfterException((LocalException)ex,
+ _reference,
+ interval,
+ cnt);
}
- catch(CommunicatorDestroyedException e)
+ catch(CommunicatorDestroyedException exc)
{
//
- // The communicator is already destroyed, so we cannot
- // retry.
+ // The communicator is already destroyed, so we cannot retry.
//
- throw e;
- }
- if(obsv != null)
- {
- obsv.retried();
- }
- return cnt;
- }
- catch(Ice.LocalException e)
- {
- if(obsv != null)
- {
- obsv.failed(e.ice_name());
- }
- throw e;
- }
- }
-
- public final void
- __handleExceptionWrapper(_ObjectDel delegate, IceInternal.LocalExceptionWrapper ex, InvocationObserver obsv)
- {
- synchronized(this)
- {
- if(delegate == _delegate)
- {
- _delegate = null;
- }
- }
-
- if(!ex.retry())
- {
- if(obsv != null)
- {
- obsv.failed(ex.get().ice_name());
+ throw ex;
}
- throw ex.get();
- }
- }
-
- public final int
- __handleExceptionWrapperRelaxed(_ObjectDel delegate,
- IceInternal.LocalExceptionWrapper ex,
- Ice.IntHolder interval,
- int cnt,
- InvocationObserver obsv)
- {
- if(!ex.retry())
- {
- return __handleException(delegate, ex.get(), interval, cnt, obsv);
}
else
{
- synchronized(this)
- {
- if(delegate == _delegate)
- {
- _delegate = null;
- }
- }
- return cnt;
+ throw ex; // Retry could break at-most-once semantics, don't retry.
}
}
@@ -2758,122 +2568,137 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
}
}
- public final _ObjectDel
- __getDelegate(boolean ami)
+ public void
+ __invoke(IceInternal.Outgoing __og)
{
- if(_reference.getCacheConnection())
+ //
+ // Helper for operations without out/return parameters and user
+ // exceptions.
+ //
+ boolean __ok = __og.invoke();
+ if(__og.hasResponse())
{
- synchronized(this)
+ if(!__ok)
{
- if(_delegate != null)
+ try
+ {
+ __og.throwUserException();
+ }
+ catch(UserException __ex)
{
- return _delegate;
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
- // Connect asynchrously to avoid blocking with the proxy mutex locked.
- _delegate = createDelegate(true);
- return _delegate;
}
+ __og.readEmptyParams();
}
- else
+ }
+
+ public final void
+ __end(AsyncResult __result, String operation)
+ {
+ AsyncResult.__check(__result, this, operation);
+ boolean ok = __result.__wait();
+ if(_reference.getMode() == IceInternal.Reference.ModeTwoway)
{
- final int mode = _reference.getMode();
- return createDelegate(ami ||
- mode == IceInternal.Reference.ModeBatchOneway ||
- mode == IceInternal.Reference.ModeBatchDatagram);
+ if(!ok)
+ {
+ try
+ {
+ __result.__throwUserException();
+ }
+ catch(UserException __ex)
+ {
+ throw new UnknownUserException(__ex.ice_name(), __ex);
+ }
+ }
+ __result.__readEmptyParams();
}
}
- synchronized public void
- __setRequestHandler(_ObjectDel delegate, IceInternal.RequestHandler handler)
+ public final IceInternal.RequestHandler
+ __getRequestHandler(boolean async)
{
if(_reference.getCacheConnection())
{
- if(delegate == _delegate)
+ synchronized(this)
{
- if(_delegate instanceof _ObjectDelM)
+ if(_requestHandler != null)
{
- _delegate = __createDelegateM();
- _delegate.__setRequestHandler(handler);
- }
- else if(_delegate instanceof _ObjectDelD)
- {
- _delegate = __createDelegateD();
- _delegate.__setRequestHandler(handler);
+ return _requestHandler;
}
+ // async = true to avoid blocking with the proxy mutex locked.
+ _requestHandler = createRequestHandler(true);
+ return _requestHandler;
}
}
+
+ final int mode = _reference.getMode();
+ return createRequestHandler(async ||
+ mode == IceInternal.Reference.ModeBatchOneway ||
+ mode == IceInternal.Reference.ModeBatchDatagram);
}
- public final void
- __end(AsyncResult __result, String operation)
+ public void
+ __setRequestHandler(IceInternal.RequestHandler previous, IceInternal.RequestHandler handler)
{
- AsyncResult.__check(__result, this, operation);
- boolean ok = __result.__wait();
- if(_reference.getMode() == IceInternal.Reference.ModeTwoway)
+ if(_reference.getCacheConnection())
{
- try
+ synchronized(this)
{
- if(!ok)
+ if(previous == _requestHandler)
+ {
+ _requestHandler = handler;
+ }
+ else if(previous != null && _requestHandler != null)
{
try
{
- __result.__throwUserException();
+ //
+ // If both request handlers point to the same connection, we also
+ // update the request handler. See bug ICE-5489 for reasons why
+ // this can be useful.
+ //
+ if(previous.getConnection(false) == _requestHandler.getConnection(false))
+ {
+ _requestHandler = handler;
+ }
}
- catch(UserException __ex)
+ catch(Ice.Exception ex)
{
- throw new UnknownUserException(__ex.ice_name(), __ex);
+ // Ignore
}
}
- __result.__readEmptyParams();
- }
- catch(Ice.LocalException ex)
- {
- InvocationObserver obsv = __result.__getObserver();
- if(obsv != null)
- {
- obsv.failed(ex.ice_name());
- }
- throw ex;
}
}
}
- protected _ObjectDelM
- __createDelegateM()
- {
- return new _ObjectDelM();
- }
-
- protected _ObjectDelD
- __createDelegateD()
- {
- return new _ObjectDelD();
- }
-
- _ObjectDel
- createDelegate(boolean async)
+ private IceInternal.RequestHandler
+ createRequestHandler(boolean async)
{
if(_reference.getCollocationOptimized())
{
ObjectAdapter adapter = _reference.getInstance().objectAdapterFactory().findObjectAdapter(this);
if(adapter != null)
{
- _ObjectDelD d = __createDelegateD();
- d.setup(_reference, adapter);
- return d;
+ return new IceInternal.CollocatedRequestHandler(_reference, adapter);
}
}
- _ObjectDelM d = __createDelegateM();
- d.setup(_reference, this, async);
- return d;
+ if(async)
+ {
+ return (new IceInternal.ConnectRequestHandler(_reference, this)).connect();
+ }
+ else
+ {
+ return new IceInternal.ConnectionRequestHandler(_reference, this);
+ }
}
//
// Only for use by IceInternal.ProxyFactory
//
public final void
- setup(IceInternal.Reference ref)
+ __setup(IceInternal.Reference ref)
{
//
// No need to synchronize, as this operation is only called
@@ -2881,7 +2706,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
//
assert(_reference == null);
- assert(_delegate == null);
+ assert(_requestHandler == null);
_reference = ref;
}
@@ -2892,7 +2717,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
try
{
ObjectPrxHelperBase proxy = (ObjectPrxHelperBase)getClass().newInstance();
- proxy.setup(ref);
+ proxy.__setup(ref);
return proxy;
}
catch(InstantiationException e)
@@ -2934,7 +2759,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
}
ObjectPrxHelperBase proxy = (ObjectPrxHelperBase)communicator.stringToProxy(s);
_reference = proxy._reference;
- assert(proxy._delegate == null);
+ assert(proxy._requestHandler == null);
}
catch(ClassCastException ex)
{
@@ -2951,9 +2776,55 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
}
}
- protected static final java.util.Map<String, String> _emptyContext = new java.util.HashMap<String, String>();
+ protected IceInternal.Outgoing
+ getOutgoing(String operation, OperationMode mode, java.util.Map<String, String> context, boolean explicitCtx)
+ {
+ IceInternal.Outgoing out = null;
+ if(_reference.getInstance().cacheMessageBuffers() > 0)
+ {
+ synchronized(this)
+ {
+ if(_outgoingCache != null)
+ {
+ out = _outgoingCache;
+ _outgoingCache = _outgoingCache.next;
+ out.next = null;
+ }
+ }
+ }
+ if(out == null)
+ {
+ out = new IceInternal.Outgoing(this, operation, mode, context, explicitCtx);
+ }
+ else
+ {
+ out.reset(this, operation, mode, context, explicitCtx);
+ }
+ return out;
+ }
+
+ protected void
+ reclaimOutgoing(IceInternal.Outgoing out)
+ {
+ out.detach();
+
+ if(_reference.getInstance().cacheMessageBuffers() > 0)
+ {
+ //
+ // Clear references to Ice objects as soon as possible.
+ //
+ out.reclaim();
+
+ synchronized(this)
+ {
+ out.next = _outgoingCache;
+ _outgoingCache = out;
+ }
+ }
+ }
private transient IceInternal.Reference _reference;
- private transient _ObjectDel _delegate;
+ private transient IceInternal.RequestHandler _requestHandler;
+ private transient IceInternal.Outgoing _outgoingCache;
public static final long serialVersionUID = 0L;
}
diff --git a/java/src/Ice/OnewayCallback.java b/java/src/Ice/OnewayCallback.java
index 71a50e268aa..c5cd16592a4 100644
--- a/java/src/Ice/OnewayCallback.java
+++ b/java/src/Ice/OnewayCallback.java
@@ -27,6 +27,16 @@ public abstract class OnewayCallback extends IceInternal.CallbackBase
public abstract void exception(LocalException ex);
/**
+ * Called when the invocation raises an Ice system exception.
+ *
+ * @param ex The Ice system exception raised by the operation.
+ **/
+ public void exception(SystemException ex)
+ {
+ exception(new Ice.UnknownException(ex));
+ }
+
+ /**
* Called when a queued invocation is sent successfully.
**/
public void sent(boolean sentSynchronously)
@@ -49,6 +59,11 @@ public abstract class OnewayCallback extends IceInternal.CallbackBase
exception(__ex);
return;
}
+ catch(SystemException __ex)
+ {
+ exception(__ex);
+ return;
+ }
response();
}
}
diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java
index 30575fdfd1e..6a6c9ec8ac6 100644
--- a/java/src/Ice/PropertiesI.java
+++ b/java/src/Ice/PropertiesI.java
@@ -378,7 +378,7 @@ public final class PropertiesI implements Properties
{
throw ex;
}
- catch(Exception ex)
+ catch(java.lang.Exception ex)
{
throw new InitializationException("Could not read Windows registry key `" + file + "'", ex);
}
diff --git a/java/src/Ice/Request.java b/java/src/Ice/Request.java
index a0d2b0456a8..0cce04cbaf2 100644
--- a/java/src/Ice/Request.java
+++ b/java/src/Ice/Request.java
@@ -15,14 +15,6 @@ package Ice;
public interface Request
{
/**
- * Returns whether this request is collocated.
- *
- * @return <code>true</code> if the invocation was made via proxy created by the same communicator
- * that hosts the target's object adapter; <code>false</code>, otherwise.
- **/
- boolean isCollocated();
-
- /**
* Returns the {@link Current} object for this the request.
*
* @return The {@link Current} object for this request.
diff --git a/java/src/Ice/SystemException.java b/java/src/Ice/SystemException.java
index a5383e9a5cf..c00492fc6d0 100644
--- a/java/src/Ice/SystemException.java
+++ b/java/src/Ice/SystemException.java
@@ -9,36 +9,17 @@
package Ice;
-public abstract class SystemException extends RuntimeException implements Cloneable
+/**
+ * Base class for all Ice system exceptions.
+ **/
+public abstract class SystemException extends Exception
{
- public java.lang.Object clone()
+ public SystemException()
{
- java.lang.Object o = null;
- try
- {
- o = super.clone();
- }
- catch(CloneNotSupportedException ex)
- {
- assert false; // Impossible
- }
- return o;
}
- public abstract String
- ice_name();
-
- public String
- toString()
+ public SystemException(Throwable cause)
{
- java.io.StringWriter sw = new java.io.StringWriter();
- java.io.PrintWriter pw = new java.io.PrintWriter(sw);
- IceUtilInternal.OutputBase out = new IceUtilInternal.OutputBase(pw);
- out.setUseTab(false);
- out.print(getClass().getName());
- out.inc();
- IceInternal.ValueWriter.write(this, out);
- pw.flush();
- return sw.toString();
+ super(cause);
}
}
diff --git a/java/src/Ice/TwowayCallback.java b/java/src/Ice/TwowayCallback.java
index a5d5928e769..fbb035ca408 100644
--- a/java/src/Ice/TwowayCallback.java
+++ b/java/src/Ice/TwowayCallback.java
@@ -20,4 +20,11 @@ public interface TwowayCallback
* @param ex The Ice run-time exception raised by the operation.
**/
public void exception(LocalException __ex);
+
+ /**
+ * Called when the invocation raises an Ice system exception.
+ *
+ * @param ex The Ice system exception raised by the operation.
+ **/
+ public void exception(SystemException __ex);
}
diff --git a/java/src/Ice/UserException.java b/java/src/Ice/UserException.java
index c5b91de3eb0..a46767287ef 100644
--- a/java/src/Ice/UserException.java
+++ b/java/src/Ice/UserException.java
@@ -12,7 +12,7 @@ package Ice;
/**
* Base class for Slice user exceptions.
**/
-public abstract class UserException extends Exception implements Cloneable
+public abstract class UserException extends java.lang.Exception implements Cloneable
{
public UserException()
{
diff --git a/java/src/Ice/_ObjectDel.java b/java/src/Ice/_ObjectDel.java
deleted file mode 100644
index aa827e0fc58..00000000000
--- a/java/src/Ice/_ObjectDel.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package Ice;
-
-import Ice.Instrumentation.InvocationObserver;
-
-public interface _ObjectDel
-{
- boolean ice_isA(String id, java.util.Map<String, String> context, InvocationObserver obsv)
- throws IceInternal.LocalExceptionWrapper;
-
- void ice_ping(java.util.Map<String, String> context, InvocationObserver obsv)
- throws IceInternal.LocalExceptionWrapper;
-
- String[] ice_ids(java.util.Map<String, String> context, InvocationObserver obsv)
- throws IceInternal.LocalExceptionWrapper;
-
- String ice_id(java.util.Map<String, String> context, InvocationObserver obsv)
- throws IceInternal.LocalExceptionWrapper;
-
- boolean ice_invoke(String operation, Ice.OperationMode mode, byte[] inParams, ByteSeqHolder outParams,
- java.util.Map<String, String> context, InvocationObserver obsv)
- throws IceInternal.LocalExceptionWrapper;
-
- void ice_flushBatchRequests(InvocationObserver obsv);
-
- IceInternal.RequestHandler __getRequestHandler();
- void __setRequestHandler(IceInternal.RequestHandler handler);
-}
diff --git a/java/src/Ice/_ObjectDelD.java b/java/src/Ice/_ObjectDelD.java
deleted file mode 100644
index a784dde95a3..00000000000
--- a/java/src/Ice/_ObjectDelD.java
+++ /dev/null
@@ -1,314 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package Ice;
-
-import Ice.Instrumentation.InvocationObserver;
-
-public class _ObjectDelD implements _ObjectDel
-{
- public boolean
- ice_isA(final String __id, java.util.Map<String, String> __context, InvocationObserver __observer)
- throws IceInternal.LocalExceptionWrapper
- {
- final Current __current = new Current();
- __initCurrent(__current, "ice_isA", OperationMode.Nonmutating, __context);
-
- final BooleanHolder __result = new BooleanHolder();
-
- IceInternal.Direct __direct = null;
- try
- {
- __direct = new IceInternal.Direct(__current)
- {
- public DispatchStatus run(Ice.Object __servant)
- {
- __result.value = __servant.ice_isA(__id, __current);
- return DispatchStatus.DispatchOK;
- }
- };
- }
- catch(Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
-
- try
- {
- DispatchStatus __status = __direct.getServant().__collocDispatch(__direct);
- assert __status == DispatchStatus.DispatchOK;
- return __result.value;
- }
- catch(java.lang.Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
- finally
- {
- try
- {
- __direct.destroy();
- }
- catch(Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
- }
- return false; // Keep compiler happy.
- }
-
- public void
- ice_ping(java.util.Map<String, String> __context, InvocationObserver __observer)
- throws IceInternal.LocalExceptionWrapper
- {
- final Current __current = new Current();
- __initCurrent(__current, "ice_ping", OperationMode.Nonmutating, __context);
-
- IceInternal.Direct __direct = null;
- try
- {
- __direct = new IceInternal.Direct(__current)
- {
- public DispatchStatus run(Ice.Object __servant)
- {
- __servant.ice_ping(__current);
- return DispatchStatus.DispatchOK;
- }
- };
- }
- catch(Ice.UserException __ex)
- {
- UnknownUserException ex = new UnknownUserException(__ex.ice_name(), __ex);
- throw new IceInternal.LocalExceptionWrapper(ex, false);
- }
-
- try
- {
- DispatchStatus __status = __direct.getServant().__collocDispatch(__direct);
- assert __status == DispatchStatus.DispatchOK;
- }
- catch(Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
- finally
- {
- try
- {
- __direct.destroy();
- }
- catch(Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
- }
- }
-
- public String[]
- ice_ids(java.util.Map<String, String> __context, InvocationObserver __observer)
- throws IceInternal.LocalExceptionWrapper
- {
- final Current __current = new Current();
- __initCurrent(__current, "ice_ids", OperationMode.Nonmutating, __context);
-
- final Ice.StringSeqHolder __result = new Ice.StringSeqHolder();
-
- IceInternal.Direct __direct = null;
- try
- {
- __direct = new IceInternal.Direct(__current)
- {
-
- public DispatchStatus run(Ice.Object __servant)
- {
- __result.value = __servant.ice_ids(__current);
- return DispatchStatus.DispatchOK;
- }
- };
- }
- catch(Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
-
- try
- {
- DispatchStatus __status = __direct.getServant().__collocDispatch(__direct);
- assert __status == DispatchStatus.DispatchOK;
- return __result.value;
- }
- catch(Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
- finally
- {
- try
- {
- __direct.destroy();
- }
- catch(Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
- }
- return __result.value; // Keep compiler happy.
- }
-
- public String
- ice_id(java.util.Map<String, String> __context, InvocationObserver __observer)
- throws IceInternal.LocalExceptionWrapper
- {
- final Current __current = new Current();
- __initCurrent(__current, "ice_id", OperationMode.Nonmutating, __context);
-
- final Ice.StringHolder __result = new Ice.StringHolder();
-
- IceInternal.Direct __direct = null;
- try
- {
- __direct = new IceInternal.Direct(__current)
- {
- public DispatchStatus run(Ice.Object __servant)
- {
- __result.value = __servant.ice_id(__current);
- return DispatchStatus.DispatchOK;
- }
- };
- }
- catch(Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
-
- try
- {
- DispatchStatus __status = __direct.getServant().__collocDispatch(__direct);
- assert __status == DispatchStatus.DispatchOK;
- return __result.value;
- }
- catch(Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
- finally
- {
- try
- {
- __direct.destroy();
- }
- catch(Throwable __ex)
- {
- IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
- }
- }
- return __result.value; // Keep compiler happy.
- }
-
- public boolean
- ice_invoke(String operation, Ice.OperationMode mode, byte[] inParams, ByteSeqHolder outParams,
- java.util.Map<String, String> context, InvocationObserver observer)
- {
- throw new CollocationOptimizationException();
- }
-
- public void
- ice_flushBatchRequests(InvocationObserver observer)
- {
- throw new CollocationOptimizationException();
- }
-
- public IceInternal.RequestHandler
- __getRequestHandler()
- {
- throw new CollocationOptimizationException();
- }
-
- public void
- __setRequestHandler(IceInternal.RequestHandler handler)
- {
- throw new CollocationOptimizationException();
- }
-
- //
- // Only for use by ObjectPrx.
- //
- final void
- __copyFrom(_ObjectDelD from)
- {
- //
- // No need to synchronize "from", as the delegate is immutable
- // after creation.
- //
-
- //
- // No need to synchronize, as this operation is only called
- // upon initialization.
- //
-
- assert(__reference == null);
- assert(__adapter == null);
-
- __reference = from.__reference;
- __adapter = from.__adapter;
- }
-
- protected IceInternal.Reference __reference;
- protected Ice.ObjectAdapter __adapter;
-
- protected final void
- __initCurrent(Current current, String op, Ice.OperationMode mode, java.util.Map<String, String> context)
- {
- current.adapter = __adapter;
- current.id = __reference.getIdentity();
- current.facet = __reference.getFacet();
- current.operation = op;
- current.mode = mode;
-
- if(context != null)
- {
- current.ctx = context;
- }
- else
- {
- //
- // Implicit context
- //
- ImplicitContextI implicitContext =
- __reference.getInstance().getImplicitContext();
-
- java.util.Map<String, String> prxContext = __reference.getContext();
-
- if(implicitContext == null)
- {
- current.ctx = new java.util.HashMap<String, String>(prxContext);
- }
- else
- {
- current.ctx = implicitContext.combine(prxContext);
- }
- }
- current.requestId = -1;
- }
-
- public void
- setup(IceInternal.Reference ref, Ice.ObjectAdapter adapter)
- {
- //
- // No need to synchronize, as this operation is only called
- // upon initialization.
- //
-
- assert(__reference == null);
- assert(__adapter == null);
-
- __reference = ref;
- __adapter = adapter;
- }
-}
diff --git a/java/src/Ice/_ObjectDelM.java b/java/src/Ice/_ObjectDelM.java
deleted file mode 100644
index 069cccf2d4f..00000000000
--- a/java/src/Ice/_ObjectDelM.java
+++ /dev/null
@@ -1,271 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package Ice;
-
-import Ice.Instrumentation.InvocationObserver;
-
-public class _ObjectDelM implements _ObjectDel
-{
- public boolean
- ice_isA(String __id, java.util.Map<String, String> __context, InvocationObserver __observer)
- throws IceInternal.LocalExceptionWrapper
- {
- IceInternal.Outgoing __og = __handler.getOutgoing("ice_isA", OperationMode.Nonmutating, __context, __observer);
- try
- {
- try
- {
- IceInternal.BasicStream __os = __og.startWriteParams(Ice.FormatType.DefaultFormat);
- __os.writeString(__id);
- __og.endWriteParams();
- }
- catch(LocalException __ex)
- {
- __og.abort(__ex);
- }
- boolean __ok = __og.invoke();
- try
- {
- if(!__ok)
- {
- try
- {
- __og.throwUserException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name(), __ex);
- }
- }
- IceInternal.BasicStream __is = __og.startReadParams();
- boolean __ret = __is.readBool();
- __og.endReadParams();
- return __ret;
- }
- catch(LocalException __ex)
- {
- throw new IceInternal.LocalExceptionWrapper(__ex, false);
- }
- }
- finally
- {
- __handler.reclaimOutgoing(__og);
- }
- }
-
- public void
- ice_ping(java.util.Map<String, String> __context, InvocationObserver __observer)
- throws IceInternal.LocalExceptionWrapper
- {
- IceInternal.Outgoing __og = __handler.getOutgoing("ice_ping", OperationMode.Nonmutating, __context, __observer);
- try
- {
- __og.writeEmptyParams();
- boolean __ok = __og.invoke();
- if(__og.hasResponse())
- {
- try
- {
- if(!__ok)
- {
- try
- {
- __og.throwUserException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name(), __ex);
- }
- }
- __og.readEmptyParams();
- }
- catch(LocalException __ex)
- {
- throw new IceInternal.LocalExceptionWrapper(__ex, false);
- }
- }
- }
- finally
- {
- __handler.reclaimOutgoing(__og);
- }
- }
-
- public String[]
- ice_ids(java.util.Map<String, String> __context, InvocationObserver __observer)
- throws IceInternal.LocalExceptionWrapper
- {
- IceInternal.Outgoing __og = __handler.getOutgoing("ice_ids", OperationMode.Nonmutating, __context, __observer);
- try
- {
- __og.writeEmptyParams();
- boolean __ok = __og.invoke();
- try
- {
- if(!__ok)
- {
- try
- {
- __og.throwUserException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name(), __ex);
- }
- }
- IceInternal.BasicStream __is = __og.startReadParams();
- String[] __ret = __is.readStringSeq();
- __og.endReadParams();
- return __ret;
- }
- catch(LocalException __ex)
- {
- throw new IceInternal.LocalExceptionWrapper(__ex, false);
- }
- }
- finally
- {
- __handler.reclaimOutgoing(__og);
- }
- }
-
- public String
- ice_id(java.util.Map<String, String> __context, InvocationObserver __observer)
- throws IceInternal.LocalExceptionWrapper
- {
- IceInternal.Outgoing __og = __handler.getOutgoing("ice_id", OperationMode.Nonmutating, __context, __observer);
- try
- {
- __og.writeEmptyParams();
- boolean __ok = __og.invoke();
- try
- {
- if(!__ok)
- {
- try
- {
- __og.throwUserException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name(), __ex);
- }
- }
- IceInternal.BasicStream __is = __og.startReadParams();
- String __ret = __is.readString();
- __og.endReadParams();
- return __ret;
- }
- catch(LocalException __ex)
- {
- throw new IceInternal.LocalExceptionWrapper(__ex, false);
- }
- }
- finally
- {
- __handler.reclaimOutgoing(__og);
- }
- }
-
- public boolean
- ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams,
- java.util.Map<String, String> __context, InvocationObserver __observer)
- throws IceInternal.LocalExceptionWrapper
- {
- IceInternal.Outgoing __og = __handler.getOutgoing(operation, mode, __context, __observer);
- try
- {
- __og.writeParamEncaps(inParams);
- boolean ok = __og.invoke();
- if(__handler.getReference().getMode() == IceInternal.Reference.ModeTwoway)
- {
- try
- {
- if(outParams != null)
- {
- outParams.value = __og.readParamEncaps();
- }
- }
- catch(LocalException __ex)
- {
- throw new IceInternal.LocalExceptionWrapper(__ex, false);
- }
- }
- return ok;
- }
- finally
- {
- __handler.reclaimOutgoing(__og);
- }
- }
-
- public void
- ice_flushBatchRequests(InvocationObserver observer)
- {
- IceInternal.BatchOutgoing out = new IceInternal.BatchOutgoing(__handler, observer);
- out.invoke();
- }
-
- public IceInternal.RequestHandler
- __getRequestHandler()
- {
- return __handler;
- }
-
- public void
- __setRequestHandler(IceInternal.RequestHandler handler)
- {
- __handler = handler;
- }
-
- //
- // Only for use by ObjectPrx
- //
- final void
- __copyFrom(_ObjectDelM from)
- {
- //
- // No need to synchronize "from", as the delegate is immutable
- // after creation.
- //
-
- //
- // No need to synchronize, as this operation is only called
- // upon initialization.
- //
-
- assert(__handler == null);
-
- __handler = from.__handler;
- }
-
- protected IceInternal.RequestHandler __handler;
-
- public void
- setup(IceInternal.Reference ref, Ice.ObjectPrx proxy, boolean async)
- {
- //
- // No need to synchronize, as this operation is only called
- // upon initialization.
- //
-
- assert(__handler == null);
-
- if(async)
- {
- IceInternal.ConnectRequestHandler handler = new IceInternal.ConnectRequestHandler(ref, proxy, this);
- __handler = handler.connect();
- }
- else
- {
- __handler = new IceInternal.ConnectionRequestHandler(ref, proxy);
- }
- }
-}
diff --git a/java/src/IceDiscovery/PluginI.java b/java/src/IceDiscovery/PluginI.java
index f11f0f366cf..e78517cb068 100644
--- a/java/src/IceDiscovery/PluginI.java
+++ b/java/src/IceDiscovery/PluginI.java
@@ -15,22 +15,12 @@ public class PluginI implements Ice.Plugin
PluginI(Ice.Communicator communicator)
{
_communicator = communicator;
-
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = communicator.getProperties()._clone();
- initData.properties.setProperty("Ice.Default.CollocationOptimized", "0");
- java.util.Map<String, String> props = initData.properties.getPropertiesForPrefix("Ice.Plugin.");
- for(String key : props.keySet())
- {
- initData.properties.setProperty(key, "");
- }
- _pluginCommunicator = Ice.Util.initialize(initData);
}
public void
initialize()
{
- Ice.Properties properties = _pluginCommunicator.getProperties();
+ Ice.Properties properties = _communicator.getProperties();
boolean ipv4 = properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
String address;
@@ -67,19 +57,19 @@ public class PluginI implements Ice.Plugin
}
if(properties.getProperty("IceDiscovery.Locator.Endpoints").isEmpty())
{
- properties.setProperty("IceDiscovery.Locator.Endpoints", "tcp -h 127.0.0.1");
+ properties.setProperty("IceDiscovery.Locator.AdapterId", java.util.UUID.randomUUID().toString());
}
- Ice.ObjectAdapter multicastAdapter = _pluginCommunicator.createObjectAdapter("IceDiscovery.Multicast");
- Ice.ObjectAdapter replyAdapter = _pluginCommunicator.createObjectAdapter("IceDiscovery.Reply");
- Ice.ObjectAdapter locatorAdapter = _pluginCommunicator.createObjectAdapter("IceDiscovery.Locator");
+ _multicastAdapter = _communicator.createObjectAdapter("IceDiscovery.Multicast");
+ _replyAdapter = _communicator.createObjectAdapter("IceDiscovery.Reply");
+ _locatorAdapter = _communicator.createObjectAdapter("IceDiscovery.Locator");
//
// Setup locatory registry.
//
LocatorRegistryI locatorRegistry = new LocatorRegistryI(_communicator);
Ice.LocatorRegistryPrx locatorRegistryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast(
- locatorAdapter.addWithUUID(locatorRegistry));
+ _locatorAdapter.addWithUUID(locatorRegistry));
String lookupEndpoints = properties.getProperty("IceDiscovery.Lookup");
if(lookupEndpoints.isEmpty())
@@ -93,36 +83,40 @@ public class PluginI implements Ice.Plugin
lookupEndpoints = s.toString();
}
- Ice.ObjectPrx lookupPrx = _pluginCommunicator.stringToProxy("IceDiscovery/Lookup -d:" + lookupEndpoints);
- lookupPrx = lookupPrx.ice_collocationOptimized(false);
+ Ice.ObjectPrx lookupPrx = _communicator.stringToProxy("IceDiscovery/Lookup -d:" + lookupEndpoints);
+ lookupPrx = lookupPrx.ice_collocationOptimized(false); // No collocation optimization for the multicast proxy!
//
// Add lookup and lookup reply Ice objects
//
LookupI lookup = new LookupI(locatorRegistry, LookupPrxHelper.uncheckedCast(lookupPrx), properties);
- multicastAdapter.add(lookup, _pluginCommunicator.stringToIdentity("IceDiscovery/Lookup"));
+ _multicastAdapter.add(lookup, _communicator.stringToIdentity("IceDiscovery/Lookup"));
- Ice.ObjectPrx lookupReply = replyAdapter.addWithUUID(new LookupReplyI(lookup)).ice_datagram();
+ Ice.ObjectPrx lookupReply = _replyAdapter.addWithUUID(new LookupReplyI(lookup)).ice_datagram();
lookup.setLookupReply(LookupReplyPrxHelper.uncheckedCast(lookupReply));
//
// Setup locator on the communicator.
//
- Ice.ObjectPrx locator = locatorAdapter.addWithUUID(new LocatorI(lookup, locatorRegistryPrx));
+ Ice.ObjectPrx locator = _locatorAdapter.addWithUUID(new LocatorI(lookup, locatorRegistryPrx));
_communicator.setDefaultLocator(
Ice.LocatorPrxHelper.uncheckedCast(_communicator.stringToProxy(locator.toString())));
- multicastAdapter.activate();
- replyAdapter.activate();
- locatorAdapter.activate();
+ _multicastAdapter.activate();
+ _replyAdapter.activate();
+ _locatorAdapter.activate();
}
public void
destroy()
{
- _pluginCommunicator.destroy();
+ _multicastAdapter.destroy();
+ _replyAdapter.destroy();
+ _locatorAdapter.destroy();
}
private Ice.Communicator _communicator;
- private Ice.Communicator _pluginCommunicator;
+ private Ice.ObjectAdapter _multicastAdapter;
+ private Ice.ObjectAdapter _replyAdapter;
+ private Ice.ObjectAdapter _locatorAdapter;
}
diff --git a/java/src/IceInternal/BatchOutgoing.java b/java/src/IceInternal/BatchOutgoing.java
index 65795d25c92..b60e29268aa 100644
--- a/java/src/IceInternal/BatchOutgoing.java
+++ b/java/src/IceInternal/BatchOutgoing.java
@@ -15,102 +15,145 @@ import Ice.Instrumentation.InvocationObserver;
public final class BatchOutgoing implements OutgoingMessageCallback
{
public
- BatchOutgoing(Ice.ConnectionI connection, Instance instance, InvocationObserver observer)
+ BatchOutgoing(Ice.ConnectionI connection, Instance instance, String op)
{
_connection = connection;
_sent = false;
_os = new BasicStream(instance, Protocol.currentProtocolEncoding);
- _observer = observer;
+ _observer = IceInternal.ObserverHelper.get(instance, op);
}
public
- BatchOutgoing(RequestHandler handler, InvocationObserver observer)
+ BatchOutgoing(Ice.ObjectPrxHelperBase proxy, String op)
{
- _handler = handler;
+ _proxy = proxy;
_sent = false;
- _os = new BasicStream(handler.getReference().getInstance(), Protocol.currentProtocolEncoding);
- _observer = observer;
- Protocol.checkSupportedProtocol(_handler.getReference().getProtocol());
+ _os = new BasicStream(proxy.__reference().getInstance(), Protocol.currentProtocolEncoding);
+ _observer = IceInternal.ObserverHelper.get(proxy, op);
+ Protocol.checkSupportedProtocol(_proxy.__reference().getProtocol());
}
public void
invoke()
{
- assert(_handler != null || _connection != null);
+ assert(_proxy != null || _connection != null);
- int timeout;
if(_connection != null)
{
if(_connection.flushBatchRequests(this))
{
return;
}
- timeout = -1;
- }
- else
- {
- try
+
+ synchronized(this)
{
- if(_handler.sendRequest(this))
+ while(_exception == null && !_sent)
{
- return;
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ if(_exception != null)
+ {
+ throw _exception;
}
}
- catch(IceInternal.LocalExceptionWrapper ex)
- {
- throw ex.get();
- }
- timeout = _handler.getReference().getInvocationTimeout();
+ return;
}
- boolean timedOut = false;
- synchronized(this)
+ RequestHandler handler = null;
+ try
{
- if(timeout > 0)
+ handler = _proxy.__getRequestHandler(false);
+ if(handler.sendRequest(this))
{
- long now = Time.currentMonotonicTimeMillis();
- long deadline = now + timeout;
- while(_exception == null && !_sent && !timedOut)
+ return;
+ }
+
+ boolean timedOut = false;
+ synchronized(this)
+ {
+ int timeout = _proxy.__reference().getInvocationTimeout();
+ if(timeout > 0)
{
- try
+ long now = Time.currentMonotonicTimeMillis();
+ long deadline = now + timeout;
+ while(_exception == null && !_sent && !timedOut)
{
- wait(deadline - now);
- if(_exception == null && !_sent)
+ try
+ {
+ wait(deadline - now);
+ if(_exception == null && !_sent)
+ {
+ now = Time.currentMonotonicTimeMillis();
+ timedOut = now >= deadline;
+ }
+ }
+ catch(InterruptedException ex)
{
- now = Time.currentMonotonicTimeMillis();
- timedOut = now >= deadline;
}
}
- catch(InterruptedException ex)
+ }
+ else
+ {
+ while(_exception == null && !_sent)
{
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
}
}
}
- else
+
+ if(timedOut)
{
- while(_exception == null && !_sent)
+ handler.requestTimedOut(this);
+
+ synchronized(this)
{
- try
- {
- wait();
- }
- catch(InterruptedException ex)
+ while(_exception == null)
{
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
}
}
}
+
+ if(_exception != null)
+ {
+ throw (Ice.Exception)_exception.fillInStackTrace();
+ }
}
-
- if(timedOut)
+ catch(RetryException ex)
{
- _handler.requestTimedOut(this);
- assert(_exception != null);
+ //
+ // Clear request handler but don't retry or throw. Retrying
+ // isn't useful, there were no batch requests associated with
+ // the proxy's request handler.
+ //
+ _proxy.__setRequestHandler(handler, null);
}
-
- if(_exception != null)
+ catch(Ice.Exception ex)
{
- _exception.fillInStackTrace();
- throw _exception;
+ _proxy.__setRequestHandler(handler, null); // Clear request handler
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_name());
+ }
+ throw ex; // Throw to notify the user that batch requests were potentially lost.
}
}
@@ -120,6 +163,12 @@ public final class BatchOutgoing implements OutgoingMessageCallback
return connection.flushBatchRequests(this);
}
+ public void
+ invokeCollocated(CollocatedRequestHandler handler)
+ {
+ handler.invokeBatchRequests(this);
+ }
+
synchronized public void
sent()
{
@@ -133,7 +182,7 @@ public final class BatchOutgoing implements OutgoingMessageCallback
}
public synchronized void
- finished(Ice.LocalException ex, boolean sent)
+ finished(Ice.Exception ex, boolean sent)
{
if(_remoteObserver != null)
{
@@ -164,11 +213,23 @@ public final class BatchOutgoing implements OutgoingMessageCallback
}
}
- private RequestHandler _handler;
+ public void attachCollocatedObserver(int requestId)
+ {
+ if(_observer != null)
+ {
+ _remoteObserver = _observer.getCollocatedObserver(requestId, _os.size() - Protocol.headerSize - 4);
+ if(_remoteObserver != null)
+ {
+ _remoteObserver.attach();
+ }
+ }
+ }
+
+ private Ice.ObjectPrxHelperBase _proxy;
private Ice.ConnectionI _connection;
private BasicStream _os;
private boolean _sent;
- private Ice.LocalException _exception;
+ private Ice.Exception _exception;
private InvocationObserver _observer;
private Observer _remoteObserver;
diff --git a/java/src/IceInternal/BatchOutgoingAsync.java b/java/src/IceInternal/BatchOutgoingAsync.java
index cfec8416234..6153624c88e 100644
--- a/java/src/IceInternal/BatchOutgoingAsync.java
+++ b/java/src/IceInternal/BatchOutgoingAsync.java
@@ -22,13 +22,19 @@ public class BatchOutgoingAsync extends Ice.AsyncResult implements OutgoingAsync
return connection.flushAsyncBatchRequests(this);
}
+ public int
+ __invokeCollocated(CollocatedRequestHandler handler)
+ {
+ return handler.invokeAsyncBatchRequests(this);
+ }
+
public boolean
__sent()
{
synchronized(_monitor)
{
_state |= Done | OK | Sent;
- _os.resize(0, false); // Clear buffer now, instead of waiting for AsyncResult deallocation
+ //_os.resize(0, false); // Don't clear the buffer now, it's needed for the collocation optimization
if(_remoteObserver != null)
{
_remoteObserver.detach();
@@ -51,7 +57,7 @@ public class BatchOutgoingAsync extends Ice.AsyncResult implements OutgoingAsync
}
public void
- __finished(Ice.LocalException exc, boolean sent)
+ __finished(Ice.Exception exc, boolean sent)
{
if(_remoteObserver != null)
{
diff --git a/java/src/IceInternal/CollocatedRequestHandler.java b/java/src/IceInternal/CollocatedRequestHandler.java
new file mode 100644
index 00000000000..13965c3c10b
--- /dev/null
+++ b/java/src/IceInternal/CollocatedRequestHandler.java
@@ -0,0 +1,735 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package IceInternal;
+
+import Ice.Instrumentation.InvocationObserver;
+
+public class CollocatedRequestHandler implements RequestHandler, ResponseHandler
+{
+ class InvokeAll extends DispatchWorkItem
+ {
+ public
+ InvokeAll(OutgoingMessageCallback out, BasicStream os, int requestId, int invokeNum, boolean batch)
+ {
+ _out = out;
+ _os = os;
+ _requestId = requestId;
+ _invokeNum = invokeNum;
+ _batch = batch;
+ }
+
+ public void
+ run()
+ {
+ if(sent(_out))
+ {
+ invokeAll(_os, _requestId, _invokeNum, _batch);
+ }
+ }
+
+ private final OutgoingMessageCallback _out;
+ private final BasicStream _os;
+ private final int _requestId;
+ private final int _invokeNum;
+ private final boolean _batch;
+ };
+
+ class InvokeAllAsync extends DispatchWorkItem
+ {
+ public InvokeAllAsync(OutgoingAsyncMessageCallback outAsync, BasicStream os, int requestId, int invokeNum,
+ boolean batch)
+ {
+ _outAsync = outAsync;
+ _os = os;
+ _requestId = requestId;
+ _invokeNum = invokeNum;
+ _batch = batch;
+ }
+
+ public void
+ run()
+ {
+ if(sentAsync(_outAsync))
+ {
+ invokeAll(_os, _requestId, _invokeNum, _batch);
+ }
+ }
+
+ private final OutgoingAsyncMessageCallback _outAsync;
+ private final BasicStream _os;
+ private final int _requestId;
+ private final int _invokeNum;
+ private final boolean _batch;
+ };
+
+ private void
+ fillInValue(BasicStream os, int pos, int value)
+ {
+ os.pos(pos);
+ os.writeInt(value);
+ }
+
+ public
+ CollocatedRequestHandler(Reference ref, Ice.ObjectAdapter adapter)
+ {
+ _reference = ref;
+ _response = _reference.getMode() == Reference.ModeTwoway;
+ _adapter = (Ice.ObjectAdapterI)adapter;
+
+ _logger = _reference.getInstance().initializationData().logger; // Cached for better performance.
+ _traceLevels = _reference.getInstance().traceLevels(); // Cached for better performance.
+ _batchAutoFlush = ref.getInstance().initializationData().properties.getPropertyAsIntWithDefault(
+ "Ice.BatchAutoFlush", 1) > 0;
+ _requestId = 0;
+ _batchStreamInUse = false;
+ _batchRequestNum = 0;
+ _batchStream = new BasicStream(ref.getInstance(), Protocol.currentProtocolEncoding, _batchAutoFlush);
+ }
+
+ synchronized public void
+ prepareBatchRequest(BasicStream os)
+ {
+ while(_batchStreamInUse)
+ {
+ try
+ {
+ wait();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ if(_batchStream.isEmpty())
+ {
+ try
+ {
+ _batchStream.writeBlob(Protocol.requestBatchHdr);
+ }
+ catch(Ice.LocalException ex)
+ {
+ throw ex;
+ }
+ }
+
+ _batchStreamInUse = true;
+ _batchMarker = _batchStream.size();
+ _batchStream.swap(os);
+ }
+
+ public void
+ finishBatchRequest(BasicStream os)
+ {
+ try
+ {
+ synchronized(this)
+ {
+ _batchStream.swap(os);
+
+ if(_batchAutoFlush & (_batchStream.size() > _reference.getInstance().messageSizeMax()))
+ {
+ //
+ // Temporarily save the last request.
+ //
+ byte[] lastRequest = new byte[_batchStream.size() - _batchMarker];
+ Buffer buffer = _batchStream.getBuffer();
+ buffer.b.position(_batchMarker);
+ buffer.b.get(lastRequest);
+ _batchStream.resize(_batchMarker, false);
+
+ final int invokeNum = _batchRequestNum;
+ final BasicStream stream = new BasicStream(_reference.getInstance(),
+ Protocol.currentProtocolEncoding,
+ _batchAutoFlush);
+ stream.swap(_batchStream);
+
+ _adapter.getThreadPool().execute(
+ new DispatchWorkItem()
+ {
+ public void
+ run()
+ {
+ CollocatedRequestHandler.this.invokeAll(stream, 0, invokeNum, true);
+ }
+ });
+
+ //
+ // Reset the batch.
+ //
+ _batchRequestNum = 0;
+ _batchMarker = 0;
+
+ //
+ // Check again if the last request doesn't exceed what we can send with the auto flush
+ //
+ if(Protocol.requestBatchHdr.length + lastRequest.length > _reference.getInstance().messageSizeMax())
+ {
+ Ex.throwMemoryLimitException(Protocol.requestBatchHdr.length + lastRequest.length,
+ _reference.getInstance().messageSizeMax());
+ }
+
+ //
+ // Start a new batch with the last message that caused us to go over the limit.
+ //
+ _batchStream.writeBlob(Protocol.requestBatchHdr);
+ _batchStream.writeBlob(lastRequest);
+ }
+
+ //
+ // Increment the number of requests in the batch.
+ //
+ assert(_batchStreamInUse);
+ ++_batchRequestNum;
+ _batchStreamInUse = false;
+ notifyAll();
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ abortBatchRequest();
+ throw ex;
+ }
+ }
+
+ synchronized public void
+ abortBatchRequest()
+ {
+ BasicStream dummy = new BasicStream(_reference.getInstance(), Protocol.currentProtocolEncoding,
+ _batchAutoFlush);
+ _batchStream.swap(dummy);
+ _batchRequestNum = 0;
+ _batchMarker = 0;
+
+ assert(_batchStreamInUse);
+ _batchStreamInUse = false;
+ notifyAll();
+ }
+
+ public boolean
+ sendRequest(OutgoingMessageCallback out)
+ {
+ out.invokeCollocated(this);
+ return !_response && _reference.getInvocationTimeout() == 0;
+ }
+
+ public int
+ sendAsyncRequest(OutgoingAsyncMessageCallback outAsync)
+ {
+ return outAsync.__invokeCollocated(this);
+ }
+
+ synchronized public void
+ requestTimedOut(OutgoingMessageCallback out)
+ {
+ Integer requestId = _sendRequests.get(out);
+ if(requestId != null)
+ {
+ if(requestId > 0)
+ {
+ _requests.remove(requestId);
+ }
+ out.finished(new Ice.InvocationTimeoutException(), false);
+ _sendRequests.remove(out);
+ }
+ else if(out instanceof Outgoing)
+ {
+ Outgoing o = (Outgoing)out;
+ assert(o != null);
+ for(java.util.Map.Entry<Integer, Outgoing> e : _requests.entrySet())
+ {
+ if(e.getValue() == o)
+ {
+ o.finished(new Ice.InvocationTimeoutException(), true);
+ _requests.remove(e.getKey());
+ return; // We're done.
+ }
+ }
+ }
+ }
+
+ public void
+ asyncRequestTimedOut(OutgoingAsyncMessageCallback outAsync)
+ {
+ OutgoingAsyncMessageCallback out = null;
+ boolean sent = false;
+ synchronized(this)
+ {
+ Integer requestId = _sendAsyncRequests.get(outAsync);
+ if(requestId != null)
+ {
+ if(requestId > 0)
+ {
+ _asyncRequests.remove(requestId);
+ }
+ out = outAsync;
+ sent = false;
+ _sendAsyncRequests.remove(outAsync);
+ }
+ else if(outAsync instanceof OutgoingAsync)
+ {
+ OutgoingAsync o = (OutgoingAsync)outAsync;
+ assert(o != null);
+ for(java.util.Map.Entry<Integer, OutgoingAsync> e : _asyncRequests.entrySet())
+ {
+ if(e.getValue() == o)
+ {
+ out = o;
+ sent = true;
+ _asyncRequests.remove(e.getKey());
+ break;
+ }
+ }
+ }
+ }
+
+ if(out != null)
+ {
+ out.__finished(new Ice.InvocationTimeoutException(), sent);
+ }
+ }
+
+ public void
+ invokeRequest(Outgoing out)
+ {
+ int requestId = 0;
+ if(_reference.getInvocationTimeout() > 0 || _response)
+ {
+ synchronized(this)
+ {
+ if(_response)
+ {
+ requestId = ++_requestId;
+ _requests.put(requestId, out);
+ }
+ if(_reference.getInvocationTimeout() > 0)
+ {
+ _sendRequests.put(out, requestId);
+ }
+ }
+ }
+
+ out.attachCollocatedObserver(requestId);
+
+ if(_reference.getInvocationTimeout() > 0)
+ {
+ _adapter.getThreadPool().execute(new InvokeAll(out, out.os(), requestId, 1, false));
+ }
+ else
+ {
+ out.sent();
+ invokeAll(out.os(), requestId, 1, false);
+ }
+ }
+
+ public int
+ invokeAsyncRequest(OutgoingAsync outAsync)
+ {
+ int requestId = 0;
+ if(_reference.getInvocationTimeout() > 0 || _response)
+ {
+ synchronized(this)
+ {
+ if(_response)
+ {
+ requestId = ++_requestId;
+ _asyncRequests.put(requestId, outAsync);
+ }
+ if(_reference.getInvocationTimeout() > 0)
+ {
+ _sendAsyncRequests.put(outAsync, requestId);
+ }
+ }
+ }
+
+ outAsync.__attachCollocatedObserver(requestId);
+
+ _adapter.getThreadPool().execute(new InvokeAllAsync(outAsync, outAsync.__getOs(), requestId, 1, false));
+
+ return AsyncStatus.Queued;
+ }
+
+ public void
+ invokeBatchRequests(BatchOutgoing out)
+ {
+ int invokeNum;
+ synchronized(this)
+ {
+ while(_batchStreamInUse)
+ {
+ try
+ {
+ wait();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ invokeNum = _batchRequestNum;
+
+ if(_batchRequestNum > 0)
+ {
+ if(_reference.getInvocationTimeout() > 0)
+ {
+ _sendRequests.put(out, 0);
+ }
+
+ assert(!_batchStream.isEmpty());
+ _batchStream.swap(out.os());
+
+ //
+ // Reset the batch stream.
+ //
+ BasicStream dummy = new BasicStream(_reference.getInstance(), Protocol.currentProtocolEncoding,
+ _batchAutoFlush);
+ _batchStream.swap(dummy);
+ _batchRequestNum = 0;
+ _batchMarker = 0;
+ }
+ }
+
+ out.attachCollocatedObserver(0);
+
+ if(invokeNum > 0)
+ {
+ if(_reference.getInvocationTimeout() > 0)
+ {
+ _adapter.getThreadPool().execute(new InvokeAll(out, out.os(), 0, invokeNum, true));
+ }
+ else
+ {
+ out.sent();
+ invokeAll(out.os(), 0, invokeNum, true);
+ }
+ }
+ else
+ {
+ out.sent();
+ }
+ }
+
+ public int
+ invokeAsyncBatchRequests(BatchOutgoingAsync outAsync)
+ {
+ int invokeNum;
+ synchronized(this)
+ {
+ while(_batchStreamInUse)
+ {
+ try
+ {
+ wait();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ invokeNum = _batchRequestNum;
+ if(_batchRequestNum > 0)
+ {
+ if(_reference.getInvocationTimeout() > 0)
+ {
+ _sendAsyncRequests.put(outAsync, 0);
+ }
+
+ assert(!_batchStream.isEmpty());
+ _batchStream.swap(outAsync.__getOs());
+
+ //
+ // Reset the batch stream.
+ //
+ BasicStream dummy = new BasicStream(_reference.getInstance(), Protocol.currentProtocolEncoding,
+ _batchAutoFlush);
+ _batchStream.swap(dummy);
+ _batchRequestNum = 0;
+ _batchMarker = 0;
+ }
+ }
+
+ outAsync.__attachCollocatedObserver(0);
+
+ if(invokeNum > 0)
+ {
+ _adapter.getThreadPool().execute(new InvokeAllAsync(outAsync, outAsync.__getOs(), 0, invokeNum, true));
+ return AsyncStatus.Queued;
+ }
+ else if(outAsync.__sent())
+ {
+ return AsyncStatus.Sent | AsyncStatus.InvokeSentCallback;
+ }
+ else
+ {
+ return AsyncStatus.Sent;
+ }
+ }
+
+ public void
+ sendResponse(int requestId, BasicStream os, byte status)
+ {
+ OutgoingAsync outAsync = null;
+ synchronized(this)
+ {
+ assert(_response);
+
+ os.pos(Protocol.replyHdr.length + 4);
+
+ if(_traceLevels.protocol >= 1)
+ {
+ fillInValue(os, 10, os.size());
+ TraceUtil.traceRecv(os, _logger, _traceLevels);
+ }
+
+ Outgoing out = _requests.get(requestId);
+ if(out != null)
+ {
+ out.finished(os);
+ _requests.remove(requestId);
+ }
+ else
+ {
+ outAsync = _asyncRequests.get(requestId);
+ if(outAsync != null)
+ {
+ _asyncRequests.remove(requestId);
+ }
+ }
+ }
+
+ if(outAsync != null)
+ {
+ outAsync.__finished(os);
+ }
+ _adapter.decDirectCount();
+ }
+
+ public void
+ sendNoResponse()
+ {
+ _adapter.decDirectCount();
+ }
+
+ public void
+ invokeException(int requestId, Ice.LocalException ex, int invokeNum)
+ {
+ if(requestId > 0)
+ {
+ OutgoingAsync outAsync = null;
+ synchronized(this)
+ {
+ Outgoing out = _requests.remove(requestId);
+ if(out != null)
+ {
+ out.finished(ex, true);
+ }
+ else
+ {
+ outAsync = _asyncRequests.remove(requestId);
+ }
+ }
+ if(outAsync != null)
+ {
+ outAsync.__finished(ex, true);
+ }
+ }
+ _adapter.decDirectCount();
+ }
+
+ public Reference
+ getReference()
+ {
+ return _reference;
+ }
+
+ public Ice.ConnectionI
+ getConnection(boolean wait)
+ {
+ return null;
+ }
+
+ boolean
+ sent(OutgoingMessageCallback out)
+ {
+ if(_reference.getInvocationTimeout() > 0)
+ {
+ synchronized(this)
+ {
+ if(_sendRequests.remove(out) == null)
+ {
+ return false; // The request timed-out.
+ }
+ out.sent();
+ }
+ }
+ else
+ {
+ out.sent();
+ }
+ return true;
+ }
+
+ boolean
+ sentAsync(OutgoingAsyncMessageCallback outAsync)
+ {
+ if(_reference.getInvocationTimeout() > 0)
+ {
+ synchronized(this)
+ {
+ if(_sendAsyncRequests.remove(outAsync) == null)
+ {
+ return false; // The request timed-out.
+ }
+ }
+ }
+ if(outAsync.__sent())
+ {
+ outAsync.__invokeSent();
+ }
+ return true;
+ }
+
+ void
+ invokeAll(BasicStream os, int requestId, int invokeNum, boolean batch)
+ {
+ if(batch)
+ {
+ os.pos(Protocol.requestBatchHdr.length);
+ }
+ else
+ {
+ os.pos(Protocol.requestHdr.length);
+ }
+
+ if(_traceLevels.protocol >= 1)
+ {
+ fillInValue(os, 10, os.size());
+ if(requestId > 0)
+ {
+ fillInValue(os, Protocol.headerSize, requestId);
+ }
+ else if(batch)
+ {
+ fillInValue(os, Protocol.headerSize, invokeNum);
+ }
+ TraceUtil.traceSend(os, _logger, _traceLevels);
+ }
+
+ ServantManager servantManager = _adapter.getServantManager();
+ try
+ {
+ while(invokeNum > 0)
+ {
+ try
+ {
+ _adapter.incDirectCount();
+ }
+ catch(Ice.ObjectAdapterDeactivatedException ex)
+ {
+ handleException(requestId, ex, false);
+ return;
+ }
+
+ Incoming in = new Incoming(_reference.getInstance(), this, null, _adapter, _response, (byte)0,
+ requestId);
+ try
+ {
+ in.invoke(servantManager, os);
+ }
+ catch(Ice.SystemException ex)
+ {
+ handleException(requestId, ex, true);
+ _adapter.decDirectCount();
+ }
+ --invokeNum;
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ invokeException(requestId, ex, invokeNum); // Fatal invocation exception
+ }
+ catch(java.lang.AssertionError ex) // Upon assertion, we print the stack trace.
+ {
+ Ice.UnknownException uex = new Ice.UnknownException(ex);
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ uex.unknown = sw.toString();
+ _logger.error(uex.unknown);
+ invokeException(requestId, uex, invokeNum);
+ }
+ catch(java.lang.OutOfMemoryError ex)
+ {
+ Ice.UnknownException uex = new Ice.UnknownException(ex);
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ uex.unknown = sw.toString();
+ _logger.error(uex.unknown);
+ invokeException(requestId, uex, invokeNum);
+ }
+ }
+
+ void
+ handleException(int requestId, Ice.Exception ex, boolean sent)
+ {
+ if(requestId == 0)
+ {
+ return; // Ignore exception for oneway messages.
+ }
+
+ OutgoingAsync outAsync = null;
+ synchronized(this)
+ {
+ Outgoing out = _requests.get(requestId);
+ if(out != null)
+ {
+ out.finished(ex, sent);
+ _requests.remove(requestId);
+ }
+ else
+ {
+ outAsync = _asyncRequests.get(requestId);
+ if(outAsync != null)
+ {
+ _asyncRequests.remove(requestId);
+ }
+ }
+ }
+
+ if(outAsync != null)
+ {
+ outAsync.__finished(ex, sent);
+ }
+ }
+
+ private final Reference _reference;
+ private final boolean _response;
+ private final Ice.ObjectAdapterI _adapter;
+ private final Ice.Logger _logger;
+ private final TraceLevels _traceLevels;
+ private boolean _batchAutoFlush;
+
+ private int _requestId;
+
+ private java.util.Map<OutgoingMessageCallback, Integer> _sendRequests =
+ new java.util.HashMap<OutgoingMessageCallback, Integer>();
+ private java.util.Map<OutgoingAsyncMessageCallback, Integer> _sendAsyncRequests =
+ new java.util.HashMap<OutgoingAsyncMessageCallback, Integer>();
+
+ private java.util.Map<Integer, Outgoing> _requests = new java.util.HashMap<Integer, Outgoing>();
+ private java.util.Map<Integer, OutgoingAsync> _asyncRequests = new java.util.HashMap<Integer, OutgoingAsync>();
+
+ private BasicStream _batchStream;
+ private boolean _batchStreamInUse;
+ private int _batchRequestNum;
+ private int _batchMarker;
+}
diff --git a/java/src/IceInternal/CommunicatorObserverI.java b/java/src/IceInternal/CommunicatorObserverI.java
index b63ba033633..bf23296294a 100644
--- a/java/src/IceInternal/CommunicatorObserverI.java
+++ b/java/src/IceInternal/CommunicatorObserverI.java
@@ -262,13 +262,21 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb
public Ice.ConnectionInfo
getConnectionInfo()
{
- return _current.con.getInfo();
+ if(_current.con != null)
+ {
+ return _current.con.getInfo();
+ }
+ return null;
}
public Ice.Endpoint
getEndpoint()
{
- return _current.con.getEndpoint();
+ if(_current.con != null)
+ {
+ return _current.con.getEndpoint();
+ }
+ return null;
}
public Ice.Connection
@@ -280,7 +288,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb
public Ice.EndpointInfo
getEndpointInfo()
{
- if(_endpointInfo == null)
+ if(_current.con != null && _endpointInfo == null)
{
_endpointInfo = _current.con.getEndpoint().getInfo();
}
diff --git a/java/src/IceInternal/ConnectRequestHandler.java b/java/src/IceInternal/ConnectRequestHandler.java
index 0cfe4e61aac..8b2f346a997 100644
--- a/java/src/IceInternal/ConnectRequestHandler.java
+++ b/java/src/IceInternal/ConnectRequestHandler.java
@@ -59,7 +59,7 @@ public class ConnectRequestHandler
public void
prepareBatchRequest(BasicStream os)
- throws LocalExceptionWrapper
+ throws RetryException
{
synchronized(this)
{
@@ -74,11 +74,18 @@ public class ConnectRequestHandler
}
}
- if(!initialized())
+ try
{
- _batchRequestInProgress = true;
- _batchStream.swap(os);
- return;
+ if(!initialized())
+ {
+ _batchRequestInProgress = true;
+ _batchStream.swap(os);
+ return;
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ throw new RetryException(ex);
}
}
@@ -90,7 +97,7 @@ public class ConnectRequestHandler
{
synchronized(this)
{
- if(!initialized())
+ if(!initialized()) // This can't throw until _batchRequestInProgress = false
{
assert(_batchRequestInProgress);
_batchRequestInProgress = false;
@@ -117,7 +124,7 @@ public class ConnectRequestHandler
{
synchronized(this)
{
- if(!initialized())
+ if(!initialized()) // This can't throw until _batchRequestInProgress = false
{
assert(_batchRequestInProgress);
_batchRequestInProgress = false;
@@ -136,14 +143,21 @@ public class ConnectRequestHandler
public boolean
sendRequest(OutgoingMessageCallback out)
- throws LocalExceptionWrapper
+ throws RetryException
{
synchronized(this)
{
- if(!initialized())
+ try
+ {
+ if(!initialized())
+ {
+ _requests.add(new Request(out));
+ return false; // Not sent
+ }
+ }
+ catch(Ice.LocalException ex)
{
- _requests.add(new Request(out));
- return false; // Not sent
+ throw new RetryException(ex);
}
}
return out.send(_connection, _compress, _response) && !_response; // Finished if sent and no response.
@@ -151,14 +165,21 @@ public class ConnectRequestHandler
public int
sendAsyncRequest(OutgoingAsyncMessageCallback out)
- throws LocalExceptionWrapper
+ throws RetryException
{
synchronized(this)
{
- if(!initialized())
+ try
{
- _requests.add(new Request(out));
- return AsyncStatus.Queued;
+ if(!initialized())
+ {
+ _requests.add(new Request(out));
+ return AsyncStatus.Queued;
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ throw new RetryException(ex);
}
}
return out.__send(_connection, _compress, _response);
@@ -169,6 +190,11 @@ public class ConnectRequestHandler
{
synchronized(this)
{
+ if(_exception != null)
+ {
+ return; // The request has been notified of a failure already.
+ }
+
if(!initialized())
{
java.util.Iterator<Request> it = _requests.iterator();
@@ -191,8 +217,14 @@ public class ConnectRequestHandler
public void
asyncRequestTimedOut(OutgoingAsyncMessageCallback outAsync)
{
+ boolean timedOut = false;
synchronized(this)
{
+ if(_exception != null)
+ {
+ return; // The request has been notified of a failure already.
+ }
+
if(!initialized())
{
java.util.Iterator<Request> it = _requests.iterator();
@@ -201,45 +233,19 @@ public class ConnectRequestHandler
Request request = it.next();
if(request.outAsync == outAsync)
{
- outAsync.__finished(new Ice.InvocationTimeoutException(), false);
it.remove();
- return;
+ timedOut = true;
+ break;
}
}
- assert(false); // The request has to be queued if it timed out and we're not initialized yet.
- }
- }
- _connection.asyncRequestTimedOut(outAsync);
- }
-
- public Outgoing
- getOutgoing(String operation, Ice.OperationMode mode, java.util.Map<String, String> context,
- InvocationObserver observer)
- throws LocalExceptionWrapper
- {
- synchronized(this)
- {
- if(!initialized())
- {
- return new IceInternal.Outgoing(this, operation, mode, context, observer);
}
}
-
- return _connection.getOutgoing(this, operation, mode, context, observer);
- }
-
- public void
- reclaimOutgoing(Outgoing out)
- {
- synchronized(this)
+ if(timedOut)
{
- if(_connection == null)
- {
- return;
- }
+ outAsync.__finished(new Ice.InvocationTimeoutException(), false);
+ return;
}
-
- _connection.reclaimOutgoing(out);
+ _connection.asyncRequestTimedOut(outAsync);
}
public Reference
@@ -319,7 +325,6 @@ public class ConnectRequestHandler
_exception = ex;
_proxy = null; // Break cyclic reference count.
- _delegate = null; // Break cyclic reference count.
//
// If some requests were queued, we notify them of the failure. This is done from a thread
@@ -328,14 +333,14 @@ public class ConnectRequestHandler
//
if(!_requests.isEmpty())
{
- _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem(_reference.getInstance())
- {
- public void
- run()
- {
- flushRequestsWithException(ex);
- };
- });
+ _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem()
+ {
+ public void
+ run()
+ {
+ flushRequestsWithException();
+ };
+ });
}
notifyAll();
@@ -355,12 +360,11 @@ public class ConnectRequestHandler
}
public
- ConnectRequestHandler(Reference ref, Ice.ObjectPrx proxy, Ice._ObjectDelM delegate)
+ ConnectRequestHandler(Reference ref, Ice.ObjectPrx proxy)
{
_reference = ref;
_response = _reference.getMode() == Reference.ModeTwoway;
_proxy = (Ice.ObjectPrxHelperBase)proxy;
- _delegate = delegate;
_batchAutoFlush = ref.getInstance().initializationData().properties.getPropertyAsIntWithDefault(
"Ice.BatchAutoFlush", 1) > 0 ? true : false;
_initialized = false;
@@ -470,18 +474,25 @@ public class ConnectRequestHandler
p.remove();
}
}
- catch(final LocalExceptionWrapper ex)
+ catch(final RetryException ex)
{
+ //
+ // If the connection dies shortly after connection
+ // establishment, we don't systematically retry on
+ // RetryException. We handle the exception like it
+ // was an exception that occured while sending the
+ // request.
+ //
synchronized(this)
{
assert(_exception == null && !_requests.isEmpty());
_exception = ex.get();
- _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem(_reference.getInstance())
+ _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem()
{
public void
run()
{
- flushRequestsWithException(ex);
+ flushRequestsWithException();
};
});
}
@@ -492,12 +503,12 @@ public class ConnectRequestHandler
{
assert(_exception == null && !_requests.isEmpty());
_exception = ex;
- _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem(_reference.getInstance())
+ _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem()
{
public void
run()
{
- flushRequestsWithException(ex);
+ flushRequestsWithException();
};
});
}
@@ -505,20 +516,20 @@ public class ConnectRequestHandler
if(!sentCallbacks.isEmpty())
{
- final Instance instance = _reference.getInstance();
- instance.clientThreadPool().execute(new DispatchWorkItem(instance)
- {
- public void
- run()
- {
- for(OutgoingAsyncMessageCallback callback : sentCallbacks)
- {
- callback.__invokeSent();
- }
- };
- });
+ _reference.getInstance().clientThreadPool().execute(
+ new DispatchWorkItem()
+ {
+ public void
+ run()
+ {
+ for(OutgoingAsyncMessageCallback callback : sentCallbacks)
+ {
+ callback.__invokeSent();
+ }
+ };
+ });
}
-
+
//
// We've finished sending the queued requests and the request handler now send
// the requests over the connection directly. It's time to substitute the
@@ -530,7 +541,7 @@ public class ConnectRequestHandler
//
if(_updateRequestHandler && _exception == null)
{
- _proxy.__setRequestHandler(_delegate, new ConnectionRequestHandler(_reference, _connection, _compress));
+ _proxy.__setRequestHandler(this, new ConnectionRequestHandler(_reference, _connection, _compress));
}
synchronized(this)
@@ -542,54 +553,22 @@ public class ConnectRequestHandler
_flushing = false;
}
_proxy = null; // Break cyclic reference count.
- _delegate = null; // Break cyclic reference count.
notifyAll();
}
}
void
- flushRequestsWithException(Ice.LocalException ex)
- {
- for(Request request : _requests)
- {
- if(request.out != null)
- {
- request.out.finished(ex, false);
- }
- else if(request.outAsync != null)
- {
- request.outAsync.__finished(ex, false);
- }
- }
- _requests.clear();
- }
-
- void
- flushRequestsWithException(LocalExceptionWrapper ex)
+ flushRequestsWithException()
{
for(Request request : _requests)
{
if(request.out != null)
{
- if(request.out instanceof Outgoing)
- {
- ((Outgoing)request.out).finished(ex);
- }
- else
- {
- request.out.finished(ex.get(), false);
- }
+ request.out.finished(_exception, false);
}
else if(request.outAsync != null)
{
- if(request.outAsync instanceof OutgoingAsync)
- {
- ((OutgoingAsync)request.outAsync).__finished(ex);
- }
- else
- {
- request.outAsync.__finished(ex.get(), false);
- }
+ request.outAsync.__finished(_exception, false);
}
}
_requests.clear();
@@ -599,7 +578,6 @@ public class ConnectRequestHandler
private boolean _response;
private Ice.ObjectPrxHelperBase _proxy;
- private Ice._ObjectDelM _delegate;
private final boolean _batchAutoFlush;
diff --git a/java/src/IceInternal/ConnectionRequestHandler.java b/java/src/IceInternal/ConnectionRequestHandler.java
index 07a8d9c43e0..7820790e794 100644
--- a/java/src/IceInternal/ConnectionRequestHandler.java
+++ b/java/src/IceInternal/ConnectionRequestHandler.java
@@ -15,7 +15,7 @@ public class ConnectionRequestHandler implements RequestHandler
{
public void
prepareBatchRequest(BasicStream out)
- throws LocalExceptionWrapper
+ throws RetryException
{
_connection.prepareBatchRequest(out);
}
@@ -34,14 +34,14 @@ public class ConnectionRequestHandler implements RequestHandler
public boolean
sendRequest(OutgoingMessageCallback out)
- throws LocalExceptionWrapper
+ throws RetryException
{
return out.send(_connection, _compress, _response) && !_response; // Finished if sent and no response
}
public int
sendAsyncRequest(OutgoingAsyncMessageCallback out)
- throws LocalExceptionWrapper
+ throws RetryException
{
return out.__send(_connection, _compress, _response);
}
@@ -58,20 +58,6 @@ public class ConnectionRequestHandler implements RequestHandler
_connection.asyncRequestTimedOut(outAsync);
}
- public Outgoing
- getOutgoing(String operation, Ice.OperationMode mode, java.util.Map<String, String> context,
- InvocationObserver observer)
- throws LocalExceptionWrapper
- {
- return _connection.getOutgoing(this, operation, mode, context, observer);
- }
-
- public void
- reclaimOutgoing(Outgoing out)
- {
- _connection.reclaimOutgoing(out);
- }
-
public Reference
getReference()
{
diff --git a/java/src/IceInternal/Direct.java b/java/src/IceInternal/Direct.java
deleted file mode 100644
index 8456939a295..00000000000
--- a/java/src/IceInternal/Direct.java
+++ /dev/null
@@ -1,140 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package IceInternal;
-
-public abstract class Direct implements Ice.Request
-{
- public abstract Ice.DispatchStatus run(Ice.Object target);
-
- public final boolean isCollocated()
- {
- return true;
- }
-
- public final Ice.Current getCurrent()
- {
- return _current;
- }
-
-
- public
- Direct(Ice.Current current) throws Ice.UserException
- {
- _current = current;
-
- Ice.ObjectAdapterI adapter = (Ice.ObjectAdapterI)_current.adapter;
- assert(adapter != null);
-
- //
- // Must call incDirectCount() first, because it checks for
- // adapter deactivation, and prevents deactivation completion
- // until decDirectCount() is called. This is important,
- // because getServantManager() may not be called afer
- // deactivation completion.
- //
- adapter.incDirectCount();
-
- ServantManager servantManager = adapter.getServantManager();
- assert(servantManager != null);
-
- _servant = servantManager.findServant(_current.id, _current.facet);
- if(_servant == null)
- {
- _locator = servantManager.findServantLocator(_current.id.category);
- if(_locator == null && _current.id.category.length() > 0)
- {
- _locator = servantManager.findServantLocator("");
- }
- if(_locator != null)
- {
- _cookie = new Ice.LocalObjectHolder(); // Lazy creation.
- try
- {
- _servant = _locator.locate(_current, _cookie);
- }
- catch(Ice.UserException ex)
- {
- adapter.decDirectCount();
- throw ex;
- }
- catch(java.lang.RuntimeException ex)
- {
- adapter.decDirectCount();
- throw ex;
- }
- }
- }
-
- if(_servant == null)
- {
- adapter.decDirectCount();
- if(servantManager != null && servantManager.hasServant(_current.id))
- {
- Ice.FacetNotExistException ex = new Ice.FacetNotExistException();
- ex.id = _current.id;
- ex.facet = _current.facet;
- ex.operation = _current.operation;
- throw ex;
- }
- else
- {
- Ice.ObjectNotExistException ex = new Ice.ObjectNotExistException();
- ex.id = _current.id;
- ex.facet = _current.facet;
- ex.operation = _current.operation;
- throw ex;
- }
- }
- }
-
- public void
- destroy() throws Ice.UserException
- {
- Ice.ObjectAdapterI adapter = (Ice.ObjectAdapterI)_current.adapter;
- assert(adapter != null);
-
- try
- {
- if(_locator != null && _servant != null)
- {
- _locator.finished(_current, _servant, _cookie.value);
- }
- }
- finally
- {
- adapter.decDirectCount();
- }
- }
-
- public Ice.Object
- getServant()
- {
- return _servant;
- }
-
- public void
- throwUserException() throws Ice.UserException
- {
- assert _userException != null;
- throw _userException;
- }
-
- public void
- setUserException(Ice.UserException ex)
- {
- _userException = ex;
- }
-
- private final Ice.Current _current;
- private Ice.Object _servant;
- private Ice.UserException _userException;
- private Ice.ServantLocator _locator;
- private Ice.LocalObjectHolder _cookie;
-}
diff --git a/java/src/IceInternal/DispatchObserverI.java b/java/src/IceInternal/DispatchObserverI.java
index 21442a85414..97b739cb5f2 100644
--- a/java/src/IceInternal/DispatchObserverI.java
+++ b/java/src/IceInternal/DispatchObserverI.java
@@ -41,11 +41,11 @@ public class DispatchObserverI
}
final MetricsUpdate<IceMX.DispatchMetrics> _userException = new MetricsUpdate<IceMX.DispatchMetrics>()
+ {
+ public void
+ update(IceMX.DispatchMetrics v)
{
- public void
- update(IceMX.DispatchMetrics v)
- {
- ++v.userException;
- }
- };
-} \ No newline at end of file
+ ++v.userException;
+ }
+ };
+}
diff --git a/java/src/IceInternal/DispatchWorkItem.java b/java/src/IceInternal/DispatchWorkItem.java
index dd770c720a8..84a9c438453 100644
--- a/java/src/IceInternal/DispatchWorkItem.java
+++ b/java/src/IceInternal/DispatchWorkItem.java
@@ -17,14 +17,10 @@ package IceInternal;
//
abstract public class DispatchWorkItem implements ThreadPoolWorkItem, Runnable
{
- public DispatchWorkItem(Instance instance)
- {
- _instance = instance;
- }
-
final public void execute(ThreadPoolCurrent current)
{
- Ice.Dispatcher dispatcher = _instance.initializationData().dispatcher;
+ Instance instance = current.stream.instance();
+ Ice.Dispatcher dispatcher = instance.initializationData().dispatcher;
if(dispatcher != null)
{
try
@@ -33,13 +29,13 @@ abstract public class DispatchWorkItem implements ThreadPoolWorkItem, Runnable
}
catch(java.lang.Exception ex)
{
- if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
+ if(instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
{
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
ex.printStackTrace(pw);
pw.flush();
- _instance.initializationData().logger.warning("dispatch exception:\n" + sw.toString());
+ instance.initializationData().logger.warning("dispatch exception:\n" + sw.toString());
}
}
}
@@ -49,6 +45,4 @@ abstract public class DispatchWorkItem implements ThreadPoolWorkItem, Runnable
this.run();
}
}
-
- private Instance _instance;
}
diff --git a/java/src/IceInternal/Functional_CallbackBase.java b/java/src/IceInternal/Functional_CallbackBase.java
index e66a5938bb0..1e61ca2e506 100644
--- a/java/src/IceInternal/Functional_CallbackBase.java
+++ b/java/src/IceInternal/Functional_CallbackBase.java
@@ -12,18 +12,18 @@ package IceInternal;
public abstract class Functional_CallbackBase extends IceInternal.CallbackBase
{
public Functional_CallbackBase(boolean responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- CallbackBase.check(responseCb || localExceptionCb != null);
- __localExceptionCb = localExceptionCb;
+ CallbackBase.check(responseCb || exceptionCb != null);
+ __exceptionCb = exceptionCb;
__sentCb = sentCb;
}
- protected Functional_CallbackBase(Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ protected Functional_CallbackBase(Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- __localExceptionCb = localExceptionCb;
+ __exceptionCb = exceptionCb;
__sentCb = sentCb;
}
@@ -37,6 +37,6 @@ public abstract class Functional_CallbackBase extends IceInternal.CallbackBase
public abstract void __completed(Ice.AsyncResult __result);
- protected final Functional_GenericCallback1<Ice.LocalException> __localExceptionCb;
+ protected final Functional_GenericCallback1<Ice.Exception> __exceptionCb;
protected final Functional_BoolCallback __sentCb;
}
diff --git a/java/src/IceInternal/Functional_OnewayCallback.java b/java/src/IceInternal/Functional_OnewayCallback.java
index a9d7aa842f7..4b7da7baa07 100644
--- a/java/src/IceInternal/Functional_OnewayCallback.java
+++ b/java/src/IceInternal/Functional_OnewayCallback.java
@@ -12,11 +12,11 @@ package IceInternal;
public class Functional_OnewayCallback extends IceInternal.Functional_CallbackBase
{
public Functional_OnewayCallback(Functional_VoidCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
- CallbackBase.check(responseCb != null || localExceptionCb != null);
+ super(exceptionCb, sentCb);
+ CallbackBase.check(responseCb != null || exceptionCb != null);
__responseCb = responseCb;
}
@@ -30,11 +30,11 @@ public class Functional_OnewayCallback extends IceInternal.Functional_CallbackBa
__responseCb.apply();
}
}
- catch(Ice.LocalException __ex)
+ catch(Ice.Exception __ex)
{
- if(__localExceptionCb != null)
+ if(__exceptionCb != null)
{
- __localExceptionCb.apply(__ex);
+ __exceptionCb.apply(__ex);
}
}
}
diff --git a/java/src/IceInternal/Functional_TwowayCallback.java b/java/src/IceInternal/Functional_TwowayCallback.java
index a03f73378c2..91d02d81a37 100644
--- a/java/src/IceInternal/Functional_TwowayCallback.java
+++ b/java/src/IceInternal/Functional_TwowayCallback.java
@@ -12,23 +12,31 @@ package IceInternal;
public abstract class Functional_TwowayCallback extends IceInternal.Functional_CallbackBase implements Ice.TwowayCallback
{
public Functional_TwowayCallback(boolean responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb, localExceptionCb, sentCb);
+ super(responseCb, exceptionCb, sentCb);
}
- protected Functional_TwowayCallback(Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ protected Functional_TwowayCallback(Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
+ super(exceptionCb, sentCb);
}
+ public void exception(Ice.SystemException ex)
+ {
+ if(__exceptionCb != null)
+ {
+ __exceptionCb.apply(ex);
+ }
+ }
+
public final void exception(Ice.LocalException ex)
{
- if(__localExceptionCb != null)
+ if(__exceptionCb != null)
{
- __localExceptionCb.apply(ex);
+ __exceptionCb.apply(ex);
}
}
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackArg1.java b/java/src/IceInternal/Functional_TwowayCallbackArg1.java
index e944e138fb2..5afa99612c4 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackArg1.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackArg1.java
@@ -13,20 +13,20 @@ public abstract class Functional_TwowayCallbackArg1<T> extends Functional_Twoway
implements Ice.TwowayCallbackArg1<T>
{
public Functional_TwowayCallbackArg1(Functional_GenericCallback1<T> responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb != null, localExceptionCb, sentCb);
+ super(responseCb != null, exceptionCb, sentCb);
__responseCb = responseCb;
}
protected Functional_TwowayCallbackArg1(boolean userExceptionCb,
Functional_GenericCallback1<T> responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
- CallbackBase.check(responseCb != null || (userExceptionCb && localExceptionCb != null));
+ super(exceptionCb, sentCb);
+ CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null));
__responseCb = responseCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackArg1UE.java b/java/src/IceInternal/Functional_TwowayCallbackArg1UE.java
index f217661ee58..93e81bdf82f 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackArg1UE.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackArg1UE.java
@@ -15,10 +15,10 @@ public abstract class Functional_TwowayCallbackArg1UE<T>
public Functional_TwowayCallbackArg1UE(
Functional_GenericCallback1<T> responseCb,
Functional_GenericCallback1<Ice.UserException> userExceptionCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(userExceptionCb != null, responseCb, localExceptionCb, sentCb);
+ super(userExceptionCb != null, responseCb, exceptionCb, sentCb);
__userExceptionCb = userExceptionCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackBool.java b/java/src/IceInternal/Functional_TwowayCallbackBool.java
index 6014deb7132..b755ee062ce 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackBool.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackBool.java
@@ -12,20 +12,20 @@ package IceInternal;
public abstract class Functional_TwowayCallbackBool extends Functional_TwowayCallback implements Ice.TwowayCallbackBool
{
public Functional_TwowayCallbackBool(Functional_BoolCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb != null, localExceptionCb, sentCb);
+ super(responseCb != null, exceptionCb, sentCb);
this.__responseCb = responseCb;
}
protected Functional_TwowayCallbackBool(boolean userExceptionCb,
Functional_BoolCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
- CallbackBase.check(responseCb != null || (userExceptionCb && localExceptionCb != null));
+ super(exceptionCb, sentCb);
+ CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null));
this.__responseCb = responseCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackBoolUE.java b/java/src/IceInternal/Functional_TwowayCallbackBoolUE.java
index 7644dceb259..513b6f211f8 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackBoolUE.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackBoolUE.java
@@ -15,10 +15,10 @@ public abstract class Functional_TwowayCallbackBoolUE
public Functional_TwowayCallbackBoolUE(
Functional_BoolCallback responseCb,
Functional_GenericCallback1<Ice.UserException> userExceptionCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(userExceptionCb != null, responseCb, localExceptionCb, sentCb);
+ super(userExceptionCb != null, responseCb, exceptionCb, sentCb);
__userExceptionCb = userExceptionCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackByte.java b/java/src/IceInternal/Functional_TwowayCallbackByte.java
index bbbda5685bd..cd7e9b0d3d1 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackByte.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackByte.java
@@ -12,20 +12,20 @@ package IceInternal;
public abstract class Functional_TwowayCallbackByte extends Functional_TwowayCallback implements Ice.TwowayCallbackByte
{
public Functional_TwowayCallbackByte(Functional_ByteCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb != null, localExceptionCb, sentCb);
+ super(responseCb != null, exceptionCb, sentCb);
__responseCb = responseCb;
}
protected Functional_TwowayCallbackByte(boolean userExceptionCb,
Functional_ByteCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
- CallbackBase.check(responseCb != null || (userExceptionCb && localExceptionCb != null));
+ super(exceptionCb, sentCb);
+ CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null));
__responseCb = responseCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackByteUE.java b/java/src/IceInternal/Functional_TwowayCallbackByteUE.java
index 7f91af08792..18004621033 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackByteUE.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackByteUE.java
@@ -15,10 +15,10 @@ public abstract class Functional_TwowayCallbackByteUE
public Functional_TwowayCallbackByteUE(
Functional_ByteCallback responseCb,
Functional_GenericCallback1<Ice.UserException> userExceptionCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(userExceptionCb != null, responseCb, localExceptionCb, sentCb);
+ super(userExceptionCb != null, responseCb, exceptionCb, sentCb);
__userExceptionCb = userExceptionCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackDouble.java b/java/src/IceInternal/Functional_TwowayCallbackDouble.java
index 3e48dd6c9f3..e580abb91aa 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackDouble.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackDouble.java
@@ -13,20 +13,20 @@ public abstract class Functional_TwowayCallbackDouble
extends Functional_TwowayCallback implements Ice.TwowayCallbackDouble
{
public Functional_TwowayCallbackDouble(Functional_DoubleCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb != null, localExceptionCb, sentCb);
+ super(responseCb != null, exceptionCb, sentCb);
__responseCb = responseCb;
}
protected Functional_TwowayCallbackDouble(boolean userExceptionCb,
Functional_DoubleCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
- CallbackBase.check(responseCb != null || (userExceptionCb && localExceptionCb != null));
+ super(exceptionCb, sentCb);
+ CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null));
__responseCb = responseCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackDoubleUE.java b/java/src/IceInternal/Functional_TwowayCallbackDoubleUE.java
index 0a7b4959d29..c7643b0960d 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackDoubleUE.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackDoubleUE.java
@@ -15,10 +15,10 @@ public abstract class Functional_TwowayCallbackDoubleUE
public Functional_TwowayCallbackDoubleUE(
Functional_DoubleCallback responseCb,
Functional_GenericCallback1<Ice.UserException> userExceptionCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(userExceptionCb != null, responseCb, localExceptionCb, sentCb);
+ super(userExceptionCb != null, responseCb, exceptionCb, sentCb);
__userExceptionCb = userExceptionCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackFloat.java b/java/src/IceInternal/Functional_TwowayCallbackFloat.java
index cd9ba700acb..a5cc8018e23 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackFloat.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackFloat.java
@@ -13,20 +13,20 @@ public abstract class Functional_TwowayCallbackFloat
extends Functional_TwowayCallback implements Ice.TwowayCallbackFloat
{
public Functional_TwowayCallbackFloat(Functional_FloatCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb != null, localExceptionCb, sentCb);
+ super(responseCb != null, exceptionCb, sentCb);
__responseCb = responseCb;
}
protected Functional_TwowayCallbackFloat(boolean userExceptionCb,
Functional_FloatCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
- CallbackBase.check(responseCb != null || (userExceptionCb && localExceptionCb != null));
+ super(exceptionCb, sentCb);
+ CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null));
__responseCb = responseCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackFloatUE.java b/java/src/IceInternal/Functional_TwowayCallbackFloatUE.java
index 1bc9213a1e0..4df55515af8 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackFloatUE.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackFloatUE.java
@@ -14,10 +14,10 @@ public abstract class Functional_TwowayCallbackFloatUE
{
public Functional_TwowayCallbackFloatUE(Functional_FloatCallback responseCb,
Functional_GenericCallback1<Ice.UserException> userExceptionCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(userExceptionCb != null, responseCb, localExceptionCb, sentCb);
+ super(userExceptionCb != null, responseCb, exceptionCb, sentCb);
__userExceptionCb = userExceptionCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackInt.java b/java/src/IceInternal/Functional_TwowayCallbackInt.java
index a37c4b0d167..6724c7fc7c1 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackInt.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackInt.java
@@ -13,20 +13,20 @@ public abstract class Functional_TwowayCallbackInt
extends Functional_TwowayCallback implements Ice.TwowayCallbackInt
{
public Functional_TwowayCallbackInt(Functional_IntCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb != null, localExceptionCb, sentCb);
+ super(responseCb != null, exceptionCb, sentCb);
__responseCb = responseCb;
}
protected Functional_TwowayCallbackInt(boolean userExceptionCb,
Functional_IntCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
- CallbackBase.check(responseCb != null || (userExceptionCb && localExceptionCb != null));
+ super(exceptionCb, sentCb);
+ CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null));
__responseCb = responseCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackIntUE.java b/java/src/IceInternal/Functional_TwowayCallbackIntUE.java
index 65f111e49bd..30693f7361d 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackIntUE.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackIntUE.java
@@ -15,10 +15,10 @@ public abstract class Functional_TwowayCallbackIntUE
public Functional_TwowayCallbackIntUE(
Functional_IntCallback responseCb,
Functional_GenericCallback1<Ice.UserException> userExceptionCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(userExceptionCb != null, responseCb, localExceptionCb, sentCb);
+ super(userExceptionCb != null, responseCb, exceptionCb, sentCb);
__userExceptionCb = userExceptionCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackLong.java b/java/src/IceInternal/Functional_TwowayCallbackLong.java
index 2a0233ed32d..c82268691a4 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackLong.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackLong.java
@@ -13,20 +13,20 @@ public abstract class Functional_TwowayCallbackLong
extends Functional_TwowayCallback implements Ice.TwowayCallbackLong
{
public Functional_TwowayCallbackLong(Functional_LongCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb != null, localExceptionCb, sentCb);
+ super(responseCb != null, exceptionCb, sentCb);
__responseCb = responseCb;
}
protected Functional_TwowayCallbackLong(boolean userExceptionCb,
Functional_LongCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
- CallbackBase.check(responseCb != null || (userExceptionCb && localExceptionCb != null));
+ super(exceptionCb, sentCb);
+ CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null));
__responseCb = responseCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackLongUE.java b/java/src/IceInternal/Functional_TwowayCallbackLongUE.java
index 63417055f41..d8d7cd09933 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackLongUE.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackLongUE.java
@@ -15,10 +15,10 @@ public abstract class Functional_TwowayCallbackLongUE
public Functional_TwowayCallbackLongUE(
Functional_LongCallback responseCb,
Functional_GenericCallback1<Ice.UserException> userExceptionCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb, localExceptionCb, sentCb);
+ super(responseCb, exceptionCb, sentCb);
__userExceptionCb = userExceptionCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackShort.java b/java/src/IceInternal/Functional_TwowayCallbackShort.java
index c73f4c78593..7a72c8a1470 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackShort.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackShort.java
@@ -13,20 +13,20 @@ public abstract class Functional_TwowayCallbackShort
extends Functional_TwowayCallback implements Ice.TwowayCallbackShort
{
public Functional_TwowayCallbackShort(Functional_ShortCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb != null, localExceptionCb, sentCb);
+ super(responseCb != null, exceptionCb, sentCb);
__responseCb = responseCb;
}
protected Functional_TwowayCallbackShort(boolean userExceptionCb,
Functional_ShortCallback responseCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
- CallbackBase.check(responseCb != null || (userExceptionCb && localExceptionCb != null));
+ super(exceptionCb, sentCb);
+ CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null));
__responseCb = responseCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackShortUE.java b/java/src/IceInternal/Functional_TwowayCallbackShortUE.java
index 8943a0a5803..f8bda4114c7 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackShortUE.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackShortUE.java
@@ -15,10 +15,10 @@ public abstract class Functional_TwowayCallbackShortUE
public Functional_TwowayCallbackShortUE(
Functional_ShortCallback responseCb,
Functional_GenericCallback1<Ice.UserException> userExceptionCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb, localExceptionCb, sentCb);
+ super(responseCb, exceptionCb, sentCb);
__userExceptionCb = userExceptionCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackUE.java b/java/src/IceInternal/Functional_TwowayCallbackUE.java
index e3271ed8f2c..e0469547199 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackUE.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackUE.java
@@ -13,11 +13,11 @@ public abstract class Functional_TwowayCallbackUE extends Functional_TwowayCallb
{
public Functional_TwowayCallbackUE(boolean responseCb,
Functional_GenericCallback1<Ice.UserException> userExceptionCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(localExceptionCb, sentCb);
- CallbackBase.check(responseCb || (userExceptionCb != null && localExceptionCb != null));
+ super(exceptionCb, sentCb);
+ CallbackBase.check(responseCb || (userExceptionCb != null && exceptionCb != null));
__userExceptionCb = userExceptionCb;
}
diff --git a/java/src/IceInternal/Functional_TwowayCallbackVoidUE.java b/java/src/IceInternal/Functional_TwowayCallbackVoidUE.java
index 3591d694ccd..53854b6eadf 100644
--- a/java/src/IceInternal/Functional_TwowayCallbackVoidUE.java
+++ b/java/src/IceInternal/Functional_TwowayCallbackVoidUE.java
@@ -15,10 +15,10 @@ public abstract class Functional_TwowayCallbackVoidUE
public Functional_TwowayCallbackVoidUE(
Functional_VoidCallback responseCb,
Functional_GenericCallback1<Ice.UserException> userExceptionCb,
- Functional_GenericCallback1<Ice.LocalException> localExceptionCb,
+ Functional_GenericCallback1<Ice.Exception> exceptionCb,
Functional_BoolCallback sentCb)
{
- super(responseCb != null, userExceptionCb, localExceptionCb, sentCb);
+ super(responseCb != null, userExceptionCb, exceptionCb, sentCb);
__responseCb = responseCb;
}
diff --git a/java/src/IceInternal/IPEndpointI.java b/java/src/IceInternal/IPEndpointI.java
index e887fb95770..3375b51d36c 100644
--- a/java/src/IceInternal/IPEndpointI.java
+++ b/java/src/IceInternal/IPEndpointI.java
@@ -267,6 +267,11 @@ public abstract class IPEndpointI extends EndpointI
throw new Ice.EndpointParseException("`-h *' not valid for proxy endpoint `" + toString() + "'");
}
}
+
+ if(_host == null)
+ {
+ _host = "";
+ }
}
protected boolean checkOption(String option, String argument, String endpoint)
diff --git a/java/src/IceInternal/Incoming.java b/java/src/IceInternal/Incoming.java
index 88a12ddf906..f8c3e0e9d64 100644
--- a/java/src/IceInternal/Incoming.java
+++ b/java/src/IceInternal/Incoming.java
@@ -14,10 +14,10 @@ import Ice.Instrumentation.CommunicatorObserver;
final public class Incoming extends IncomingBase implements Ice.Request
{
public
- Incoming(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, boolean response, byte compress,
- int requestId)
+ Incoming(Instance instance, ResponseHandler responseHandler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter,
+ boolean response, byte compress, int requestId)
{
- super(instance, connection, adapter, response, compress, requestId);
+ super(instance, responseHandler, connection, adapter, response, compress, requestId);
//
// Prepare the response if necessary.
@@ -33,15 +33,6 @@ final public class Incoming extends IncomingBase implements Ice.Request
}
}
- //
- // Request implementation
- //
- public boolean
- isCollocated()
- {
- return false;
- }
-
public Ice.Current
getCurrent()
{
@@ -52,13 +43,13 @@ final public class Incoming extends IncomingBase implements Ice.Request
// These functions allow this object to be reused, rather than reallocated.
//
public void
- reset(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, boolean response, byte compress,
- int requestId)
+ reset(Instance instance, ResponseHandler handler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter,
+ boolean response, byte compress, int requestId)
{
_cb = null;
_inParamPos = -1;
- super.reset(instance, connection, adapter, response, compress, requestId);
+ super.reset(instance, handler, connection, adapter, response, compress, requestId);
//
// Prepare the response if necessary.
@@ -179,11 +170,11 @@ final public class Incoming extends IncomingBase implements Ice.Request
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
if(_observer != null)
@@ -191,7 +182,7 @@ final public class Incoming extends IncomingBase implements Ice.Request
_observer.detach();
_observer = null;
}
- _connection = null;
+ _responseHandler = null;
return;
}
catch(java.lang.Exception ex)
@@ -274,7 +265,7 @@ final public class Incoming extends IncomingBase implements Ice.Request
// the caller of this operation.
//
- assert(_connection != null);
+ assert(_responseHandler != null);
if(_response)
{
@@ -282,11 +273,11 @@ final public class Incoming extends IncomingBase implements Ice.Request
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
if(_observer != null)
@@ -294,7 +285,7 @@ final public class Incoming extends IncomingBase implements Ice.Request
_observer.detach();
_observer = null;
}
- _connection = null;
+ _responseHandler = null;
}
public final void
diff --git a/java/src/IceInternal/IncomingAsync.java b/java/src/IceInternal/IncomingAsync.java
index cbcc6693e22..2ab2d0fc335 100644
--- a/java/src/IceInternal/IncomingAsync.java
+++ b/java/src/IceInternal/IncomingAsync.java
@@ -63,7 +63,7 @@ public class IncomingAsync extends IncomingBase implements Ice.AMDCallback
}
}
- if(_connection != null)
+ if(_responseHandler != null)
{
__exception(ex);
}
@@ -110,7 +110,7 @@ public class IncomingAsync extends IncomingBase implements Ice.AMDCallback
return;
}
- assert(_connection != null);
+ assert(_responseHandler != null);
if(_response)
{
@@ -118,11 +118,11 @@ public class IncomingAsync extends IncomingBase implements Ice.AMDCallback
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
if(_observer != null)
@@ -130,11 +130,11 @@ public class IncomingAsync extends IncomingBase implements Ice.AMDCallback
_observer.detach();
_observer = null;
}
- _connection = null;
+ _responseHandler = null;
}
catch(Ice.LocalException ex)
{
- _connection.invokeException(ex, 1);
+ _responseHandler.invokeException(_current.requestId, ex, 1);
}
}
@@ -152,7 +152,7 @@ public class IncomingAsync extends IncomingBase implements Ice.AMDCallback
}
catch(Ice.LocalException ex)
{
- _connection.invokeException(ex, 1);
+ _responseHandler.invokeException(_current.requestId, ex, 1);
}
}
diff --git a/java/src/IceInternal/IncomingBase.java b/java/src/IceInternal/IncomingBase.java
index 79cff091a58..5190769b6ae 100644
--- a/java/src/IceInternal/IncomingBase.java
+++ b/java/src/IceInternal/IncomingBase.java
@@ -12,22 +12,22 @@ package IceInternal;
public class IncomingBase
{
protected
- IncomingBase(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, boolean response,
- byte compress, int requestId)
+ IncomingBase(Instance instance, ResponseHandler handler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter,
+ boolean response, byte compress, int requestId)
{
_instance = instance;
+ _responseHandler = handler;
_response = response;
_compress = compress;
if(_response)
{
_os = new BasicStream(instance, Protocol.currentProtocolEncoding);
}
- _connection = connection;
_current = new Ice.Current();
_current.id = new Ice.Identity();
_current.adapter = adapter;
- _current.con = _connection;
+ _current.con = connection;
_current.requestId = requestId;
_cookie = new Ice.LocalObjectHolder();
@@ -86,8 +86,8 @@ public class IncomingBase
_os = other._os;
other._os = null;
- _connection = other._connection;
- other._connection = null;
+ _responseHandler = other._responseHandler;
+ other._responseHandler = null;
}
public BasicStream
@@ -177,8 +177,8 @@ public class IncomingBase
// These functions allow this object to be reused, rather than reallocated.
//
public void
- reset(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, boolean response, byte compress,
- int requestId)
+ reset(Instance instance, ResponseHandler handler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter,
+ boolean response, byte compress, int requestId)
{
_instance = instance;
@@ -205,7 +205,7 @@ public class IncomingBase
_os = new BasicStream(instance, Protocol.currentProtocolEncoding);
}
- _connection = connection;
+ _responseHandler = handler;
_interceptorAsyncCallbackList = null;
}
@@ -245,9 +245,9 @@ public class IncomingBase
out.print("\nidentity: " + _instance.identityToString(_current.id));
out.print("\nfacet: " + IceUtilInternal.StringUtil.escapeString(_current.facet, ""));
out.print("\noperation: " + _current.operation);
- if(_connection != null)
+ if(_current.con != null)
{
- Ice.ConnectionInfo connInfo = _connection.getInfo();
+ Ice.ConnectionInfo connInfo = _current.con.getInfo();
if(connInfo instanceof Ice.IPConnectionInfo)
{
Ice.IPConnectionInfo ipConnInfo = (Ice.IPConnectionInfo)connInfo;
@@ -272,7 +272,7 @@ public class IncomingBase
}
catch(Ice.UserException ex)
{
- assert(_connection != null);
+ assert(_responseHandler != null);
if(_observer != null)
{
@@ -293,11 +293,11 @@ public class IncomingBase
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
if(_observer != null)
@@ -305,7 +305,7 @@ public class IncomingBase
_observer.detach();
_observer = null;
}
- _connection = null;
+ _responseHandler = null;
}
catch(java.lang.Exception ex)
{
@@ -317,7 +317,7 @@ public class IncomingBase
final protected void
__handleException(java.lang.Exception exc)
{
- assert(_connection != null);
+ assert(_responseHandler != null);
try
{
@@ -390,11 +390,11 @@ public class IncomingBase
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
}
catch(Ice.UnknownLocalException ex)
@@ -418,11 +418,11 @@ public class IncomingBase
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
}
catch(Ice.UnknownUserException ex)
@@ -446,11 +446,11 @@ public class IncomingBase
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
}
catch(Ice.UnknownException ex)
@@ -474,15 +474,28 @@ public class IncomingBase
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
}
- catch(Ice.LocalException ex)
+ catch(Ice.Exception ex)
{
+ if(ex instanceof Ice.SystemException)
+ {
+ //
+ // Only rethrow the system exception if it's a collocated
+ // call. For now, on-the-wire system exceptions aren't
+ // supported.
+ //
+ if(_current.con == null)
+ {
+ throw ex;
+ }
+ }
+
if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
{
__warning(ex);
@@ -508,11 +521,11 @@ public class IncomingBase
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
}
catch(Ice.UserException ex)
@@ -542,11 +555,11 @@ public class IncomingBase
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
}
catch(java.lang.Exception ex)
@@ -575,11 +588,11 @@ public class IncomingBase
{
_observer.reply(_os.size() - Protocol.headerSize - 4);
}
- _connection.sendResponse(_os, _compress);
+ _responseHandler.sendResponse(_current.requestId, _os, _compress);
}
else
{
- _connection.sendNoResponse();
+ _responseHandler.sendNoResponse();
}
}
@@ -588,7 +601,7 @@ public class IncomingBase
_observer.detach();
_observer = null;
}
- _connection = null;
+ _responseHandler = null;
}
protected Instance _instance;
@@ -603,7 +616,7 @@ public class IncomingBase
protected BasicStream _os;
- protected Ice.ConnectionI _connection;
+ protected ResponseHandler _responseHandler;
protected java.util.LinkedList<Ice.DispatchInterceptorAsyncCallback> _interceptorAsyncCallbackList;
}
diff --git a/java/src/IceInternal/InvocationObserverI.java b/java/src/IceInternal/InvocationObserverI.java
index e47f6670df3..7997a22d9d0 100644
--- a/java/src/IceInternal/InvocationObserverI.java
+++ b/java/src/IceInternal/InvocationObserverI.java
@@ -18,24 +18,24 @@ public class InvocationObserverI
static public final class RemoteInvocationHelper extends MetricsHelper<RemoteMetrics>
{
static private final AttributeResolver _attributes = new AttributeResolver()
- {
+ {
+ {
+ try
{
- try
- {
- Class<?> cl = RemoteInvocationHelper.class;
- add("parent", cl.getDeclaredMethod("getParent"));
- add("id", cl.getDeclaredMethod("getId"));
- add("requestId", cl.getDeclaredMethod("getRequestId"));
- CommunicatorObserverI.addConnectionAttributes(this, RemoteInvocationHelper.class);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- assert(false);
- }
+ Class<?> cl = RemoteInvocationHelper.class;
+ add("parent", cl.getDeclaredMethod("getParent"));
+ add("id", cl.getDeclaredMethod("getId"));
+ add("requestId", cl.getDeclaredMethod("getRequestId"));
+ CommunicatorObserverI.addConnectionAttributes(this, RemoteInvocationHelper.class);
}
- };
-
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+ }
+ };
+
RemoteInvocationHelper(Ice.ConnectionInfo con, Ice.Endpoint endpt, int requestId, int size)
{
super(_attributes);
@@ -114,6 +114,66 @@ public class InvocationObserverI
private Ice.EndpointInfo _endpointInfo;
};
+ static public final class CollocatedInvocationHelper extends MetricsHelper<RemoteMetrics>
+ {
+ static private final AttributeResolver _attributes = new AttributeResolver()
+ {
+ {
+ try
+ {
+ Class<?> cl = CollocatedInvocationHelper.class;
+ add("parent", cl.getDeclaredMethod("getParent"));
+ add("id", cl.getDeclaredMethod("getId"));
+ add("requestId", cl.getDeclaredMethod("getRequestId"));
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+ }
+ };
+
+ CollocatedInvocationHelper(int requestId, int size)
+ {
+ super(_attributes);
+ _requestId = requestId;
+ _size = size;
+ }
+
+ public void
+ initMetrics(RemoteMetrics v)
+ {
+ v.size += _size;
+ }
+
+ public String
+ getId()
+ {
+ if(_id == null)
+ {
+ _id = Integer.toString(_requestId);
+ }
+ return _id;
+ }
+
+ int
+ getRequestId()
+ {
+ return _requestId;
+ }
+
+ public String
+ getParent()
+ {
+ return "Communicator";
+ }
+
+ final private int _requestId;
+ final private int _size;
+ private String _id;
+ };
+
public void
userException()
{
@@ -149,21 +209,36 @@ public class InvocationObserverI
delegate);
}
+ public Ice.Instrumentation.RemoteObserver
+ getCollocatedObserver(int requestId, int sz)
+ {
+ Ice.Instrumentation.RemoteObserver delegate = null;
+ if(_delegate != null)
+ {
+ delegate = _delegate.getCollocatedObserver(requestId, sz);
+ }
+ return (Ice.Instrumentation.RemoteObserver)getObserver("Collocated",
+ new CollocatedInvocationHelper(requestId, sz),
+ RemoteMetrics.class,
+ RemoteObserverI.class,
+ delegate);
+ }
+
final MetricsUpdate<InvocationMetrics> _incrementRetry = new MetricsUpdate<InvocationMetrics>()
+ {
+ public void
+ update(InvocationMetrics v)
{
- public void
- update(InvocationMetrics v)
- {
- ++v.retry;
- }
- };
+ ++v.retry;
+ }
+ };
final MetricsUpdate<InvocationMetrics> _userException = new MetricsUpdate<InvocationMetrics>()
+ {
+ public void
+ update(InvocationMetrics v)
{
- public void
- update(InvocationMetrics v)
- {
- ++v.userException;
- }
- };
-} \ No newline at end of file
+ ++v.userException;
+ }
+ };
+}
diff --git a/java/src/IceInternal/LocalExceptionWrapper.java b/java/src/IceInternal/LocalExceptionWrapper.java
deleted file mode 100644
index 868781ee8a3..00000000000
--- a/java/src/IceInternal/LocalExceptionWrapper.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package IceInternal;
-
-public class LocalExceptionWrapper extends Exception
-{
- public
- LocalExceptionWrapper(Ice.LocalException ex, boolean retry)
- {
- _ex = ex;
- _retry = retry;
- }
-
- public
- LocalExceptionWrapper(IceInternal.LocalExceptionWrapper ex)
- {
- _ex = ex.get();
- _retry = ex._retry;
- }
-
- public Ice.LocalException
- get()
- {
- return _ex;
- }
-
- //
- // If true, always repeat the request. Don't take retry settings
- // or "at-most-once" guarantees into account.
- //
- // If false, only repeat the request if the retry settings allow
- // to do so, and if "at-most-once" does not need to be guaranteed.
- //
- public boolean
- retry()
- {
- return _retry;
- }
-
- public static void
- throwWrapper(java.lang.Throwable ex) throws LocalExceptionWrapper
- {
- if(ex instanceof Ice.UserException)
- {
- throw new LocalExceptionWrapper(new Ice.UnknownUserException(((Ice.UserException)ex).ice_name()), false);
- }
- if(ex instanceof Ice.LocalException)
- {
- if(ex instanceof Ice.UnknownException ||
- ex instanceof Ice.ObjectNotExistException ||
- ex instanceof Ice.OperationNotExistException ||
- ex instanceof Ice.FacetNotExistException)
- {
- throw new LocalExceptionWrapper((Ice.LocalException)ex, false);
- }
- throw new LocalExceptionWrapper(new Ice.UnknownLocalException(((Ice.LocalException)ex).ice_name(), ex),
- false);
- }
- throw new LocalExceptionWrapper(new Ice.UnknownException(Ex.toString(ex), ex), false);
- }
-
- private Ice.LocalException _ex;
- private boolean _retry;
-}
diff --git a/java/src/IceInternal/LocatorInfo.java b/java/src/IceInternal/LocatorInfo.java
index 39091b78fad..21aee75be93 100644
--- a/java/src/IceInternal/LocatorInfo.java
+++ b/java/src/IceInternal/LocatorInfo.java
@@ -314,7 +314,7 @@ public final class LocatorInfo
LocatorInfo(Ice.LocatorPrx locator, LocatorTable table, boolean background)
{
- _locator = (Ice.LocatorPrx)locator.ice_collocationOptimized(false);
+ _locator = locator;
_table = table;
_background = background;
}
@@ -371,8 +371,7 @@ public final class LocatorInfo
//
// Do not make locator calls from within sync.
//
- Ice.LocatorRegistryPrx locatorRegistry =
- (Ice.LocatorRegistryPrx)_locator.getRegistry().ice_collocationOptimized(false);
+ Ice.LocatorRegistryPrx locatorRegistry = (Ice.LocatorRegistryPrx)_locator.getRegistry();
synchronized(this)
{
diff --git a/java/src/IceInternal/MetricsMap.java b/java/src/IceInternal/MetricsMap.java
index 620d107ffec..604ed218486 100644
--- a/java/src/IceInternal/MetricsMap.java
+++ b/java/src/IceInternal/MetricsMap.java
@@ -513,4 +513,4 @@ public class MetricsMap<T extends IceMX.Metrics>
final private java.util.Map<String, Entry> _objects = new java.util.HashMap<String, Entry>();
final private java.util.Map<String, SubMapCloneFactory<?>> _subMaps;
private java.util.Deque<Entry> _detachedQueue;
-}; \ No newline at end of file
+};
diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java
index c00a99a2b2b..ac06172ce72 100644
--- a/java/src/IceInternal/Outgoing.java
+++ b/java/src/IceInternal/Outgoing.java
@@ -15,44 +15,53 @@ import Ice.Instrumentation.InvocationObserver;
public final class Outgoing implements OutgoingMessageCallback
{
public
- Outgoing(RequestHandler handler, String operation, Ice.OperationMode mode, java.util.Map<String, String> context,
- InvocationObserver observer)
- throws LocalExceptionWrapper
+ Outgoing(Ice.ObjectPrxHelperBase proxy, String op, Ice.OperationMode mode, java.util.Map<String, String> context,
+ boolean explicitCtx)
{
+ Reference ref = proxy.__reference();
_state = StateUnsent;
- _exceptionWrapper = false;
- _exceptionWrapperRetry = false;
_sent = false;
- _handler = handler;
- _observer = observer;
- _encoding = Protocol.getCompatibleEncoding(handler.getReference().getEncoding());
- _os = new BasicStream(_handler.getReference().getInstance(), Protocol.currentProtocolEncoding);
+ _proxy = proxy;
+ _mode = mode;
+ _handler = null;
+ _observer = IceInternal.ObserverHelper.get(proxy, op, context);
+ _encoding = Protocol.getCompatibleEncoding(ref.getEncoding());
+ _os = new BasicStream(ref.getInstance(), Protocol.currentProtocolEncoding);
- Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_handler.getReference().getProtocol()));
+ Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(ref.getProtocol()));
- writeHeader(operation, mode, context);
+ writeHeader(op, mode, context, explicitCtx);
}
//
// These functions allow this object to be reused, rather than reallocated.
//
public void
- reset(RequestHandler handler, String operation, Ice.OperationMode mode, java.util.Map<String, String> context,
- InvocationObserver observer)
- throws LocalExceptionWrapper
+ reset(Ice.ObjectPrxHelperBase proxy, String op, Ice.OperationMode mode, java.util.Map<String, String> context,
+ boolean explicitCtx)
{
+ Reference ref = proxy.__reference();
_state = StateUnsent;
_exception = null;
- _exceptionWrapper = false;
- _exceptionWrapperRetry = false;
_sent = false;
- _handler = handler;
- _observer = observer;
- _encoding = Protocol.getCompatibleEncoding(handler.getReference().getEncoding());
+ _proxy = proxy;
+ _mode = mode;
+ _handler = null;
+ _observer = IceInternal.ObserverHelper.get(proxy, op, context);
+ _encoding = Protocol.getCompatibleEncoding(ref.getEncoding());
- Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_handler.getReference().getProtocol()));
+ Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(ref.getProtocol()));
- writeHeader(operation, mode, context);
+ writeHeader(op, mode, context, explicitCtx);
+ }
+
+ public void
+ detach()
+ {
+ if(_observer != null)
+ {
+ _observer.detach();
+ }
}
public void
@@ -68,17 +77,27 @@ public final class Outgoing implements OutgoingMessageCallback
// Returns true if ok, false if user exception.
public boolean
invoke()
- throws LocalExceptionWrapper
{
assert(_state == StateUnsent);
- switch(_handler.getReference().getMode())
+ int mode = _proxy.__reference().getMode();
+ if(mode == Reference.ModeBatchOneway || mode == Reference.ModeBatchDatagram)
{
- case Reference.ModeOneway:
- case Reference.ModeDatagram:
- case Reference.ModeTwoway:
+ _state = StateInProgress;
+ _handler.finishBatchRequest(_os);
+ return true;
+ }
+
+ int cnt = 0;
+ while(true)
+ {
+ try
{
_state = StateInProgress;
+ _exception = null;
+ _sent = false;
+
+ _handler = _proxy.__getRequestHandler(false);
if(_handler.sendRequest(this)) // Request sent and no response expected, we're done.
{
@@ -92,7 +111,7 @@ public final class Outgoing implements OutgoingMessageCallback
// If the handler says it's not finished, we wait until we're done.
//
- int invocationTimeout = _handler.getReference().getInvocationTimeout();
+ int invocationTimeout = _proxy.__reference().getInvocationTimeout();
if(invocationTimeout > 0)
{
long now = Time.currentMonotonicTimeMillis();
@@ -131,71 +150,76 @@ public final class Outgoing implements OutgoingMessageCallback
if(timedOut)
{
_handler.requestTimedOut(this);
- assert(_exception != null);
+
+ //
+ // Wait for the exception to propagate. It's possible the request handler ignores
+ // the timeout if there was a failure shortly before requestTimedOut got called.
+ // In this case, the exception should be set on the Outgoing.
+ //
+ synchronized(this)
+ {
+ while(_exception == null)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
}
if(_exception != null)
{
- _exception.fillInStackTrace();
- if(_exceptionWrapper)
+ throw (Ice.Exception)_exception.fillInStackTrace();
+ }
+ else
+ {
+ assert(_state != StateInProgress);
+ return _state == StateOK;
+ }
+ }
+ catch(RetryException ex)
+ {
+ _proxy.__setRequestHandler(_handler, null); // Clear request handler and retry.
+ }
+ catch(Ice.Exception ex)
+ {
+ try
+ {
+ Ice.IntHolder interval = new Ice.IntHolder();
+ cnt = _proxy.__handleException(ex, _handler, _mode, _sent, interval, cnt);
+ if(_observer != null)
{
- throw new LocalExceptionWrapper(_exception, _exceptionWrapperRetry);
+ _observer.retried(); // Invocation is being retried.
}
-
- //
- // A CloseConnectionException indicates graceful
- // server shutdown, and is therefore always repeatable
- // without violating "at-most-once". That's because by
- // sending a close connection message, the server
- // guarantees that all outstanding requests can safely
- // be repeated.
- //
- // An ObjectNotExistException can always be retried as
- // well without violating "at-most-once" (see the
- // implementation of the checkRetryAfterException
- // method of the ProxyFactory class for the reasons
- // why it can be useful).
- //
- if(!_sent ||
- _exception instanceof Ice.CloseConnectionException ||
- _exception instanceof Ice.ObjectNotExistException)
+ if(interval.value > 0)
{
- throw _exception;
+ try
+ {
+ Thread.sleep(interval.value);
+ }
+ catch(InterruptedException exi)
+ {
+ }
}
-
- //
- // Throw the exception wrapped in a LocalExceptionWrapper,
- // to indicate that the request cannot be resent without
- // potentially violating the "at-most-once" principle.
- //
- throw new LocalExceptionWrapper(_exception, false);
}
-
- assert(_state != StateInProgress);
- return _state == StateOK;
- }
-
- case Reference.ModeBatchOneway:
- case Reference.ModeBatchDatagram:
- {
- //
- // For batch oneways and datagrams, the same rules as for
- // regular oneways and datagrams (see comment above)
- // apply.
- //
- _state = StateInProgress;
- _handler.finishBatchRequest(_os);
- return true;
+ catch(Ice.Exception exc)
+ {
+ if(_observer != null)
+ {
+ _observer.failed(exc.ice_name());
+ }
+ throw exc;
+ }
}
}
-
- assert(false);
- return false;
}
public void
abort(Ice.LocalException ex)
- throws LocalExceptionWrapper
{
assert(_state == StateUnsent);
@@ -204,7 +228,7 @@ public final class Outgoing implements OutgoingMessageCallback
// must notify the connection about that we give up ownership
// of the batch stream.
//
- int mode = _handler.getReference().getMode();
+ int mode = _proxy.__reference().getMode();
if(mode == Reference.ModeBatchOneway || mode == Reference.ModeBatchDatagram)
{
_handler.abortBatchRequest();
@@ -215,15 +239,21 @@ public final class Outgoing implements OutgoingMessageCallback
public boolean
send(Ice.ConnectionI connection, boolean compress, boolean response)
- throws LocalExceptionWrapper
+ throws RetryException
{
return connection.sendRequest(this, compress, response);
}
+ public void
+ invokeCollocated(CollocatedRequestHandler handler)
+ {
+ handler.invokeRequest(this);
+ }
+
synchronized public void
sent()
{
- if(_handler.getReference().getMode() != Reference.ModeTwoway)
+ if(_proxy.__reference().getMode() != Reference.ModeTwoway)
{
if(_remoteObserver != null)
{
@@ -239,7 +269,7 @@ public final class Outgoing implements OutgoingMessageCallback
public synchronized void
finished(BasicStream is)
{
- assert(_handler.getReference().getMode() == Reference.ModeTwoway); // Only for twoways.
+ assert(_proxy.__reference().getMode() == Reference.ModeTwoway); // Only for twoways.
assert(_state <= StateInProgress);
@@ -252,7 +282,7 @@ public final class Outgoing implements OutgoingMessageCallback
if(_is == null)
{
- _is = new IceInternal.BasicStream(_handler.getReference().getInstance(), Protocol.currentProtocolEncoding);
+ _is = new IceInternal.BasicStream(_proxy.__reference().getInstance(), Protocol.currentProtocolEncoding);
}
_is.swap(is);
byte replyStatus = _is.readByte();
@@ -385,7 +415,7 @@ public final class Outgoing implements OutgoingMessageCallback
}
public synchronized void
- finished(Ice.LocalException ex, boolean sent)
+ finished(Ice.Exception ex, boolean sent)
{
assert(_state <= StateInProgress);
if(_remoteObserver != null)
@@ -399,24 +429,6 @@ public final class Outgoing implements OutgoingMessageCallback
_sent = sent;
notify();
}
-
- public synchronized void
- finished(LocalExceptionWrapper ex)
- {
- if(_remoteObserver != null)
- {
- _remoteObserver.failed(ex.get().ice_name());
- _remoteObserver.detach();
- _remoteObserver = null;
- }
-
- _state = StateFailed;
- _exceptionWrapper = true;
- _exceptionWrapperRetry = ex.retry();
- _exception = ex.get();
- _sent = false;
- notify();
- }
public BasicStream
os()
@@ -516,11 +528,28 @@ public final class Outgoing implements OutgoingMessageCallback
}
}
+ public void
+ attachCollocatedObserver(int requestId)
+ {
+ if(_observer != null)
+ {
+ _remoteObserver = _observer.getCollocatedObserver(requestId, _os.size() - Protocol.headerSize - 4);
+ if(_remoteObserver != null)
+ {
+ _remoteObserver.attach();
+ }
+ }
+ }
+
private void
- writeHeader(String operation, Ice.OperationMode mode, java.util.Map<String, String> context)
- throws LocalExceptionWrapper
+ writeHeader(String operation, Ice.OperationMode mode, java.util.Map<String, String> context, boolean explicitCtx)
{
- switch(_handler.getReference().getMode())
+ if(explicitCtx && context == null)
+ {
+ context = _emptyContext;
+ }
+
+ switch(_proxy.__reference().getMode())
{
case Reference.ModeTwoway:
case Reference.ModeOneway:
@@ -533,19 +562,40 @@ public final class Outgoing implements OutgoingMessageCallback
case Reference.ModeBatchOneway:
case Reference.ModeBatchDatagram:
{
- _handler.prepareBatchRequest(_os);
+ while(true)
+ {
+ try
+ {
+ _handler = _proxy.__getRequestHandler(true);
+ _handler.prepareBatchRequest(_os);
+ break;
+ }
+ catch(RetryException ex)
+ {
+ _proxy.__setRequestHandler(_handler, null); // Clear request handler and retry.
+ }
+ catch(Ice.LocalException ex)
+ {
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_name());
+ }
+ _proxy.__setRequestHandler(_handler, null); // Clear request handler
+ throw ex;
+ }
+ }
break;
}
}
try
{
- _handler.getReference().getIdentity().__write(_os);
+ _proxy.__reference().getIdentity().__write(_os);
//
// For compatibility with the old FacetPath.
//
- String facet = _handler.getReference().getFacet();
+ String facet = _proxy.__reference().getFacet();
if(facet == null || facet.length() == 0)
{
_os.writeStringSeq(null);
@@ -572,8 +622,8 @@ public final class Outgoing implements OutgoingMessageCallback
//
// Implicit context
//
- Ice.ImplicitContextI implicitContext = _handler.getReference().getInstance().getImplicitContext();
- java.util.Map<String, String> prxContext = _handler.getReference().getContext();
+ Ice.ImplicitContextI implicitContext = _proxy.__reference().getInstance().getImplicitContext();
+ java.util.Map<String, String> prxContext = _proxy.__reference().getContext();
if(implicitContext == null)
{
@@ -591,15 +641,14 @@ public final class Outgoing implements OutgoingMessageCallback
}
}
+ private Ice.ObjectPrxHelperBase _proxy;
+ private Ice.OperationMode _mode;
private RequestHandler _handler;
private Ice.EncodingVersion _encoding;
private BasicStream _is;
private BasicStream _os;
private boolean _sent;
-
- private Ice.LocalException _exception;
- private boolean _exceptionWrapper;
- private boolean _exceptionWrapperRetry;
+ private Ice.Exception _exception;
private static final int StateUnsent = 0;
private static final int StateInProgress = 1;
@@ -612,5 +661,7 @@ public final class Outgoing implements OutgoingMessageCallback
private InvocationObserver _observer;
private RemoteObserver _remoteObserver;
- public Outgoing next; // For use by Ice._ObjectDelM
+ public Outgoing next; // For use by Ice.ObjectPrxHelperBase
+
+ private static final java.util.Map<String, String> _emptyContext = new java.util.HashMap<String, String>();
}
diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java
index 699477d4607..41c56076a94 100644
--- a/java/src/IceInternal/OutgoingAsync.java
+++ b/java/src/IceInternal/OutgoingAsync.java
@@ -21,7 +21,7 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
public void __prepare(String operation, Ice.OperationMode mode, java.util.Map<String, String> ctx,
boolean explicitCtx)
{
- _delegate = null;
+ _handler = null;
_cnt = 0;
_mode = mode;
_sentSynchronously = false;
@@ -101,11 +101,17 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
public int
__send(Ice.ConnectionI connection, boolean compress, boolean response)
- throws LocalExceptionWrapper
+ throws RetryException
{
return connection.sendAsyncRequest(this, compress, response);
}
+ public int
+ __invokeCollocated(CollocatedRequestHandler handler)
+ {
+ return handler.invokeAsyncRequest(this);
+ }
+
public boolean
__sent()
{
@@ -129,7 +135,7 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
_timeoutRequestHandler = null;
}
_state |= Done | OK;
- _os.resize(0, false); // Clear buffer now, instead of waiting for AsyncResult deallocation
+ //_os.resize(0, false); // Don't clear the buffer now, it's needed for the collocation optimization
}
_monitor.notifyAll();
return !alreadySent; // Don't call the sent call is already sent.
@@ -143,7 +149,7 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
}
public void
- __finished(Ice.LocalException exc, boolean sent)
+ __finished(Ice.Exception exc, boolean sent)
{
synchronized(_monitor)
{
@@ -165,56 +171,16 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
// NOTE: at this point, synchronization isn't needed, no other threads should be
// calling on the callback.
//
-
- try
- {
- int interval = handleException(exc, sent); // This will throw if the invocation can't be retried.
- if(interval > 0)
- {
- _instance.retryQueue().add(this, interval);
- }
- else
- {
- __invoke(false);
- }
- }
- catch(Ice.LocalException ex)
- {
- __invokeException(ex);
- }
- }
-
- public final void
- __finished(LocalExceptionWrapper exc)
- {
- //
- // NOTE: at this point, synchronization isn't needed, no other threads should be
- // calling on the callback. The LocalExceptionWrapper exception is only called
- // before the invocation is sent.
- //
-
- if(_remoteObserver != null)
- {
- _remoteObserver.failed(exc.get().ice_name());
- _remoteObserver.detach();
- _remoteObserver = null;
- }
-
- assert(_timeoutRequestHandler == null);
-
try
{
- int interval = handleException(exc); // This will throw if the invocation can't be retried.
- if(interval > 0)
- {
- _instance.retryQueue().add(this, interval);
- }
- else
+ if(!handleException(exc, sent))
{
- __invoke(false);
+ return; // Can't be retried immediately.
}
+
+ __invoke(false); // Retry the invocation
}
- catch(Ice.LocalException ex)
+ catch(Ice.Exception ex)
{
__invokeException(ex);
}
@@ -396,12 +362,10 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
{
while(true)
{
- int interval = 0;
try
{
- _delegate = _proxy.__getDelegate(true);
- RequestHandler handler = _delegate.__getRequestHandler();
- int status = handler.sendAsyncRequest(this);
+ _handler = _proxy.__getRequestHandler(true);
+ int status = _handler.sendAsyncRequest(this);
if((status & AsyncStatus.Sent) > 0)
{
if(synchronous)
@@ -427,30 +391,27 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
{
if((_state & Done) == 0)
{
- int invocationTimeout = handler.getReference().getInvocationTimeout();
+ int invocationTimeout = _handler.getReference().getInvocationTimeout();
if(invocationTimeout > 0)
{
_instance.timer().schedule(this, invocationTimeout);
- _timeoutRequestHandler = handler;
+ _timeoutRequestHandler = _handler;
}
}
}
}
break;
}
- catch(LocalExceptionWrapper ex)
- {
- interval = handleException(ex);
- }
- catch(Ice.LocalException ex)
+ catch(RetryException ex)
{
- interval = handleException(ex, false);
+ _proxy.__setRequestHandler(_handler, null); // Clear request handler and retry.
}
-
- if(interval > 0)
+ catch(Ice.Exception ex)
{
- _instance.retryQueue().add(this, interval);
- return false;
+ if(!handleException(ex, false)) // This will throw if the invocation can't be retried.
+ {
+ break; // Can't be retried immediately.
+ }
}
}
return _sentSynchronously;
@@ -488,78 +449,52 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa
}
}
+ BasicStream
+ __getIs()
+ {
+ return _is;
+ }
+
public void
runTimerTask()
{
__runTimerTask();
}
- private int
- handleException(Ice.LocalException exc, boolean sent)
+ private boolean
+ handleException(Ice.Exception exc, boolean sent)
{
- Ice.IntHolder interval = new Ice.IntHolder(0);
try
{
- //
- // A CloseConnectionException indicates graceful server shutdown, and is therefore
- // always repeatable without violating "at-most-once". That's because by sending a
- // close connection message, the server guarantees that all outstanding requests
- // can safely be repeated.
- //
- // An ObjectNotExistException can always be retried as well without violating
- // "at-most-once" (see the implementation of the checkRetryAfterException method of
- // the ProxyFactory class for the reasons why it can be useful).
- //
- if(!sent ||
- exc instanceof Ice.CloseConnectionException ||
- exc instanceof Ice.ObjectNotExistException)
+ Ice.IntHolder interval = new Ice.IntHolder();
+ _cnt = _proxy.__handleException(exc, _handler, _mode, sent, interval, _cnt);
+ if(_observer != null)
{
- throw exc;
+ _observer.retried(); // Invocation is being retried.
}
-
- //
- // Throw the exception wrapped in a LocalExceptionWrapper, to indicate that the
- // request cannot be resent without potentially violating the "at-most-once"
- // principle.
- //
- throw new LocalExceptionWrapper(exc, false);
- }
- catch(LocalExceptionWrapper ex)
- {
- if(_mode == Ice.OperationMode.Nonmutating || _mode == Ice.OperationMode.Idempotent)
+ if(interval.value > 0)
{
- _cnt = _proxy.__handleExceptionWrapperRelaxed(_delegate, ex, interval, _cnt, _observer);
+ _instance.retryQueue().add(this, interval.value);
+ return false; // Don't retry immediately, the retry queue will take care of the retry.
}
else
{
- _proxy.__handleExceptionWrapper(_delegate, ex, _observer);
+ return true; // Retry immediately.
}
}
- catch(Ice.LocalException ex)
+ catch(Ice.Exception ex)
{
- _cnt = _proxy.__handleException(_delegate, ex, interval, _cnt, _observer);
- }
- return interval.value;
- }
-
- private int
- handleException(LocalExceptionWrapper ex)
- {
- Ice.IntHolder interval = new Ice.IntHolder(0);
- if(_mode == Ice.OperationMode.Nonmutating || _mode == Ice.OperationMode.Idempotent)
- {
- _cnt = _proxy.__handleExceptionWrapperRelaxed(_delegate, ex, interval, _cnt, _observer);
- }
- else
- {
- _proxy.__handleExceptionWrapper(_delegate, ex, _observer);
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_name());
+ }
+ throw ex;
}
- return interval.value;
}
protected Ice.ObjectPrxHelperBase _proxy;
- private Ice._ObjectDel _delegate;
+ private RequestHandler _handler;
private Ice.EncodingVersion _encoding;
private int _cnt;
private Ice.OperationMode _mode;
diff --git a/java/src/IceInternal/OutgoingAsyncMessageCallback.java b/java/src/IceInternal/OutgoingAsyncMessageCallback.java
index bd710644a9e..8d830987428 100644
--- a/java/src/IceInternal/OutgoingAsyncMessageCallback.java
+++ b/java/src/IceInternal/OutgoingAsyncMessageCallback.java
@@ -19,7 +19,9 @@ public interface OutgoingAsyncMessageCallback
// Called by the request handler to send the request over the connection.
//
int __send(Ice.ConnectionI conection, boolean compress, boolean response)
- throws LocalExceptionWrapper;
+ throws RetryException;
+
+ int __invokeCollocated(CollocatedRequestHandler handler);
//
// Called by the connection when the message is confirmed sent. The connection is locked
@@ -40,5 +42,5 @@ public interface OutgoingAsyncMessageCallback
// not the message was possibly sent (this is useful for retry to figure out whether
// or not the request can't be retried without breaking at-most-once semantics.)
//
- public abstract void __finished(Ice.LocalException ex, boolean sent);
+ public abstract void __finished(Ice.Exception ex, boolean sent);
}
diff --git a/java/src/IceInternal/OutgoingMessageCallback.java b/java/src/IceInternal/OutgoingMessageCallback.java
index af53575d3a9..18b18a09575 100644
--- a/java/src/IceInternal/OutgoingMessageCallback.java
+++ b/java/src/IceInternal/OutgoingMessageCallback.java
@@ -12,8 +12,11 @@ package IceInternal;
public interface OutgoingMessageCallback
{
boolean send(Ice.ConnectionI conection, boolean compress, boolean response)
- throws LocalExceptionWrapper;
+ throws RetryException;
+
+ void invokeCollocated(CollocatedRequestHandler handler);
void sent();
- void finished(Ice.LocalException ex, boolean sent);
+
+ void finished(Ice.Exception ex, boolean sent);
}
diff --git a/java/src/IceInternal/ProxyBatchOutgoingAsync.java b/java/src/IceInternal/ProxyBatchOutgoingAsync.java
index 8bea231573d..77a82ae2772 100644
--- a/java/src/IceInternal/ProxyBatchOutgoingAsync.java
+++ b/java/src/IceInternal/ProxyBatchOutgoingAsync.java
@@ -11,11 +11,10 @@ package IceInternal;
public class ProxyBatchOutgoingAsync extends BatchOutgoingAsync
{
- public ProxyBatchOutgoingAsync(Ice.ObjectPrx prx, String operation, CallbackBase callback)
+ public ProxyBatchOutgoingAsync(Ice.ObjectPrxHelperBase prx, String operation, CallbackBase callback)
{
- super(prx.ice_getCommunicator(), ((Ice.ObjectPrxHelperBase)prx).__reference().getInstance(), operation,
- callback);
- _proxy = (Ice.ObjectPrxHelperBase)prx;
+ super(prx.ice_getCommunicator(), prx.__reference().getInstance(), operation, callback);
+ _proxy = prx;
_observer = ObserverHelper.get(prx, operation);
}
@@ -23,25 +22,11 @@ public class ProxyBatchOutgoingAsync extends BatchOutgoingAsync
{
Protocol.checkSupportedProtocol(_proxy.__reference().getProtocol());
- //
- // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch
- // requests were queued with the connection, they would be lost without being noticed.
- //
- Ice._ObjectDel delegate = null;
- int cnt = -1; // Don't retry.
+ RequestHandler handler = null;
try
{
- delegate = _proxy.__getDelegate(false);
- RequestHandler handler = delegate.__getRequestHandler();
- int status;
- try
- {
- status = handler.sendAsyncRequest(this);
- }
- catch(IceInternal.LocalExceptionWrapper ex)
- {
- throw ex.get();
- }
+ handler = _proxy.__getRequestHandler(true);
+ int status = handler.sendAsyncRequest(this);
if((status & AsyncStatus.Sent) > 0)
{
_sentSynchronously = true;
@@ -66,9 +51,23 @@ public class ProxyBatchOutgoingAsync extends BatchOutgoingAsync
}
}
}
- catch(Ice.LocalException __ex)
+ catch(RetryException ex)
{
- cnt = _proxy.__handleException(delegate, __ex, null, cnt, _observer);
+ //
+ // Clear request handler but don't retry or throw. Retrying
+ // isn't useful, there were no batch requests associated with
+ // the proxy's request handler.
+ //
+ _proxy.__setRequestHandler(handler, null);
+ }
+ catch(Ice.Exception ex)
+ {
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_name());
+ }
+ _proxy.__setRequestHandler(handler, null); // Clear request handler
+ throw ex; // Throw to notify the user lthat batch requests were potentially lost.
}
}
diff --git a/java/src/IceInternal/ProxyFactory.java b/java/src/IceInternal/ProxyFactory.java
index c3fba4c0a88..6283de1dc0e 100644
--- a/java/src/IceInternal/ProxyFactory.java
+++ b/java/src/IceInternal/ProxyFactory.java
@@ -70,7 +70,7 @@ public final class ProxyFactory
if(ref != null)
{
Ice.ObjectPrxHelperBase proxy = new Ice.ObjectPrxHelperBase();
- proxy.setup(ref);
+ proxy.__setup(ref);
return proxy;
}
else
@@ -248,23 +248,7 @@ public final class ProxyFactory
logger.trace(traceLevels.retryCat, s);
}
- if(sleepInterval != null)
- {
- sleepInterval.value = interval;
- }
- else if(interval > 0)
- {
- //
- // Sleep before retrying.
- //
- try
- {
- Thread.sleep(interval);
- }
- catch(InterruptedException ex1)
- {
- }
- }
+ sleepInterval.value = interval;
return cnt;
}
diff --git a/java/src/IceInternal/RequestHandler.java b/java/src/IceInternal/RequestHandler.java
index 070ff48106a..92a94b0057a 100644
--- a/java/src/IceInternal/RequestHandler.java
+++ b/java/src/IceInternal/RequestHandler.java
@@ -14,15 +14,15 @@ import Ice.Instrumentation.InvocationObserver;
public interface RequestHandler
{
void prepareBatchRequest(BasicStream out)
- throws LocalExceptionWrapper;
+ throws RetryException;
void finishBatchRequest(BasicStream out);
void abortBatchRequest();
boolean sendRequest(OutgoingMessageCallback out)
- throws LocalExceptionWrapper;
+ throws RetryException;
int sendAsyncRequest(OutgoingAsyncMessageCallback out)
- throws LocalExceptionWrapper;
+ throws RetryException;
void requestTimedOut(OutgoingMessageCallback out);
void asyncRequestTimedOut(OutgoingAsyncMessageCallback outAsync);
@@ -30,10 +30,4 @@ public interface RequestHandler
Reference getReference();
Ice.ConnectionI getConnection(boolean wait);
-
- Outgoing getOutgoing(String operation, Ice.OperationMode mode, java.util.Map<String, String> context,
- InvocationObserver observer)
- throws LocalExceptionWrapper;
-
- void reclaimOutgoing(Outgoing out);
}
diff --git a/java/src/IceInternal/ResponseHandler.java b/java/src/IceInternal/ResponseHandler.java
new file mode 100644
index 00000000000..9b26f6ee2fc
--- /dev/null
+++ b/java/src/IceInternal/ResponseHandler.java
@@ -0,0 +1,17 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package IceInternal;
+
+public interface ResponseHandler
+{
+ void sendResponse(int requestId, BasicStream os, byte status);
+ void sendNoResponse();
+ void invokeException(int requestId, Ice.LocalException ex, int invokeNum);
+};
diff --git a/java/src/IceInternal/RetryException.java b/java/src/IceInternal/RetryException.java
new file mode 100644
index 00000000000..350a0d3ac18
--- /dev/null
+++ b/java/src/IceInternal/RetryException.java
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package IceInternal;
+
+public class RetryException extends Exception
+{
+ public
+ RetryException(Ice.LocalException ex)
+ {
+ _ex = ex;
+ }
+
+ public Ice.LocalException
+ get()
+ {
+ return _ex;
+ }
+
+ private Ice.LocalException _ex;
+}
diff --git a/java/src/IceInternal/RouterInfo.java b/java/src/IceInternal/RouterInfo.java
index 1630cb92819..84856f1294f 100644
--- a/java/src/IceInternal/RouterInfo.java
+++ b/java/src/IceInternal/RouterInfo.java
@@ -110,21 +110,7 @@ public final class RouterInfo
public void
exception(Ice.LocalException ex)
{
- if(ex instanceof Ice.CollocationOptimizationException)
- {
- try
- {
- callback.setEndpoints(getClientEndpoints());
- }
- catch(Ice.LocalException e)
- {
- callback.setException(e);
- }
- }
- else
- {
- callback.setException(ex);
- }
+ callback.setException(ex);
}
});
}
@@ -189,22 +175,7 @@ public final class RouterInfo
public void
exception(Ice.LocalException ex)
{
- if(ex instanceof Ice.CollocationOptimizationException)
- {
- try
- {
- addProxy(proxy);
- callback.addedProxy();
- }
- catch(Ice.LocalException e)
- {
- callback.setException(ex);
- }
- }
- else
- {
- callback.setException(ex);
- }
+ callback.setException(ex);
}
});
@@ -249,14 +220,10 @@ public final class RouterInfo
// router, we must use the same timeout as the already
// existing connection.
//
- try
+ if(_router.ice_getConnection() != null)
{
clientProxy = clientProxy.ice_timeout(_router.ice_getConnection().timeout());
}
- catch(Ice.CollocationOptimizationException ex)
- {
- // Ignore - collocated router.
- }
_clientEndpoints = ((Ice.ObjectPrxHelperBase)clientProxy).__reference().getEndpoints();
}
diff --git a/java/src/IceInternal/TwowayCallback.java b/java/src/IceInternal/TwowayCallback.java
index 1a6e9b7480a..368f3600a04 100644
--- a/java/src/IceInternal/TwowayCallback.java
+++ b/java/src/IceInternal/TwowayCallback.java
@@ -15,8 +15,13 @@ public abstract class TwowayCallback extends CallbackBase implements Ice.TwowayC
{
}
+ public void exception(Ice.SystemException __ex)
+ {
+ exception(new Ice.UnknownException(__ex));
+ }
+
public final void __sent(Ice.AsyncResult __result)
{
sent(__result.sentSynchronously());
}
-}; \ No newline at end of file
+};
diff --git a/java/test/Ice/ami/AMI.java b/java/test/Ice/ami/AMI.java
index 197ca12e276..9a067ea6bcc 100644
--- a/java/test/Ice/ami/AMI.java
+++ b/java/test/Ice/ami/AMI.java
@@ -1491,6 +1491,8 @@ public class AMI
out.print("testing batch requests with proxy... ");
out.flush();
{
+ test(p.ice_batchOneway().begin_ice_flushBatchRequests().sentSynchronously());
+
{
//
// AsyncResult.
@@ -1521,6 +1523,7 @@ public class AMI
test(p.waitForBatch(2));
}
+ if(p.ice_getConnection() != null)
{
//
// AsyncResult exception.
@@ -1581,6 +1584,7 @@ public class AMI
test(p.waitForBatch(2));
}
+ if(p.ice_getConnection() != null)
{
//
// Type-safe exception.
@@ -1613,467 +1617,470 @@ public class AMI
}
out.println("ok");
- out.print("testing batch requests with connection... ");
- out.flush();
+ if(p.ice_getConnection() != null)
{
+ out.print("testing batch requests with connection... ");
+ out.flush();
{
- //
- // AsyncResult.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(2));
- }
-
- {
- //
- // AsyncResult exception.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.ice_getConnection().close(false);
- final FlushExCallback cb = new FlushExCallback();
- Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(!r.isSent());
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
- }
-
- {
- //
- // Type-safe.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
- new Ice.Callback_Connection_flushBatchRequests()
- {
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(2));
- }
-
- {
- //
- // Type-safe exception.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.ice_getConnection().close(false);
- final FlushExCallback cb = new FlushExCallback();
- Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
- new Ice.Callback_Connection_flushBatchRequests()
- {
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
- });
- cb.check();
- test(!r.isSent());
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
- }
- }
- out.println("ok");
-
- out.print("testing batch requests with communicator... ");
- out.flush();
- {
- {
- //
- // AsyncResult - 1 connection.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(2));
- }
-
- {
- //
- // AsyncResult exception - 1 connection.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
- }
-
- {
- //
- // AsyncResult - 2 connections.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b1.opBatch();
- b2.opBatch();
- b2.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
+ {
+ //
+ // AsyncResult.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
+ new Ice.Callback()
{
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(4));
- }
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
- {
- //
- // AsyncResult exception - 2 connections - 1 failure.
- //
- // All connections should be flushed even if there are failures on some connections.
- // Exceptions should not be reported.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b2.opBatch();
- b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
- @Override
- public void sent(Ice.AsyncResult result)
+ {
+ //
+ // AsyncResult exception.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushExCallback cb = new FlushExCallback();
+ Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
+ new Ice.Callback()
{
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.waitForBatch(1));
- }
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(!r.isSent());
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
- {
- //
- // AsyncResult exception - 2 connections - 2 failures.
- //
- // The sent callback should be invoked even if all connections fail.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b2.opBatch();
- b1.ice_getConnection().close(false);
- b2.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
+ {
+ //
+ // Type-safe.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
+ new Ice.Callback_Connection_flushBatchRequests()
{
- cb.completedAsync(result);
- }
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
- @Override
- public void sent(Ice.AsyncResult result)
+ {
+ //
+ // Type-safe exception.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushExCallback cb = new FlushExCallback();
+ Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
+ new Ice.Callback_Connection_flushBatchRequests()
{
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(!r.isSent());
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
}
+ out.println("ok");
+ out.print("testing batch requests with communicator... ");
+ out.flush();
{
- //
- // Type-safe - 1 connection.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback_Communicator_flushBatchRequests()
- {
- @Override
- public void exception(Ice.LocalException ex)
+ {
+ //
+ // AsyncResult - 1 connection.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback()
{
- cb.exception(ex);
- }
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
- @Override
- public void sent(boolean sentSynchronously)
+ {
+ //
+ // AsyncResult exception - 1 connection.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback()
{
- cb.sent(sentSynchronously);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(2));
- }
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
- {
- //
- // Type-safe exception - 1 connection.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback_Communicator_flushBatchRequests()
- {
- @Override
- public void exception(Ice.LocalException ex)
+ {
+ //
+ // AsyncResult - 2 connections.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b1.opBatch();
+ b2.opBatch();
+ b2.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback()
{
- cb.exception(ex);
- }
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(4));
+ }
- @Override
- public void sent(boolean sentSynchronously)
+ {
+ //
+ // AsyncResult exception - 2 connections - 1 failure.
+ //
+ // All connections should be flushed even if there are failures on some connections.
+ // Exceptions should not be reported.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b2.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback()
{
- cb.sent(sentSynchronously);
- }
- });
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
- }
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.waitForBatch(1));
+ }
- {
- //
- // 2 connections.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b1.opBatch();
- b2.opBatch();
- b2.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback_Communicator_flushBatchRequests()
- {
- @Override
- public void exception(Ice.LocalException ex)
+ {
+ //
+ // AsyncResult exception - 2 connections - 2 failures.
+ //
+ // The sent callback should be invoked even if all connections fail.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b2.opBatch();
+ b1.ice_getConnection().close(false);
+ b2.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback()
{
- cb.exception(ex);
- }
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
- @Override
- public void sent(boolean sentSynchronously)
+ {
+ //
+ // Type-safe - 1 connection.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback_Communicator_flushBatchRequests()
{
- cb.sent(sentSynchronously);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(4));
- }
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
- {
- //
- // Exception - 2 connections - 1 failure.
- //
- // All connections should be flushed even if there are failures on some connections.
- // Exceptions should not be reported.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b2.opBatch();
- b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback_Communicator_flushBatchRequests()
- {
- @Override
- public void exception(Ice.LocalException ex)
+ {
+ //
+ // Type-safe exception - 1 connection.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback_Communicator_flushBatchRequests()
{
- cb.exception(ex);
- }
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
- @Override
- public void sent(boolean sentSynchronously)
+ {
+ //
+ // 2 connections.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b1.opBatch();
+ b2.opBatch();
+ b2.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback_Communicator_flushBatchRequests()
{
- cb.sent(sentSynchronously);
- }
- });
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.waitForBatch(1));
- }
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(4));
+ }
- {
- //
- // Exception - 2 connections - 2 failures.
- //
- // The sent callback should be invoked even if all connections fail.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b2.opBatch();
- b1.ice_getConnection().close(false);
- b2.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback_Communicator_flushBatchRequests()
- {
- @Override
- public void exception(Ice.LocalException ex)
+ {
+ //
+ // Exception - 2 connections - 1 failure.
+ //
+ // All connections should be flushed even if there are failures on some connections.
+ // Exceptions should not be reported.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b2.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback_Communicator_flushBatchRequests()
{
- cb.exception(ex);
- }
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.waitForBatch(1));
+ }
- @Override
- public void sent(boolean sentSynchronously)
+ {
+ //
+ // Exception - 2 connections - 2 failures.
+ //
+ // The sent callback should be invoked even if all connections fail.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b2.opBatch();
+ b1.ice_getConnection().close(false);
+ b2.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback_Communicator_flushBatchRequests()
{
- cb.sent(sentSynchronously);
- }
- });
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
}
+ out.println("ok");
}
- out.println("ok");
out.print("testing AsyncResult operations... ");
out.flush();
@@ -2101,10 +2108,13 @@ public class AMI
new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well.
while((r2 = p.begin_opWithPayload(seq)).sentSynchronously());
- test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() ||
- !r1.sentSynchronously() && !r1.isCompleted());
-
- test(!r2.sentSynchronously() && !r2.isCompleted());
+ if(p.ice_getConnection() != null)
+ {
+ test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() ||
+ !r1.sentSynchronously() && !r1.isCompleted());
+
+ test(!r2.sentSynchronously() && !r2.isCompleted());
+ }
}
finally
{
@@ -2163,87 +2173,93 @@ public class AMI
test(r.getProxy() == p2);
p2.end_ice_flushBatchRequests(r);
- //
- // Batch request via connection
- //
- Ice.Connection con = p.ice_getConnection();
- p2 = (TestIntfPrx)p.ice_batchOneway();
- p2.ice_ping();
- r = con.begin_flushBatchRequests();
- test(r.getConnection() == con);
- test(r.getCommunicator() == communicator);
- test(r.getProxy() == null); // Expected
- con.end_flushBatchRequests(r);
-
- //
- // Batch request via communicator
- //
- p2 = (TestIntfPrx)p.ice_batchOneway();
- p2.ice_ping();
- r = communicator.begin_flushBatchRequests();
- test(r.getConnection() == null); // Expected
- test(r.getCommunicator() == communicator);
- test(r.getProxy() == null); // Expected
- communicator.end_flushBatchRequests(r);
+ if(p.ice_getConnection() != null)
+ {
+ //
+ // Batch request via connection
+ //
+ Ice.Connection con = p.ice_getConnection();
+ p2 = (TestIntfPrx)p.ice_batchOneway();
+ p2.ice_ping();
+ r = con.begin_flushBatchRequests();
+ test(r.getConnection() == con);
+ test(r.getCommunicator() == communicator);
+ test(r.getProxy() == null); // Expected
+ con.end_flushBatchRequests(r);
+
+ //
+ // Batch request via communicator
+ //
+ p2 = (TestIntfPrx)p.ice_batchOneway();
+ p2.ice_ping();
+ r = communicator.begin_flushBatchRequests();
+ test(r.getConnection() == null); // Expected
+ test(r.getCommunicator() == communicator);
+ test(r.getProxy() == null); // Expected
+ communicator.end_flushBatchRequests(r);
+ }
}
}
out.println("ok");
-
- out.print("testing close connection with sending queue... ");
- out.flush();
- {
- byte[] seq = new byte[1024 * 10];
- new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well.
- //
- // Send multiple opWithPayload, followed by a close and followed by multiple opWithPaylod.
- // The goal is to make sure that none of the opWithPayload fail even if the server closes
- // the connection gracefully in between.
- //
- int maxQueue = 2;
- boolean done = false;
- while(!done && maxQueue < 50)
+ if(p.ice_getConnection() != null)
+ {
+ out.print("testing close connection with sending queue... ");
+ out.flush();
{
- done = true;
- p.ice_ping();
- java.util.List<Ice.AsyncResult> results = new java.util.ArrayList<Ice.AsyncResult>();
- for(int i = 0; i < maxQueue; ++i)
- {
- results.add(p.begin_opWithPayload(seq));
- }
- if(!p.begin_close(false).isSent())
+ byte[] seq = new byte[1024 * 10];
+ new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well.
+
+ //
+ // Send multiple opWithPayload, followed by a close and followed by multiple opWithPaylod.
+ // The goal is to make sure that none of the opWithPayload fail even if the server closes
+ // the connection gracefully in between.
+ //
+ int maxQueue = 2;
+ boolean done = false;
+ while(!done && maxQueue < 50)
{
- for(int i = 0; i < maxQueue; i++)
+ done = true;
+ p.ice_ping();
+ java.util.List<Ice.AsyncResult> results = new java.util.ArrayList<Ice.AsyncResult>();
+ for(int i = 0; i < maxQueue; ++i)
+ {
+ results.add(p.begin_opWithPayload(seq));
+ }
+ if(!p.begin_close(false).isSent())
{
- Ice.AsyncResult r = p.begin_opWithPayload(seq);
- results.add(r);
- if(r.isSent())
+ for(int i = 0; i < maxQueue; i++)
{
- done = false;
- maxQueue *= 2;
- break;
+ Ice.AsyncResult r = p.begin_opWithPayload(seq);
+ results.add(r);
+ if(r.isSent())
+ {
+ done = false;
+ maxQueue *= 2;
+ break;
+ }
}
}
- }
- else
- {
- maxQueue *= 2;
- done = false;
- }
- for(Ice.AsyncResult q : results)
- {
- q.waitForCompleted();
- try
+ else
{
- q.throwLocalException();
+ maxQueue *= 2;
+ done = false;
}
- catch(Ice.LocalException ex)
+ for(Ice.AsyncResult q : results)
{
- test(false);
+ q.waitForCompleted();
+ try
+ {
+ q.throwLocalException();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
}
}
}
+ out.println("ok");
}
- out.println("ok");
}
}
diff --git a/java/test/Ice/ami/Collocated.java b/java/test/Ice/ami/Collocated.java
new file mode 100644
index 00000000000..d51620a84f8
--- /dev/null
+++ b/java/test/Ice/ami/Collocated.java
@@ -0,0 +1,47 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.ami;
+
+public class Collocated extends test.Util.Application
+{
+ public int run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+
+ adapter.add(new TestI(), communicator().stringToIdentity("test"));
+ adapter.activate();
+ adapter2.add(new TestControllerI(adapter), communicator().stringToIdentity("testController"));
+ adapter2.activate();
+
+ AllTests.allTests(this);
+ return 0;
+ }
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java/test/Ice/ami/lambda/AMI.java b/java/test/Ice/ami/lambda/AMI.java
index 903be5c3f8a..b89a51ae0f5 100644
--- a/java/test/Ice/ami/lambda/AMI.java
+++ b/java/test/Ice/ami/lambda/AMI.java
@@ -126,7 +126,7 @@ public class AMI
{
called();
}
- catch(Ice.LocalException ex)
+ catch(Ice.Exception ex)
{
test(false);
}
@@ -144,7 +144,7 @@ public class AMI
{
called();
}
- catch(Ice.LocalException ex)
+ catch(Ice.Exception ex)
{
test(false);
}
@@ -162,7 +162,7 @@ public class AMI
{
called();
}
- catch(Ice.LocalException ex)
+ catch(Ice.Exception ex)
{
test(false);
}
@@ -180,7 +180,7 @@ public class AMI
{
called();
}
- catch(Ice.LocalException ex)
+ catch(Ice.Exception ex)
{
test(false);
}
@@ -198,7 +198,7 @@ public class AMI
{
called();
}
- catch(Ice.LocalException ex)
+ catch(Ice.Exception ex)
{
test(false);
}
@@ -216,7 +216,7 @@ public class AMI
{
called();
}
- catch(Ice.LocalException ex)
+ catch(Ice.Exception ex)
{
test(false);
}
@@ -324,14 +324,14 @@ public class AMI
}
public void
- ex(Ice.LocalException ex)
+ ex(Ice.Exception ex)
{
test(ex instanceof Ice.NoEndpointException);
called();
}
public void
- noEx(Ice.LocalException ex)
+ noEx(Ice.Exception ex)
{
test(false);
}
@@ -375,7 +375,7 @@ public class AMI
}
public void
- ex(Ice.LocalException ex)
+ ex(Ice.Exception ex)
{
}
@@ -412,7 +412,7 @@ public class AMI
}
public void
- exception(Ice.LocalException ex)
+ exception(Ice.Exception ex)
{
test(false);
}
@@ -457,14 +457,14 @@ public class AMI
}
test(false);
}
- catch(Ice.LocalException ex)
+ catch(Ice.Exception ex)
{
called();
}
}
public void
- exception(Ice.LocalException ex)
+ exception(Ice.Exception ex)
{
called();
}
@@ -511,7 +511,7 @@ public class AMI
}
public void
- ex(Ice.LocalException ex)
+ ex(Ice.Exception ex)
{
called();
throwEx();
@@ -562,74 +562,74 @@ public class AMI
p.begin_ice_isA("::Test::TestIntf",
(boolean r) -> cb.isA(r),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_ice_isA("::Test::TestIntf",
(boolean r) -> cb.isA(r),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_ice_ping(
() -> cb.ping(),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_ice_ping(ctx,
() -> cb.ping(),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_ice_id(
(String id) -> cb.id(id),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_ice_id(ctx,
(String id) -> cb.id(id),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_ice_ids(
(String[] ids) -> cb.ids(ids),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_ice_ids(ctx,
(String[] ids) -> cb.ids(ids),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_op(
() -> cb.op(),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_op(ctx,
() -> cb.op(),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_opWithResult(
(int r) -> cb.opWithResult(r),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_opWithResult(ctx,
(int r) -> cb.opWithResult(r),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_opWithUE(
() -> test(false),
(Ice.UserException ex) -> cb.opWithUE(ex),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
p.begin_opWithUE(ctx,
() -> test(false),
(Ice.UserException ex) -> cb.opWithUE(ex),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
out.println("ok");
@@ -642,27 +642,27 @@ public class AMI
i.begin_ice_isA("::Test::TestIntf",
(boolean r) -> test(false),
- (Ice.LocalException ex) -> cb.ex(ex));
+ (Ice.Exception ex) -> cb.ex(ex));
cb.check();
i.begin_ice_ping(
() -> test(false),
- (Ice.LocalException ex) -> cb.ex(ex));
+ (Ice.Exception ex) -> cb.ex(ex));
cb.check();
i.begin_ice_id(
(String id) -> test(false),
- (Ice.LocalException ex) -> cb.ex(ex));
+ (Ice.Exception ex) -> cb.ex(ex));
cb.check();
i.begin_ice_ids(
(String[] ids) -> test(false),
- (Ice.LocalException ex) -> cb.ex(ex));
+ (Ice.Exception ex) -> cb.ex(ex));
cb.check();
i.begin_op(
() -> test(false),
- (Ice.LocalException ex) -> cb.ex(ex));
+ (Ice.Exception ex) -> cb.ex(ex));
cb.check();
}
out.println("ok");
@@ -674,31 +674,31 @@ public class AMI
p.begin_ice_isA("",
(boolean r) -> cb.isA(r),
- (Ice.LocalException ex) -> cb.ex(ex),
+ (Ice.Exception ex) -> cb.ex(ex),
(boolean ss) -> cb.sent(ss));
cb.check();
p.begin_ice_ping(
() -> cb.ping(),
- (Ice.LocalException ex) -> cb.ex(ex),
+ (Ice.Exception ex) -> cb.ex(ex),
(boolean ss) -> cb.sent(ss));
cb.check();
p.begin_ice_id(
(String id) -> cb.id(id),
- (Ice.LocalException ex) -> cb.ex(ex),
+ (Ice.Exception ex) -> cb.ex(ex),
(boolean ss) -> cb.sent(ss));
cb.check();
p.begin_ice_ids(
(String[] ids) -> cb.ids(ids),
- (Ice.LocalException ex) -> cb.ex(ex),
+ (Ice.Exception ex) -> cb.ex(ex),
(boolean ss) -> cb.sent(ss));
cb.check();
p.begin_op(
() -> cb.op(),
- (Ice.LocalException ex) -> cb.ex(ex),
+ (Ice.Exception ex) -> cb.ex(ex),
(boolean ss) -> cb.sent(ss));
cb.check();
@@ -714,7 +714,7 @@ public class AMI
final SentCallback cb2 = new SentCallback();
r = p.begin_opWithPayload(seq,
() -> {},
- (Ice.LocalException ex) -> cb2.ex(ex),
+ (Ice.Exception ex) -> cb2.ex(ex),
(boolean ss) -> cb2.sent(ss));
cbs.add(cb2);
}
@@ -748,12 +748,12 @@ public class AMI
q.begin_op(
() -> cb.op(),
- (Ice.LocalException ex) -> cb.ex(ex));
+ (Ice.Exception ex) -> cb.ex(ex));
cb.check();
p.begin_op(
() -> {},
- (Ice.LocalException ex) -> {},
+ (Ice.Exception ex) -> {},
(boolean ss) -> cb.sent(ss));
cb.check();
}
@@ -774,7 +774,7 @@ public class AMI
final FlushCallback cb = new FlushCallback();
Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(
null,
- (Ice.LocalException ex) -> cb.exception(ex),
+ (Ice.Exception ex) -> cb.exception(ex),
(boolean sentSynchronously) -> cb.sent(sentSynchronously));
cb.check();
test(r.isSent());
@@ -782,6 +782,7 @@ public class AMI
test(p.waitForBatch(2));
}
+ if(p.ice_getConnection() != null)
{
//
// Type-safe exception.
@@ -793,7 +794,7 @@ public class AMI
final FlushExCallback cb = new FlushExCallback();
Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(
null,
- (Ice.LocalException ex) -> cb.exception(ex),
+ (Ice.Exception ex) -> cb.exception(ex),
(boolean sentSynchronously) -> cb.sent(sentSynchronously));
cb.check();
test(!r.isSent());
@@ -803,170 +804,173 @@ public class AMI
}
out.println("ok");
- out.print("testing batch requests with connection... ");
- out.flush();
+ if(p.ice_getConnection() != null)
{
+ out.print("testing batch requests with connection... ");
+ out.flush();
{
- //
- // Type-safe.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
- null,
- (Ice.LocalException ex) -> cb.exception(ex),
- (boolean sentSynchronously) -> cb.sent(sentSynchronously));
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(2));
- }
+ {
+ //
+ // Type-safe.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
+ null,
+ (Ice.Exception ex) -> cb.exception(ex),
+ (boolean sentSynchronously) -> cb.sent(sentSynchronously));
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
- {
- //
- // Type-safe exception.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.ice_getConnection().close(false);
- final FlushExCallback cb = new FlushExCallback();
- Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
- null,
- (Ice.LocalException ex) -> cb.exception(ex),
- (boolean sentSynchronously) -> cb.sent(sentSynchronously));
- cb.check();
- test(!r.isSent());
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
+ {
+ //
+ // Type-safe exception.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushExCallback cb = new FlushExCallback();
+ Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
+ null,
+ (Ice.Exception ex) -> cb.exception(ex),
+ (boolean sentSynchronously) -> cb.sent(sentSynchronously));
+ cb.check();
+ test(!r.isSent());
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
}
- }
- out.println("ok");
+ out.println("ok");
- out.print("testing batch requests with communicator... ");
- out.flush();
- {
+ out.print("testing batch requests with communicator... ");
+ out.flush();
{
- //
- // Type-safe - 1 connection.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- null,
- (Ice.LocalException ex) -> cb.exception(ex),
- (boolean sentSynchronously) -> cb.sent(sentSynchronously));
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(2));
- }
+ {
+ //
+ // Type-safe - 1 connection.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ null,
+ (Ice.Exception ex) -> cb.exception(ex),
+ (boolean sentSynchronously) -> cb.sent(sentSynchronously));
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
- {
- //
- // Type-safe exception - 1 connection.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- null,
- (Ice.LocalException ex) -> cb.exception(ex),
- (boolean sentSynchronously) -> cb.sent(sentSynchronously));
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
- }
+ {
+ //
+ // Type-safe exception - 1 connection.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ null,
+ (Ice.Exception ex) -> cb.exception(ex),
+ (boolean sentSynchronously) -> cb.sent(sentSynchronously));
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
- {
- //
- // 2 connections.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b1.opBatch();
- b2.opBatch();
- b2.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- null,
- (Ice.LocalException ex) -> cb.exception(ex),
- (boolean sentSynchronously) -> cb.sent(sentSynchronously));
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(4));
- }
+ {
+ //
+ // 2 connections.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b1.opBatch();
+ b2.opBatch();
+ b2.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ null,
+ (Ice.Exception ex) -> cb.exception(ex),
+ (boolean sentSynchronously) -> cb.sent(sentSynchronously));
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(4));
+ }
- {
- //
- // Exception - 2 connections - 1 failure.
- //
- // All connections should be flushed even if there are failures on some connections.
- // Exceptions should not be reported.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b2.opBatch();
- b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- null,
- (Ice.LocalException ex) -> cb.exception(ex),
- (boolean sentSynchronously) -> cb.sent(sentSynchronously));
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.waitForBatch(1));
- }
+ {
+ //
+ // Exception - 2 connections - 1 failure.
+ //
+ // All connections should be flushed even if there are failures on some connections.
+ // Exceptions should not be reported.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b2.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ null,
+ (Ice.Exception ex) -> cb.exception(ex),
+ (boolean sentSynchronously) -> cb.sent(sentSynchronously));
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.waitForBatch(1));
+ }
- {
- //
- // Exception - 2 connections - 2 failures.
- //
- // The sent callback should be invoked even if all connections fail.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b2.opBatch();
- b1.ice_getConnection().close(false);
- b2.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- null,
- (Ice.LocalException ex) -> cb.exception(ex),
- (boolean sentSynchronously) -> cb.sent(sentSynchronously));
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
+ {
+ //
+ // Exception - 2 connections - 2 failures.
+ //
+ // The sent callback should be invoked even if all connections fail.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway();
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b2.opBatch();
+ b1.ice_getConnection().close(false);
+ b2.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ null,
+ (Ice.Exception ex) -> cb.exception(ex),
+ (boolean sentSynchronously) -> cb.sent(sentSynchronously));
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
}
+ out.println("ok");
}
- out.println("ok");
out.print("testing null callbacks...");
try
{
IceInternal.Functional_VoidCallback response = null;
- IceInternal.Functional_GenericCallback1<Ice.LocalException> exception = null;
+ IceInternal.Functional_GenericCallback1<Ice.Exception> exception = null;
p.begin_ice_ping(response, exception);
test(false);
}
@@ -987,7 +991,7 @@ public class AMI
try
{
- p.begin_ice_ping(null, (Ice.LocalException ex) -> {});
+ p.begin_ice_ping(null, (Ice.Exception ex) -> {});
}
catch(IllegalArgumentException ex)
@@ -998,7 +1002,7 @@ public class AMI
try
{
IceInternal.Functional_BoolCallback response = null;
- IceInternal.Functional_GenericCallback1<Ice.LocalException> exception = null;
+ IceInternal.Functional_GenericCallback1<Ice.Exception> exception = null;
p.begin_ice_isA("::Test::TestIntf", response, exception);
test(false);
}
@@ -1019,7 +1023,7 @@ public class AMI
try
{
- p.begin_ice_isA("::Test::TestIntf", null, (Ice.LocalException ex) -> {});
+ p.begin_ice_isA("::Test::TestIntf", null, (Ice.Exception ex) -> {});
}
catch(IllegalArgumentException ex)
@@ -1030,7 +1034,7 @@ public class AMI
try
{
IceInternal.Functional_VoidCallback response = null;
- p.begin_opWithUE(response, null, (Ice.LocalException ex) -> {});
+ p.begin_opWithUE(response, null, (Ice.Exception ex) -> {});
test(false);
}
catch(IllegalArgumentException ex)
@@ -1057,8 +1061,8 @@ public class AMI
{
IceInternal.Functional_VoidCallback response = null;
IceInternal.Functional_GenericCallback1<Ice.UserException> userException = null;
- IceInternal.Functional_GenericCallback1<Ice.LocalException> localException = null;
- p.begin_opWithUE(response, userException, localException);
+ IceInternal.Functional_GenericCallback1<Ice.Exception> exception = null;
+ p.begin_opWithUE(response, userException, exception);
test(false);
}
catch(IllegalArgumentException ex)
diff --git a/java/test/Ice/ami/run.py b/java/test/Ice/ami/run.py
index 33fc2e8f3ac..a40df1a1bcb 100755
--- a/java/test/Ice/ami/run.py
+++ b/java/test/Ice/ami/run.py
@@ -20,4 +20,7 @@ if len(path) == 0:
sys.path.append(os.path.join(path[0], "scripts"))
import TestUtil
+print("tests with regular server.")
TestUtil.clientServerTest()
+print("tests with collocated server.")
+TestUtil.collocatedTest()
diff --git a/java/test/Ice/defaultServant/AllTests.java b/java/test/Ice/defaultServant/AllTests.java
index c2012aec31f..e68a38e42c7 100644
--- a/java/test/Ice/defaultServant/AllTests.java
+++ b/java/test/Ice/defaultServant/AllTests.java
@@ -59,7 +59,7 @@ public class AllTests
identity.name = names[idx];
MyObjectPrx prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
prx.ice_ping();
- test(prx.getName() == names[idx]);
+ test(prx.getName().equals(names[idx]));
}
identity.name = "ObjectNotExist";
@@ -163,7 +163,7 @@ public class AllTests
identity.name = names[idx];
prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
prx.ice_ping();
- test(prx.getName() == names[idx]);
+ test(prx.getName().equals(names[idx]));
}
out.println("ok");
diff --git a/java/test/Ice/defaultServant/MyObjectI.java b/java/test/Ice/defaultServant/MyObjectI.java
index 50fc10c0483..c9a0cef7e93 100644
--- a/java/test/Ice/defaultServant/MyObjectI.java
+++ b/java/test/Ice/defaultServant/MyObjectI.java
@@ -17,11 +17,11 @@ public final class MyObjectI extends _MyObjectDisp
{
String name = current.id.name;
- if(name == "ObjectNotExist")
+ if(name.equals("ObjectNotExist"))
{
throw new Ice.ObjectNotExistException();
}
- else if(name == "FacetNotExist")
+ else if(name.equals("FacetNotExist"))
{
throw new Ice.FacetNotExistException();
}
@@ -32,11 +32,11 @@ public final class MyObjectI extends _MyObjectDisp
{
String name = current.id.name;
- if(name == "ObjectNotExist")
+ if(name.equals("ObjectNotExist"))
{
throw new Ice.ObjectNotExistException();
}
- else if(name == "FacetNotExist")
+ else if(name.equals("FacetNotExist"))
{
throw new Ice.FacetNotExistException();
}
diff --git a/java/test/Ice/exceptions/AllTests.java b/java/test/Ice/exceptions/AllTests.java
index 6ce749618d3..0c0256b9bb7 100644
--- a/java/test/Ice/exceptions/AllTests.java
+++ b/java/test/Ice/exceptions/AllTests.java
@@ -679,6 +679,9 @@ public class AllTests
catch(Ice.ConnectionLostException ex)
{
}
+ catch(Ice.UnknownException ex)
+ {
+ }
catch(Throwable ex)
{
ex.printStackTrace();
@@ -1318,6 +1321,9 @@ public class AllTests
catch(Ice.ConnectionLostException ex)
{
}
+ catch(Ice.UnknownException ex)
+ {
+ }
catch(Throwable ex)
{
ex.printStackTrace();
@@ -1370,7 +1376,7 @@ public class AllTests
}
public static ThrowerPrx
- allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ allTests(Ice.Communicator communicator, PrintWriter out)
{
{
out.print("testing object adapter registration exceptions... ");
@@ -1662,8 +1668,6 @@ public class AllTests
if(thrower.supportsUndeclaredExceptions())
{
- test(!collocated);
-
out.print("catching unknown user exception... ");
out.flush();
@@ -1724,11 +1728,9 @@ public class AllTests
}
catch(Ice.ConnectionLostException ex)
{
- test(!collocated);
}
catch(Ice.UnknownException ex)
{
- test(collocated);
}
catch(Throwable ex)
{
@@ -1745,7 +1747,7 @@ public class AllTests
try
{
thrower.throwMemoryLimitException(null);
- test(collocated);
+ test(false);
}
catch(Ice.UnknownLocalException ex)
{
@@ -1759,7 +1761,7 @@ public class AllTests
try
{
thrower.throwMemoryLimitException(new byte[20 * 1024]); // 20KB
- test(collocated);
+ test(false);
}
catch(Ice.MemoryLimitException ex)
{
@@ -1770,22 +1772,19 @@ public class AllTests
test(false);
}
- if(!collocated)
+ try
{
- try
- {
- thrower.end_throwMemoryLimitException(
- thrower.begin_throwMemoryLimitException(new byte[20 * 1024])); // 20KB
- test(false);
- }
- catch(Ice.MemoryLimitException ex)
- {
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
+ thrower.end_throwMemoryLimitException(
+ thrower.begin_throwMemoryLimitException(new byte[20 * 1024])); // 20KB
+ test(false);
+ }
+ catch(Ice.MemoryLimitException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
}
}
out.println("ok");
@@ -1951,340 +1950,337 @@ public class AllTests
out.println("ok");
- if(!collocated)
+ out.print("catching exact types with AMI... ");
+ out.flush();
+
{
- out.print("catching exact types with AMI... ");
- out.flush();
+ AMI_Thrower_throwAasAI cb = new AMI_Thrower_throwAasAI();
+ thrower.throwAasA_async(cb, 1);
+ cb.check();
+ // Let's check if we can reuse the same callback object for another call.
+ thrower.throwAasA_async(cb, 1);
+ cb.check();
+ }
- {
- AMI_Thrower_throwAasAI cb = new AMI_Thrower_throwAasAI();
- thrower.throwAasA_async(cb, 1);
- cb.check();
- // Let's check if we can reuse the same callback object for another call.
- thrower.throwAasA_async(cb, 1);
- cb.check();
- }
+ {
+ AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI();
+ thrower.throwAorDasAorD_async(cb, 1);
+ cb.check();
+ }
- {
- AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI();
- thrower.throwAorDasAorD_async(cb, 1);
- cb.check();
- }
+ {
+ AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI();
+ thrower.throwAorDasAorD_async(cb, -1);
+ cb.check();
+ }
- {
- AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI();
- thrower.throwAorDasAorD_async(cb, -1);
- cb.check();
- }
+ {
+ AMI_Thrower_throwBasBI cb = new AMI_Thrower_throwBasBI();
+ thrower.throwBasB_async(cb, 1, 2);
+ cb.check();
+ }
- {
- AMI_Thrower_throwBasBI cb = new AMI_Thrower_throwBasBI();
- thrower.throwBasB_async(cb, 1, 2);
- cb.check();
- }
+ {
+ AMI_Thrower_throwCasCI cb = new AMI_Thrower_throwCasCI();
+ thrower.throwCasC_async(cb, 1, 2, 3);
+ cb.check();
+ // Let's check if we can reuse the same callback object for another call.
+ thrower.throwCasC_async(cb, 1, 2, 3);
+ cb.check();
+ }
- {
- AMI_Thrower_throwCasCI cb = new AMI_Thrower_throwCasCI();
- thrower.throwCasC_async(cb, 1, 2, 3);
- cb.check();
- // Let's check if we can reuse the same callback object for another call.
- thrower.throwCasC_async(cb, 1, 2, 3);
- cb.check();
- }
+ out.println("ok");
- out.println("ok");
+ out.print("catching derived types with AMI... ");
+ out.flush();
+
+ {
+ AMI_Thrower_throwBasAI cb = new AMI_Thrower_throwBasAI();
+ thrower.throwBasA_async(cb, 1, 2);
+ cb.check();
+ }
+
+ {
+ AMI_Thrower_throwCasAI cb = new AMI_Thrower_throwCasAI();
+ thrower.throwCasA_async(cb, 1, 2, 3);
+ cb.check();
+ }
+
+ {
+ AMI_Thrower_throwCasBI cb = new AMI_Thrower_throwCasBI();
+ thrower.throwCasB_async(cb, 1, 2, 3);
+ cb.check();
+ }
- out.print("catching derived types with AMI... ");
+ out.println("ok");
+
+ if(thrower.supportsUndeclaredExceptions())
+ {
+ out.print("catching unknown user exception with AMI... ");
out.flush();
{
- AMI_Thrower_throwBasAI cb = new AMI_Thrower_throwBasAI();
- thrower.throwBasA_async(cb, 1, 2);
+ AMI_Thrower_throwUndeclaredAI cb = new AMI_Thrower_throwUndeclaredAI();
+ thrower.throwUndeclaredA_async(cb, 1);
cb.check();
}
{
- AMI_Thrower_throwCasAI cb = new AMI_Thrower_throwCasAI();
- thrower.throwCasA_async(cb, 1, 2, 3);
+ AMI_Thrower_throwUndeclaredBI cb = new AMI_Thrower_throwUndeclaredBI();
+ thrower.throwUndeclaredB_async(cb, 1, 2);
cb.check();
}
{
- AMI_Thrower_throwCasBI cb = new AMI_Thrower_throwCasBI();
- thrower.throwCasB_async(cb, 1, 2, 3);
+ AMI_Thrower_throwUndeclaredCI cb = new AMI_Thrower_throwUndeclaredCI();
+ thrower.throwUndeclaredC_async(cb, 1, 2, 3);
cb.check();
}
out.println("ok");
+ }
- if(thrower.supportsUndeclaredExceptions())
- {
- out.print("catching unknown user exception with AMI... ");
- out.flush();
-
- {
- AMI_Thrower_throwUndeclaredAI cb = new AMI_Thrower_throwUndeclaredAI();
- thrower.throwUndeclaredA_async(cb, 1);
- cb.check();
- }
+ if(thrower.supportsAssertException())
+ {
+ out.print("testing assert in the server with AMI... ");
+ out.flush();
- {
- AMI_Thrower_throwUndeclaredBI cb = new AMI_Thrower_throwUndeclaredBI();
- thrower.throwUndeclaredB_async(cb, 1, 2);
- cb.check();
- }
+ AMI_Thrower_throwAssertExceptionI cb = new AMI_Thrower_throwAssertExceptionI();
+ thrower.throwAssertException_async(cb);
+ cb.check();
- {
- AMI_Thrower_throwUndeclaredCI cb = new AMI_Thrower_throwUndeclaredCI();
- thrower.throwUndeclaredC_async(cb, 1, 2, 3);
- cb.check();
- }
-
- out.println("ok");
- }
+ out.println("ok");
+ }
- if(thrower.supportsAssertException())
- {
- out.print("testing assert in the server with AMI... ");
- out.flush();
+ out.print("catching object not exist exception with AMI... ");
+ out.flush();
- AMI_Thrower_throwAssertExceptionI cb = new AMI_Thrower_throwAssertExceptionI();
- thrower.throwAssertException_async(cb);
- cb.check();
+ {
+ Ice.Identity id = communicator.stringToIdentity("does not exist");
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id));
+ AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator);
+ thrower2.throwAasA_async(cb, 1);
+ cb.check();
+ }
- out.println("ok");
- }
+ out.println("ok");
- out.print("catching object not exist exception with AMI... ");
- out.flush();
+ out.print("catching facet not exist exception with AMI... ");
+ out.flush();
+ try
+ {
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet");
{
- Ice.Identity id = communicator.stringToIdentity("does not exist");
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id));
- AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator);
+ AMI_Thrower_throwAasAFacetNotExistI cb = new AMI_Thrower_throwAasAFacetNotExistI();
thrower2.throwAasA_async(cb, 1);
cb.check();
}
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
- out.println("ok");
+ out.println("ok");
- out.print("catching facet not exist exception with AMI... ");
- out.flush();
+ out.print("catching operation not exist exception with AMI... ");
+ out.flush();
- try
- {
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet");
- {
- AMI_Thrower_throwAasAFacetNotExistI cb = new AMI_Thrower_throwAasAFacetNotExistI();
- thrower2.throwAasA_async(cb, 1);
- cb.check();
- }
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
+ {
+ AMI_WrongOperation_noSuchOperationI cb = new AMI_WrongOperation_noSuchOperationI();
+ WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower);
+ thrower2.noSuchOperation_async(cb);
+ cb.check();
+ }
- out.println("ok");
+ out.println("ok");
- out.print("catching operation not exist exception with AMI... ");
- out.flush();
+ out.print("catching unknown local exception with AMI... ");
+ out.flush();
- {
- AMI_WrongOperation_noSuchOperationI cb = new AMI_WrongOperation_noSuchOperationI();
- WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower);
- thrower2.noSuchOperation_async(cb);
- cb.check();
- }
+ {
+ AMI_Thrower_throwLocalExceptionI cb = new AMI_Thrower_throwLocalExceptionI();
+ thrower.throwLocalException_async(cb);
+ cb.check();
+ }
- out.println("ok");
+ out.println("ok");
- out.print("catching unknown local exception with AMI... ");
- out.flush();
+ out.print("catching unknown non-Ice exception with AMI... ");
+ out.flush();
- {
- AMI_Thrower_throwLocalExceptionI cb = new AMI_Thrower_throwLocalExceptionI();
- thrower.throwLocalException_async(cb);
- cb.check();
- }
+ {
+ AMI_Thrower_throwNonIceExceptionI cb = new AMI_Thrower_throwNonIceExceptionI();
+ thrower.throwNonIceException_async(cb);
+ cb.check();
+ }
- out.println("ok");
+ out.println("ok");
- out.print("catching unknown non-Ice exception with AMI... ");
- out.flush();
+ out.print("catching exact types with new AMI mapping... ");
+ out.flush();
- {
- AMI_Thrower_throwNonIceExceptionI cb = new AMI_Thrower_throwNonIceExceptionI();
- thrower.throwNonIceException_async(cb);
- cb.check();
- }
+ {
+ Callback_Thrower_throwAasAI cb = new Callback_Thrower_throwAasAI();
+ thrower.begin_throwAasA(1, cb);
+ cb.check();
+ }
- out.println("ok");
+ {
+ Callback_Thrower_throwAorDasAorDI cb = new Callback_Thrower_throwAorDasAorDI();
+ thrower.begin_throwAorDasAorD(1, cb);
+ cb.check();
+ }
- out.print("catching exact types with new AMI mapping... ");
- out.flush();
+ {
+ Callback_Thrower_throwAorDasAorDI cb = new Callback_Thrower_throwAorDasAorDI();
+ thrower.begin_throwAorDasAorD(-1, cb);
+ cb.check();
+ }
- {
- Callback_Thrower_throwAasAI cb = new Callback_Thrower_throwAasAI();
- thrower.begin_throwAasA(1, cb);
- cb.check();
- }
+ {
+ Callback_Thrower_throwBasBI cb = new Callback_Thrower_throwBasBI();
+ thrower.begin_throwBasB(1, 2, cb);
+ cb.check();
+ }
- {
- Callback_Thrower_throwAorDasAorDI cb = new Callback_Thrower_throwAorDasAorDI();
- thrower.begin_throwAorDasAorD(1, cb);
- cb.check();
- }
+ {
+ Callback_Thrower_throwCasCI cb = new Callback_Thrower_throwCasCI();
+ thrower.begin_throwCasC(1, 2, 3, cb);
+ cb.check();
+ }
- {
- Callback_Thrower_throwAorDasAorDI cb = new Callback_Thrower_throwAorDasAorDI();
- thrower.begin_throwAorDasAorD(-1, cb);
- cb.check();
- }
+ out.println("ok");
- {
- Callback_Thrower_throwBasBI cb = new Callback_Thrower_throwBasBI();
- thrower.begin_throwBasB(1, 2, cb);
- cb.check();
- }
+ out.print("catching derived types with new AMI mapping... ");
+ out.flush();
- {
- Callback_Thrower_throwCasCI cb = new Callback_Thrower_throwCasCI();
- thrower.begin_throwCasC(1, 2, 3, cb);
- cb.check();
- }
+ {
+ Callback_Thrower_throwBasAI cb = new Callback_Thrower_throwBasAI();
+ thrower.begin_throwBasA(1, 2, cb);
+ cb.check();
+ }
- out.println("ok");
+ {
+ Callback_Thrower_throwCasAI cb = new Callback_Thrower_throwCasAI();
+ thrower.begin_throwCasA(1, 2, 3, cb);
+ cb.check();
+ }
+
+ {
+ Callback_Thrower_throwCasBI cb = new Callback_Thrower_throwCasBI();
+ thrower.begin_throwCasB(1, 2, 3, cb);
+ cb.check();
+ }
+
+ out.println("ok");
- out.print("catching derived types with new AMI mapping... ");
+ if(thrower.supportsUndeclaredExceptions())
+ {
+ out.print("catching unknown user exception with new AMI mapping... ");
out.flush();
{
- Callback_Thrower_throwBasAI cb = new Callback_Thrower_throwBasAI();
- thrower.begin_throwBasA(1, 2, cb);
+ Callback_Thrower_throwUndeclaredAI cb = new Callback_Thrower_throwUndeclaredAI();
+ thrower.begin_throwUndeclaredA(1, cb);
cb.check();
}
{
- Callback_Thrower_throwCasAI cb = new Callback_Thrower_throwCasAI();
- thrower.begin_throwCasA(1, 2, 3, cb);
+ Callback_Thrower_throwUndeclaredBI cb = new Callback_Thrower_throwUndeclaredBI();
+ thrower.begin_throwUndeclaredB(1, 2, cb);
cb.check();
}
{
- Callback_Thrower_throwCasBI cb = new Callback_Thrower_throwCasBI();
- thrower.begin_throwCasB(1, 2, 3, cb);
+ Callback_Thrower_throwUndeclaredCI cb = new Callback_Thrower_throwUndeclaredCI();
+ thrower.begin_throwUndeclaredC(1, 2, 3, cb);
cb.check();
}
out.println("ok");
+ }
- if(thrower.supportsUndeclaredExceptions())
- {
- out.print("catching unknown user exception with new AMI mapping... ");
- out.flush();
-
- {
- Callback_Thrower_throwUndeclaredAI cb = new Callback_Thrower_throwUndeclaredAI();
- thrower.begin_throwUndeclaredA(1, cb);
- cb.check();
- }
-
- {
- Callback_Thrower_throwUndeclaredBI cb = new Callback_Thrower_throwUndeclaredBI();
- thrower.begin_throwUndeclaredB(1, 2, cb);
- cb.check();
- }
-
- {
- Callback_Thrower_throwUndeclaredCI cb = new Callback_Thrower_throwUndeclaredCI();
- thrower.begin_throwUndeclaredC(1, 2, 3, cb);
- cb.check();
- }
-
- out.println("ok");
- }
-
- out.print("catching object not exist exception with new AMI mapping... ");
- out.flush();
-
- {
- Ice.Identity id = communicator.stringToIdentity("does not exist");
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id));
- AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator);
- thrower2.begin_throwAasA(1, cb);
- cb.check();
- }
+ out.print("catching object not exist exception with new AMI mapping... ");
+ out.flush();
- out.println("ok");
+ {
+ Ice.Identity id = communicator.stringToIdentity("does not exist");
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id));
+ AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator);
+ thrower2.begin_throwAasA(1, cb);
+ cb.check();
+ }
- out.print("catching facet not exist exception with new AMI mapping... ");
- out.flush();
+ out.println("ok");
- {
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet");
- Callback_Thrower_throwAasAFacetNotExistI cb = new Callback_Thrower_throwAasAFacetNotExistI();
- thrower2.begin_throwAasA(1, cb);
- cb.check();
- }
+ out.print("catching facet not exist exception with new AMI mapping... ");
+ out.flush();
- out.println("ok");
+ {
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet");
+ Callback_Thrower_throwAasAFacetNotExistI cb = new Callback_Thrower_throwAasAFacetNotExistI();
+ thrower2.begin_throwAasA(1, cb);
+ cb.check();
+ }
- out.print("catching operation not exist exception with new AMI mapping... ");
- out.flush();
+ out.println("ok");
- {
- Callback_WrongOperation_noSuchOperationI cb = new Callback_WrongOperation_noSuchOperationI();
- WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower);
- thrower2.begin_noSuchOperation(cb);
- cb.check();
- }
+ out.print("catching operation not exist exception with new AMI mapping... ");
+ out.flush();
- out.println("ok");
+ {
+ Callback_WrongOperation_noSuchOperationI cb = new Callback_WrongOperation_noSuchOperationI();
+ WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower);
+ thrower2.begin_noSuchOperation(cb);
+ cb.check();
+ }
- out.print("catching unknown local exception with new AMI mapping... ");
- out.flush();
+ out.println("ok");
- {
- Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI();
- thrower.begin_throwLocalException(cb);
- cb.check();
- }
+ out.print("catching unknown local exception with new AMI mapping... ");
+ out.flush();
- {
- final Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI();
- thrower.begin_throwLocalExceptionIdempotent(new Callback_Thrower_throwLocalExceptionIdempotent()
- {
- @Override
- public void response()
- {
- cb.response();
- }
+ {
+ Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI();
+ thrower.begin_throwLocalException(cb);
+ cb.check();
+ }
- @Override
- public void exception(Ice.LocalException exc)
- {
- cb.exception(exc);
- }
- });
- cb.check();
- }
+ {
+ final Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI();
+ thrower.begin_throwLocalExceptionIdempotent(new Callback_Thrower_throwLocalExceptionIdempotent()
+ {
+ @Override
+ public void response()
+ {
+ cb.response();
+ }
- out.println("ok");
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ cb.exception(exc);
+ }
+ });
+ cb.check();
+ }
- out.print("catching unknown non-Ice exception with new AMI mapping... ");
- out.flush();
+ out.println("ok");
- {
- Callback_Thrower_throwNonIceExceptionI cb = new Callback_Thrower_throwNonIceExceptionI();
- thrower.begin_throwNonIceException(cb);
- cb.check();
- }
+ out.print("catching unknown non-Ice exception with new AMI mapping... ");
+ out.flush();
- out.println("ok");
+ {
+ Callback_Thrower_throwNonIceExceptionI cb = new Callback_Thrower_throwNonIceExceptionI();
+ thrower.begin_throwNonIceException(cb);
+ cb.check();
}
+ out.println("ok");
+
return thrower;
}
}
diff --git a/java/test/Ice/exceptions/Client.java b/java/test/Ice/exceptions/Client.java
index 677274185e0..1e17f5433a6 100644
--- a/java/test/Ice/exceptions/Client.java
+++ b/java/test/Ice/exceptions/Client.java
@@ -16,7 +16,7 @@ public class Client extends test.Util.Application
public int run(String[] args)
{
Ice.Communicator communicator = communicator();
- ThrowerPrx thrower = AllTests.allTests(communicator, false, getWriter());
+ ThrowerPrx thrower = AllTests.allTests(communicator, getWriter());
thrower.shutdown();
return 0;
}
diff --git a/java/test/Ice/exceptions/Collocated.java b/java/test/Ice/exceptions/Collocated.java
index e825cc19eaf..05ddb1c1be1 100644
--- a/java/test/Ice/exceptions/Collocated.java
+++ b/java/test/Ice/exceptions/Collocated.java
@@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application
Ice.Object object = new ThrowerI();
adapter.add(object, communicator.stringToIdentity("thrower"));
- AllTests.allTests(communicator, true, getWriter());
+ AllTests.allTests(communicator, getWriter());
return 0;
}
@@ -27,8 +27,10 @@ public class Collocated extends test.Util.Application
protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
{
Ice.InitializationData initData = new Ice.InitializationData();
+ initData.logger = new DummyLogger();
initData.properties = Ice.Util.createProperties(argsH);
initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
return initData;
}
diff --git a/java/test/Ice/invoke/lambda/AllTests.java b/java/test/Ice/invoke/lambda/AllTests.java
index 3ce788b2e65..5b7764615a3 100644
--- a/java/test/Ice/invoke/lambda/AllTests.java
+++ b/java/test/Ice/invoke/lambda/AllTests.java
@@ -60,14 +60,13 @@ public class AllTests
private boolean _called;
}
- private static class Callback_Object_opStringI extends Ice.Callback_Object_ice_invoke
+ private static class Callback_Object_opStringI
{
public Callback_Object_opStringI(Ice.Communicator communicator)
{
_communicator = communicator;
}
- @Override
public void response(boolean ok, byte[] outEncaps)
{
if(ok)
@@ -87,12 +86,15 @@ public class AllTests
}
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
+ public void sent(boolean sent)
+ {
+ }
+
public void check()
{
callback.check();
@@ -102,14 +104,13 @@ public class AllTests
private Callback callback = new Callback();
}
- private static class Callback_Object_opExceptionI extends Ice.Callback_Object_ice_invoke
+ private static class Callback_Object_opExceptionI
{
public Callback_Object_opExceptionI(Ice.Communicator communicator)
{
_communicator = communicator;
}
- @Override
public void response(boolean ok, byte[] outEncaps)
{
if(ok)
@@ -136,8 +137,7 @@ public class AllTests
}
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -147,6 +147,10 @@ public class AllTests
callback.check();
}
+ public void sent(boolean sent)
+ {
+ }
+
private Ice.Communicator _communicator;
private Callback callback = new Callback();
}
@@ -173,7 +177,7 @@ public class AllTests
Callback_Object_opStringI cb2 = new Callback_Object_opStringI(communicator);
cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inEncaps,
(boolean ret, byte[] outParams) -> cb2.response(ret, outParams),
- (Ice.LocalException ex) -> cb2.exception(ex),
+ (Ice.Exception ex) -> cb2.exception(ex),
(boolean sent) -> cb2.sent(sent));
cb2.check();
}
@@ -183,7 +187,7 @@ public class AllTests
Callback_Object_opExceptionI cb2 = new Callback_Object_opExceptionI(communicator);
cl.begin_ice_invoke("opException", Ice.OperationMode.Normal, null,
(boolean ret, byte[] outParams) -> cb2.response(ret, outParams),
- (Ice.LocalException ex) -> cb2.exception(ex),
+ (Ice.Exception ex) -> cb2.exception(ex),
(boolean sent) -> cb2.sent(sent));
cb2.check();
}
diff --git a/java/test/Ice/location/AllTests.java b/java/test/Ice/location/AllTests.java
index b57cf5d1dc8..636376a0253 100644
--- a/java/test/Ice/location/AllTests.java
+++ b/java/test/Ice/location/AllTests.java
@@ -611,6 +611,7 @@ public class AllTests
out.flush();
hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello"));
obj.migrateHello();
+ hello.ice_getConnection().close(false);
hello.sayHello();
obj.migrateHello();
hello.sayHello();
@@ -678,18 +679,12 @@ public class AllTests
registry.addObject(adapter.add(new HelloI(), id));
adapter.activate();
- try
- {
- // Note the quotes are necessary here due to ":" in the
- // java generated UUID.
- HelloPrx helloPrx = HelloPrxHelper.checkedCast(
- communicator.stringToProxy("\"" + communicator.identityToString(id) + "\""));
- Ice.Connection connection = helloPrx.ice_getConnection();
- test(false);
- }
- catch(Ice.CollocationOptimizationException ex)
- {
- }
+ // Note the quotes are necessary here due to ":" in the
+ // java generated UUID.
+ HelloPrx helloPrx = HelloPrxHelper.checkedCast(
+ communicator.stringToProxy("\"" + communicator.identityToString(id) + "\""));
+ test(helloPrx.ice_getConnection() == null);
+
adapter.deactivate();
out.println("ok");
diff --git a/java/test/Ice/metrics/AllTests.java b/java/test/Ice/metrics/AllTests.java
index 8af9eba4b6b..796b650cad3 100644
--- a/java/test/Ice/metrics/AllTests.java
+++ b/java/test/Ice/metrics/AllTests.java
@@ -404,7 +404,7 @@ public class AllTests
out.print("testing metrics admin facet checkedCast... ");
out.flush();
- Ice.ObjectPrx admin = communicator.getAdmin().ice_collocationOptimized(false);
+ Ice.ObjectPrx admin = communicator.getAdmin();
Ice.PropertiesAdminPrx clientProps = Ice.PropertiesAdminPrxHelper.checkedCast(admin, "Properties");
IceMX.MetricsAdminPrx clientMetrics = IceMX.MetricsAdminPrxHelper.checkedCast(admin, "Metrics");
test(clientProps != null && clientMetrics != null);
diff --git a/java/test/Ice/metrics/InvocationObserverI.java b/java/test/Ice/metrics/InvocationObserverI.java
index 015dc75cc3b..2eee2947704 100644
--- a/java/test/Ice/metrics/InvocationObserverI.java
+++ b/java/test/Ice/metrics/InvocationObserverI.java
@@ -46,6 +46,17 @@ class InvocationObserverI extends ObserverI implements Ice.Instrumentation.Invoc
return remoteObserver;
}
+ public synchronized Ice.Instrumentation.RemoteObserver
+ getCollocatedObserver(int a, int b)
+ {
+ if(remoteObserver == null)
+ {
+ remoteObserver = new RemoteObserverI();
+ remoteObserver.reset();
+ }
+ return remoteObserver;
+ }
+
int userExceptionCount;
int retriedCount;
diff --git a/java/test/Ice/objects/AllTests.java b/java/test/Ice/objects/AllTests.java
index 54907b2f1ca..68eb23ef4e5 100644
--- a/java/test/Ice/objects/AllTests.java
+++ b/java/test/Ice/objects/AllTests.java
@@ -44,7 +44,7 @@ public class AllTests
}
public static InitialPrx
- allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ allTests(Ice.Communicator communicator, PrintWriter out)
{
out.print("testing stringToProxy... ");
out.flush();
@@ -99,15 +99,13 @@ public class AllTests
test(((B)b1.theA).theB == b1);
test(((B)b1.theA).theC instanceof C);
test(((C)(((B)b1.theA).theC)).theB == b1.theA);
- if(!collocated)
- {
- test(b1.preMarshalInvoked);
- test(b1.postUnmarshalInvoked(null));
- test(b1.theA.preMarshalInvoked);
- test(b1.theA.postUnmarshalInvoked(null));
- test(((B)b1.theA).theC.preMarshalInvoked);
- test(((B)b1.theA).theC.postUnmarshalInvoked(null));
- }
+ test(b1.preMarshalInvoked);
+ test(b1.postUnmarshalInvoked(null));
+ test(b1.theA.preMarshalInvoked);
+ test(b1.theA.postUnmarshalInvoked(null));
+ test(((B)b1.theA).theC.preMarshalInvoked);
+ test(((B)b1.theA).theC.postUnmarshalInvoked(null));
+
// More tests possible for b2 and d, but I think this is already
// sufficient.
test(b2.theA == b2);
@@ -149,17 +147,15 @@ public class AllTests
test(d.theA == b1);
test(d.theB == b2);
test(d.theC == null);
- if(!collocated)
- {
- test(d.preMarshalInvoked);
- test(d.postUnmarshalInvoked(null));
- test(d.theA.preMarshalInvoked);
- test(d.theA.postUnmarshalInvoked(null));
- test(d.theB.preMarshalInvoked);
- test(d.theB.postUnmarshalInvoked(null));
- test(d.theB.theC.preMarshalInvoked);
- test(d.theB.theC.postUnmarshalInvoked(null));
- }
+ test(d.preMarshalInvoked);
+ test(d.postUnmarshalInvoked(null));
+ test(d.theA.preMarshalInvoked);
+ test(d.theA.postUnmarshalInvoked(null));
+ test(d.theB.preMarshalInvoked);
+ test(d.theB.postUnmarshalInvoked(null));
+ test(d.theB.theC.preMarshalInvoked);
+ test(d.theB.theC.postUnmarshalInvoked(null));
+
out.println("ok");
out.print("testing protected members... ");
@@ -236,32 +232,29 @@ public class AllTests
}
out.println("ok");
- if(!collocated)
+ out.print("testing UnexpectedObjectException...");
+ out.flush();
+ ref = "uoet:default -p 12010";
+ base = communicator.stringToProxy(ref);
+ test(base != null);
+ UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(base);
+ test(uoet != null);
+ try
{
- out.print("testing UnexpectedObjectException...");
- out.flush();
- ref = "uoet:default -p 12010";
- base = communicator.stringToProxy(ref);
- test(base != null);
- UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(base);
- test(uoet != null);
- try
- {
- uoet.op();
- test(false);
- }
- catch(Ice.UnexpectedObjectException ex)
- {
- test(ex.type.equals("::Test::AlsoEmpty"));
- test(ex.expectedType.equals("::Test::Empty"));
- }
- catch(java.lang.Exception ex)
- {
- out.println(ex);
- test(false);
- }
- out.println("ok");
+ uoet.op();
+ test(false);
+ }
+ catch(Ice.UnexpectedObjectException ex)
+ {
+ test(ex.type.equals("::Test::AlsoEmpty"));
+ test(ex.expectedType.equals("::Test::Empty"));
}
+ catch(java.lang.Exception ex)
+ {
+ out.println(ex);
+ test(false);
+ }
+ out.println("ok");
return initial;
}
diff --git a/java/test/Ice/objects/Client.java b/java/test/Ice/objects/Client.java
index 88abae70460..a7f29457ed1 100644
--- a/java/test/Ice/objects/Client.java
+++ b/java/test/Ice/objects/Client.java
@@ -73,7 +73,7 @@ public class Client extends test.Util.Application
communicator.addObjectFactory(factory, "::Test::J");
communicator.addObjectFactory(factory, "::Test::H");
- InitialPrx initial = AllTests.allTests(communicator, false, getWriter());
+ InitialPrx initial = AllTests.allTests(communicator, getWriter());
initial.shutdown();
return 0;
}
diff --git a/java/test/Ice/objects/Collocated.java b/java/test/Ice/objects/Collocated.java
index e118a0af191..b5a09a1475a 100644
--- a/java/test/Ice/objects/Collocated.java
+++ b/java/test/Ice/objects/Collocated.java
@@ -13,14 +13,73 @@ import test.Ice.objects.Test.Initial;
public class Collocated extends test.Util.Application
{
+ private static class MyObjectFactory implements Ice.ObjectFactory
+ {
+ public Ice.Object create(String type)
+ {
+ if(type.equals("::Test::B"))
+ {
+ return new BI();
+ }
+ else if(type.equals("::Test::C"))
+ {
+ return new CI();
+ }
+ else if(type.equals("::Test::D"))
+ {
+ return new DI();
+ }
+ else if(type.equals("::Test::E"))
+ {
+ return new EI();
+ }
+ else if(type.equals("::Test::F"))
+ {
+ return new FI();
+ }
+ else if(type.equals("::Test::I"))
+ {
+ return new II();
+ }
+ else if(type.equals("::Test::J"))
+ {
+ return new JI();
+ }
+ else if(type.equals("::Test::H"))
+ {
+ return new HI();
+ }
+
+ assert (false); // Should never be reached
+ return null;
+ }
+
+ public void destroy()
+ {
+ // Nothing to do
+ }
+ }
+
public int run(String[] args)
{
Ice.Communicator communicator = communicator();
+ Ice.ObjectFactory factory = new MyObjectFactory();
+ communicator.addObjectFactory(factory, "::Test::B");
+ communicator.addObjectFactory(factory, "::Test::C");
+ communicator.addObjectFactory(factory, "::Test::D");
+ communicator.addObjectFactory(factory, "::Test::E");
+ communicator.addObjectFactory(factory, "::Test::F");
+ communicator.addObjectFactory(factory, "::Test::I");
+ communicator.addObjectFactory(factory, "::Test::J");
+ communicator.addObjectFactory(factory, "::Test::H");
+
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Initial initial = new InitialI(adapter);
adapter.add(initial, communicator.stringToIdentity("initial"));
- AllTests.allTests(communicator, true, getWriter());
+ UnexpectedObjectExceptionTestI object = new UnexpectedObjectExceptionTestI();
+ adapter.add(object, communicator.stringToIdentity("uoet"));
+ AllTests.allTests(communicator, getWriter());
// We must call shutdown even in the collocated case for cyclic
// dependency cleanup
initial.shutdown();
diff --git a/java/test/Ice/operations/AllTests.java b/java/test/Ice/operations/AllTests.java
index da960e6e5f8..a22474bbfd6 100644
--- a/java/test/Ice/operations/AllTests.java
+++ b/java/test/Ice/operations/AllTests.java
@@ -18,7 +18,7 @@ import test.Ice.operations.Test.MyDerivedClassPrxHelper;
public class AllTests
{
public static MyClassPrx
- allTests(test.Util.Application app, boolean collocated, PrintWriter out)
+ allTests(test.Util.Application app, PrintWriter out)
{
Ice.Communicator communicator = app.communicator();
String ref = "test:default -p 12010";
@@ -38,96 +38,95 @@ public class AllTests
Oneways.oneways(app, cl);
out.println("ok");
- if(!collocated)
+ out.print("testing twoway operations with AMI... ");
+ out.flush();
+ TwowaysAMI.twowaysAMI(app, cl);
+ TwowaysAMI.twowaysAMI(app, derived);
+ out.println("ok");
+
+ out.print("testing twoway operations with new AMI mapping... ");
+ out.flush();
+ TwowaysNewAMI.twowaysNewAMI(app, cl);
+ TwowaysNewAMI.twowaysNewAMI(app, derived);
+ out.println("ok");
+
+ //
+ // Use reflection to load TwowaysLambdaAMI as that is only supported with Java >= 1.8
+ //
+ try
{
- out.print("testing twoway operations with AMI... ");
- out.flush();
- TwowaysAMI.twowaysAMI(app, cl);
- TwowaysAMI.twowaysAMI(app, derived);
- out.println("ok");
-
- out.print("testing twoway operations with new AMI mapping... ");
- out.flush();
- TwowaysNewAMI.twowaysNewAMI(app, cl);
- TwowaysNewAMI.twowaysNewAMI(app, derived);
- out.println("ok");
-
- //
- // Use reflection to load TwowaysLambdaAMI as that is only supported with Java >= 1.8
- //
- try
- {
- Class<?> cls = IceInternal.Util.findClass("test.Ice.operations.lambda.TwowaysLambdaAMI", null);
- if(cls != null)
- {
- java.lang.reflect.Method twowaysLambdaAMI = cls.getDeclaredMethod("twowaysLambdaAMI",
- new Class<?>[]{test.Util.Application.class, MyClassPrx.class});
- out.print("testing twoway operations with lambda AMI mapping... ");
- out.flush();
- twowaysLambdaAMI.invoke(null, app, cl);
- twowaysLambdaAMI.invoke(null, app, derived);
- out.println("ok");
- }
- }
- catch(java.lang.NoSuchMethodException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.IllegalAccessException ex)
+ Class<?> cls = IceInternal.Util.findClass("test.Ice.operations.lambda.TwowaysLambdaAMI", null);
+ if(cls != null)
{
- throw new RuntimeException(ex);
- }
- catch(java.lang.reflect.InvocationTargetException ex)
- {
- throw new RuntimeException(ex);
+ java.lang.reflect.Method twowaysLambdaAMI =
+ cls.getDeclaredMethod("twowaysLambdaAMI",
+ new Class<?>[]{test.Util.Application.class, MyClassPrx.class});
+ out.print("testing twoway operations with lambda AMI mapping... ");
+ out.flush();
+ twowaysLambdaAMI.invoke(null, app, cl);
+ twowaysLambdaAMI.invoke(null, app, derived);
+ out.println("ok");
}
+ }
+ catch(java.lang.NoSuchMethodException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.IllegalAccessException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.reflect.InvocationTargetException ex)
+ {
+ throw new RuntimeException(ex);
+ }
- out.print("testing oneway operations with AMI... ");
- out.flush();
- OnewaysAMI.onewaysAMI(app, cl);
- out.println("ok");
+ out.print("testing oneway operations with AMI... ");
+ out.flush();
+ OnewaysAMI.onewaysAMI(app, cl);
+ out.println("ok");
- out.print("testing oneway operations with new AMI mapping... ");
- out.flush();
- OnewaysNewAMI.onewaysNewAMI(app, cl);
- out.println("ok");
+ out.print("testing oneway operations with new AMI mapping... ");
+ out.flush();
+ OnewaysNewAMI.onewaysNewAMI(app, cl);
+ out.println("ok");
- //
- // Use reflection to load OnewaysLambdaAMI as that is only supported with Java >= 1.8
- //
- try
- {
- Class<?> cls = IceInternal.Util.findClass("test.Ice.operations.lambda.OnewaysLambdaAMI", null);
- if(cls != null)
- {
- java.lang.reflect.Method onewaysLambdaAMI = cls.getDeclaredMethod("onewaysLambdaAMI",
- new Class<?>[]{test.Util.Application.class, MyClassPrx.class});
- out.print("testing twoway operations with lambda AMI mapping... ");
- out.flush();
- onewaysLambdaAMI.invoke(null, app, cl);
- onewaysLambdaAMI.invoke(null, app, derived);
- out.println("ok");
- }
- }
- catch(java.lang.NoSuchMethodException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.IllegalAccessException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.reflect.InvocationTargetException ex)
+ //
+ // Use reflection to load OnewaysLambdaAMI as that is only supported with Java >= 1.8
+ //
+ try
+ {
+ Class<?> cls = IceInternal.Util.findClass("test.Ice.operations.lambda.OnewaysLambdaAMI", null);
+ if(cls != null)
{
- throw new RuntimeException(ex);
+ java.lang.reflect.Method onewaysLambdaAMI =
+ cls.getDeclaredMethod("onewaysLambdaAMI",
+ new Class<?>[]{test.Util.Application.class, MyClassPrx.class});
+ out.print("testing twoway operations with lambda AMI mapping... ");
+ out.flush();
+ onewaysLambdaAMI.invoke(null, app, cl);
+ onewaysLambdaAMI.invoke(null, app, derived);
+ out.println("ok");
}
-
- out.print("testing batch oneway operations... ");
- out.flush();
- BatchOneways.batchOneways(cl, out);
- BatchOneways.batchOneways(derived, out);
- out.println("ok");
}
+ catch(java.lang.NoSuchMethodException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.IllegalAccessException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.reflect.InvocationTargetException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ out.print("testing batch oneway operations... ");
+ out.flush();
+ BatchOneways.batchOneways(cl, out);
+ BatchOneways.batchOneways(derived, out);
+ out.println("ok");
return cl;
}
diff --git a/java/test/Ice/operations/BatchOneways.java b/java/test/Ice/operations/BatchOneways.java
index 129c3a36c48..8415f3d6ece 100644
--- a/java/test/Ice/operations/BatchOneways.java
+++ b/java/test/Ice/operations/BatchOneways.java
@@ -60,6 +60,8 @@ class BatchOneways
}
MyClassPrx batch = MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
+ batch.ice_flushBatchRequests();
+ batch.end_ice_flushBatchRequests(batch.begin_ice_flushBatchRequests());
for(int i = 0 ; i < 30 ; ++i)
{
@@ -73,40 +75,43 @@ class BatchOneways
}
}
- batch.ice_getConnection().flushBatchRequests();
+ if(batch.ice_getConnection() != null)
+ {
+ batch.ice_getConnection().flushBatchRequests();
- MyClassPrx batch2 = MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
+ MyClassPrx batch2 = MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
- batch.ice_ping();
- batch2.ice_ping();
- batch.ice_flushBatchRequests();
- batch.ice_getConnection().close(false);
- batch.ice_ping();
- batch2.ice_ping();
+ batch.ice_ping();
+ batch2.ice_ping();
+ batch.ice_flushBatchRequests();
+ batch.ice_getConnection().close(false);
+ batch.ice_ping();
+ batch2.ice_ping();
- batch.ice_getConnection();
- batch2.ice_getConnection();
+ batch.ice_getConnection();
+ batch2.ice_getConnection();
- batch.ice_ping();
- batch.ice_getConnection().close(false);
- try
- {
batch.ice_ping();
- test(false);
- }
- catch(Ice.CloseConnectionException ex)
- {
- }
- try
- {
+ batch.ice_getConnection().close(false);
+ try
+ {
+ batch.ice_ping();
+ test(false);
+ }
+ catch(Ice.CloseConnectionException ex)
+ {
+ }
+ try
+ {
+ batch2.ice_ping();
+ test(false);
+ }
+ catch(Ice.CloseConnectionException ex)
+ {
+ }
+ batch.ice_ping();
batch2.ice_ping();
- test(false);
- }
- catch(Ice.CloseConnectionException ex)
- {
}
- batch.ice_ping();
- batch2.ice_ping();
Ice.Identity identity = new Ice.Identity();
identity.name = "invalid";
diff --git a/java/test/Ice/operations/Client.java b/java/test/Ice/operations/Client.java
index 129dbd4f14c..ed4ef912ac6 100644
--- a/java/test/Ice/operations/Client.java
+++ b/java/test/Ice/operations/Client.java
@@ -16,7 +16,7 @@ public class Client extends test.Util.Application
public int run(String[] args)
{
java.io.PrintWriter out = getWriter();
- MyClassPrx myClass = AllTests.allTests(this, false, out);
+ MyClassPrx myClass = AllTests.allTests(this, out);
out.print("testing server shutdown... ");
out.flush();
diff --git a/java/test/Ice/operations/Collocated.java b/java/test/Ice/operations/Collocated.java
index 6dffa51dd86..45aa29a6a30 100644
--- a/java/test/Ice/operations/Collocated.java
+++ b/java/test/Ice/operations/Collocated.java
@@ -13,12 +13,13 @@ public class Collocated extends test.Util.Application
{
public int run(String[] args)
{
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
java.io.PrintWriter out = getWriter();
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MyDerivedClassI(), communicator().stringToIdentity("test"));
adapter.activate();
- AllTests.allTests(this, true, out);
+ AllTests.allTests(this, out);
return 0;
}
@@ -28,7 +29,21 @@ public class Collocated extends test.Util.Application
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(argsH);
initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+
+ //
+ // We must set MessageSizeMax to an explicit values,
+ // because we run tests to check whether
+ // Ice.MemoryLimitException is raised as expected.
+ //
+ initData.properties.setProperty("Ice.MessageSizeMax", "100");
+
+ //
+ // Its possible to have batch oneway requests dispatched
+ // after the adapter is deactivated due to thread
+ // scheduling so we supress this warning.
+ //
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+
return initData;
}
diff --git a/java/test/Ice/operations/TwowaysAMI.java b/java/test/Ice/operations/TwowaysAMI.java
index 8ede3f056f3..d9d4aaa8d0b 100644
--- a/java/test/Ice/operations/TwowaysAMI.java
+++ b/java/test/Ice/operations/TwowaysAMI.java
@@ -1238,6 +1238,7 @@ class TwowaysAMI
}
catch(java.lang.Exception ex)
{
+ ex.printStackTrace();
test(false);
}
cb.check();
diff --git a/java/test/Ice/operations/lambda/OnewaysLambdaAMI.java b/java/test/Ice/operations/lambda/OnewaysLambdaAMI.java
index af596c9512e..4b1a8141f53 100644
--- a/java/test/Ice/operations/lambda/OnewaysLambdaAMI.java
+++ b/java/test/Ice/operations/lambda/OnewaysLambdaAMI.java
@@ -9,9 +9,6 @@
package test.Ice.operations.lambda;
-import test.Ice.operations.Test.Callback_MyClass_opIdempotent;
-import test.Ice.operations.Test.Callback_MyClass_opNonmutating;
-import test.Ice.operations.Test.Callback_MyClass_opVoid;
import test.Ice.operations.Test.MyClass;
import test.Ice.operations.Test.MyClassPrx;
import test.Ice.operations.Test.MyClassPrxHelper;
@@ -29,9 +26,9 @@ public class OnewaysLambdaAMI
}
}
- private static class CallbackBase
+ private static class Callback
{
- CallbackBase()
+ Callback()
{
_called = false;
}
@@ -59,25 +56,18 @@ public class OnewaysLambdaAMI
notify();
}
- private boolean _called;
- }
-
- static class Callback extends CallbackBase
- {
- public Callback()
- {
- }
-
public void
sent(boolean sentSynchronously)
{
called();
}
- void noException(Ice.LocalException ex)
+ void noException(Ice.Exception ex)
{
test(false);
}
+
+ private boolean _called;
}
public static void
@@ -88,29 +78,9 @@ public class OnewaysLambdaAMI
{
final Callback cb = new Callback();
- Ice.Callback_Object_ice_ping callback = new Ice.Callback_Object_ice_ping()
- {
- public void
- response()
- {
- test(false);
- }
-
- public void
- exception(Ice.LocalException ex)
- {
- cb.noException(ex);
- }
-
- public void
- sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
- };
p.begin_ice_ping(
- () -> callback.response(),
- (Ice.LocalException ex) -> callback.exception(ex),
+ () -> test(false),
+ (Ice.Exception ex) -> cb.noException(ex),
(boolean sent) -> cb.sent(sent)
);
cb.check();
@@ -151,29 +121,9 @@ public class OnewaysLambdaAMI
{
final Callback cb = new Callback();
- Callback_MyClass_opVoid callback = new Callback_MyClass_opVoid()
- {
- public void
- response()
- {
- test(false);
- }
-
- public void
- exception(Ice.LocalException ex)
- {
- cb.noException(ex);
- }
-
- public void
- sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
- };
p.begin_opVoid(
- () -> callback.response(),
- (Ice.LocalException ex) -> callback.exception(ex),
+ () -> test(false),
+ (Ice.Exception ex) -> cb.noException(ex),
(boolean sent) -> cb.sent(sent)
);
cb.check();
@@ -181,29 +131,9 @@ public class OnewaysLambdaAMI
{
final Callback cb = new Callback();
- Callback_MyClass_opIdempotent callback = new Callback_MyClass_opIdempotent()
- {
- public void
- response()
- {
- test(false);
- }
-
- public void
- exception(Ice.LocalException ex)
- {
- cb.noException(ex);
- }
-
- public void
- sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
- };
p.begin_opIdempotent(
- () -> callback.response(),
- (Ice.LocalException ex) -> callback.exception(ex),
+ () -> test(false),
+ (Ice.Exception ex) -> cb.noException(ex),
(boolean sent) -> cb.sent(sent)
);
cb.check();
@@ -211,29 +141,9 @@ public class OnewaysLambdaAMI
{
final Callback cb = new Callback();
- Callback_MyClass_opNonmutating callback = new Callback_MyClass_opNonmutating()
- {
- public void
- response()
- {
- test(false);
- }
-
- public void
- exception(Ice.LocalException ex)
- {
- cb.noException(ex);
- }
-
- public void
- sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
- };
p.begin_opNonmutating(
- () -> callback.response(),
- (Ice.LocalException ex) -> callback.exception(ex),
+ () -> test(false),
+ (Ice.Exception ex) -> cb.noException(ex),
(boolean sent) -> cb.sent(sent)
);
cb.check();
diff --git a/java/test/Ice/operations/lambda/TwowaysLambdaAMI.java b/java/test/Ice/operations/lambda/TwowaysLambdaAMI.java
index 74eac9f4ff5..d8ff5af661b 100644
--- a/java/test/Ice/operations/lambda/TwowaysLambdaAMI.java
+++ b/java/test/Ice/operations/lambda/TwowaysLambdaAMI.java
@@ -9,39 +9,6 @@
package test.Ice.operations.lambda;
-import test.Ice.operations.Test.Callback_MyClass_opVoid;
-import test.Ice.operations.Test.Callback_MyClass_opBool;
-import test.Ice.operations.Test.Callback_MyClass_opBoolS;
-import test.Ice.operations.Test.Callback_MyClass_opBoolSS;
-import test.Ice.operations.Test.Callback_MyClass_opByte;
-import test.Ice.operations.Test.Callback_MyClass_opByteBoolD;
-import test.Ice.operations.Test.Callback_MyClass_opByteS;
-import test.Ice.operations.Test.Callback_MyClass_opByteSS;
-import test.Ice.operations.Test.Callback_MyClass_opContext;
-import test.Ice.operations.Test.Callback_MyClass_opFloatDouble;
-import test.Ice.operations.Test.Callback_MyClass_opFloatDoubleS;
-import test.Ice.operations.Test.Callback_MyClass_opFloatDoubleSS;
-import test.Ice.operations.Test.Callback_MyClass_opIdempotent;
-import test.Ice.operations.Test.Callback_MyClass_opIntS;
-import test.Ice.operations.Test.Callback_MyClass_opLongFloatD;
-import test.Ice.operations.Test.Callback_MyClass_opMyClass;
-import test.Ice.operations.Test.Callback_MyClass_opMyEnum;
-import test.Ice.operations.Test.Callback_MyClass_opNonmutating;
-import test.Ice.operations.Test.Callback_MyClass_opShortIntD;
-import test.Ice.operations.Test.Callback_MyClass_opShortIntLong;
-import test.Ice.operations.Test.Callback_MyClass_opShortIntLongS;
-import test.Ice.operations.Test.Callback_MyClass_opShortIntLongSS;
-import test.Ice.operations.Test.Callback_MyClass_opString;
-import test.Ice.operations.Test.Callback_MyClass_opStringMyEnumD;
-import test.Ice.operations.Test.Callback_MyClass_opMyEnumStringD;
-import test.Ice.operations.Test.Callback_MyClass_opStringS;
-import test.Ice.operations.Test.Callback_MyClass_opStringSS;
-import test.Ice.operations.Test.Callback_MyClass_opStringSSS;
-import test.Ice.operations.Test.Callback_MyClass_opStringStringD;
-import test.Ice.operations.Test.Callback_MyClass_opStruct;
-import test.Ice.operations.Test.Callback_MyClass_opMyStructMyEnumD;
-import test.Ice.operations.Test.Callback_MyClass_opDoubleMarshaling;
-import test.Ice.operations.Test.Callback_MyDerivedClass_opDerived;
import test.Ice.operations.Test.AnotherStruct;
import test.Ice.operations.Test.MyClass;
import test.Ice.operations.Test.MyClassPrx;
@@ -99,16 +66,14 @@ public class TwowaysLambdaAMI
private boolean _called;
}
- private static class pingI extends Ice.Callback_Object_ice_ping
+ private static class pingI
{
- @Override
public void response()
{
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -121,17 +86,15 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class isAI extends Ice.Callback_Object_ice_isA
+ private static class isAI
{
- @Override
public void response(boolean r)
{
test(r);
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -144,17 +107,15 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class idI extends Ice.Callback_Object_ice_id
+ private static class idI
{
- @Override
public void response(String id)
{
test(id.equals(MyDerivedClass.ice_staticId()));
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -167,17 +128,15 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class idsI extends Ice.Callback_Object_ice_ids
+ private static class idsI
{
- @Override
public void response(String[] ids)
{
test(ids.length == 3);
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -190,16 +149,14 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opVoidI extends Callback_MyClass_opVoid
+ private static class opVoidI
{
- @Override
public void response()
{
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -212,9 +169,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opByteI extends Callback_MyClass_opByte
+ private static class opByteI
{
- @Override
public void response(byte r, byte b)
{
test(b == (byte)0xf0);
@@ -222,8 +178,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -236,9 +191,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opBoolI extends Callback_MyClass_opBool
+ private static class opBoolI
{
- @Override
public void response(boolean r, boolean b)
{
test(b);
@@ -246,8 +200,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -260,9 +213,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opShortIntLongI extends Callback_MyClass_opShortIntLong
+ private static class opShortIntLongI
{
- @Override
public void response(long r, short s, int i, long l)
{
test(s == 10);
@@ -272,8 +224,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -286,9 +237,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opFloatDoubleI extends Callback_MyClass_opFloatDouble
+ private static class opFloatDoubleI
{
- @Override
public void response(double r, float f, double d)
{
test(f == 3.14f);
@@ -297,8 +247,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -311,9 +260,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opStringI extends Callback_MyClass_opString
+ private static class opStringI
{
- @Override
public void response(String r, String s)
{
test(s.equals("world hello"));
@@ -321,8 +269,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -335,9 +282,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opMyEnumI extends Callback_MyClass_opMyEnum
+ private static class opMyEnumI
{
- @Override
public void response(MyEnum r, MyEnum e)
{
test(e == MyEnum.enum2);
@@ -345,8 +291,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -359,14 +304,13 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opMyClassI extends Callback_MyClass_opMyClass
+ private static class opMyClassI
{
opMyClassI(Ice.Communicator communicator)
{
_communicator = communicator;
}
- @Override
public void response(MyClassPrx r, MyClassPrx c1, MyClassPrx c2)
{
test(c1.ice_getIdentity().equals(_communicator.stringToIdentity("test")));
@@ -389,8 +333,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -404,14 +347,13 @@ public class TwowaysLambdaAMI
private Ice.Communicator _communicator;
}
- private static class opStructI extends Callback_MyClass_opStruct
+ private static class opStructI
{
opStructI(Ice.Communicator communicator)
{
_communicator = communicator;
}
- @Override
public void response(Structure rso, Structure so)
{
test(rso.p == null);
@@ -427,8 +369,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -442,9 +383,8 @@ public class TwowaysLambdaAMI
private Ice.Communicator _communicator;
}
- private static class opByteSI extends Callback_MyClass_opByteS
+ private static class opByteSI
{
- @Override
public void response(byte[] rso, byte[] bso)
{
test(bso.length == 4);
@@ -464,8 +404,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -478,9 +417,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opBoolSI extends Callback_MyClass_opBoolS
+ private static class opBoolSI
{
- @Override
public void response(boolean[] rso, boolean[] bso)
{
test(bso.length == 4);
@@ -495,8 +433,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -509,9 +446,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opShortIntLongSI extends Callback_MyClass_opShortIntLongS
+ private static class opShortIntLongSI
{
- @Override
public void response(long[] rso, short[] sso, int[] iso, long[] lso)
{
test(sso.length == 3);
@@ -537,8 +473,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -551,9 +486,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opFloatDoubleSI extends Callback_MyClass_opFloatDoubleS
+ private static class opFloatDoubleSI
{
- @Override
public void response(double[] rso, float[] fso, double[] dso)
{
test(fso.length == 2);
@@ -572,8 +506,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -586,9 +519,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opStringSI extends Callback_MyClass_opStringS
+ private static class opStringSI
{
- @Override
public void response(String[] rso, String[] sso)
{
test(sso.length == 4);
@@ -603,8 +535,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -617,9 +548,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opByteSSI extends Callback_MyClass_opByteSS
+ private static class opByteSSI
{
- @Override
public void response(byte[][] rso, byte[][] bso)
{
test(bso.length == 2);
@@ -644,8 +574,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -658,16 +587,14 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opBoolSSI extends Callback_MyClass_opBoolSS
+ private static class opBoolSSI
{
- @Override
public void response(boolean[][] rso, boolean[][] bso)
{
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -680,16 +607,14 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opShortIntLongSSI extends Callback_MyClass_opShortIntLongSS
+ private static class opShortIntLongSSI
{
- @Override
public void response(long[][] rso, short[][] sso, int[][] iso, long[][] lso)
{
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -702,9 +627,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opFloatDoubleSSI extends Callback_MyClass_opFloatDoubleSS
+ private static class opFloatDoubleSSI
{
- @Override
public void response(double[][] rso, float[][] fso, double[][] dso)
{
test(fso.length == 3);
@@ -730,8 +654,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -744,9 +667,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opStringSSI extends Callback_MyClass_opStringSS
+ private static class opStringSSI
{
- @Override
public void response(String[][] rso, String[][] sso)
{
test(sso.length == 5);
@@ -767,8 +689,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -781,9 +702,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opStringSSSI extends Callback_MyClass_opStringSSS
+ private static class opStringSSSI
{
- @Override
public void response(String[][][] rsso, String[][][] ssso)
{
test(ssso.length == 5);
@@ -821,8 +741,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -835,9 +754,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opByteBoolDI extends Callback_MyClass_opByteBoolD
+ private static class opByteBoolDI
{
- @Override
public void response(java.util.Map<Byte, Boolean> ro, java.util.Map<Byte, Boolean> _do)
{
java.util.Map<Byte, Boolean> di1 = new java.util.HashMap<Byte, Boolean>();
@@ -852,8 +770,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -866,9 +783,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opShortIntDI extends Callback_MyClass_opShortIntD
+ private static class opShortIntDI
{
- @Override
public void response(java.util.Map<Short, Integer> ro, java.util.Map<Short, Integer> _do)
{
java.util.Map<Short, Integer> di1 = new java.util.HashMap<Short, Integer>();
@@ -883,8 +799,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -897,9 +812,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opLongFloatDI extends Callback_MyClass_opLongFloatD
+ private static class opLongFloatDI
{
- @Override
public void response(java.util.Map<Long, Float> ro, java.util.Map<Long, Float> _do)
{
java.util.Map<Long, Float> di1 = new java.util.HashMap<Long, Float>();
@@ -914,8 +828,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -928,9 +841,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opStringStringDI extends Callback_MyClass_opStringStringD
+ private static class opStringStringDI
{
- @Override
public void response(java.util.Map<String, String> ro, java.util.Map<String, String> _do)
{
java.util.Map<String, String> di1 = new java.util.HashMap<String, String>();
@@ -945,8 +857,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -959,9 +870,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opStringMyEnumDI extends Callback_MyClass_opStringMyEnumD
+ private static class opStringMyEnumDI
{
- @Override
public void response(java.util.Map<String, MyEnum> ro, java.util.Map<String, MyEnum> _do)
{
java.util.Map<String, MyEnum> di1 = new java.util.HashMap<String, MyEnum>();
@@ -976,8 +886,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -990,9 +899,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opMyEnumStringDI extends Callback_MyClass_opMyEnumStringD
+ private static class opMyEnumStringDI
{
- @Override
public void response(java.util.Map<MyEnum, String> ro, java.util.Map<MyEnum, String> _do)
{
java.util.Map<MyEnum, String> di1 = new java.util.HashMap<MyEnum, String>();
@@ -1005,8 +913,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -1019,9 +926,8 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opMyStructMyEnumDI extends Callback_MyClass_opMyStructMyEnumD
+ private static class opMyStructMyEnumDI
{
- @Override
public void response(java.util.Map<MyStruct, MyEnum> ro, java.util.Map<MyStruct, MyEnum> _do)
{
MyStruct s11 = new MyStruct(1, 1);
@@ -1040,8 +946,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -1054,14 +959,13 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opIntSI extends Callback_MyClass_opIntS
+ private static class opIntSI
{
opIntSI(int l)
{
_l = l;
}
- @Override
public void response(int[] r)
{
test(r.length == _l);
@@ -1072,8 +976,7 @@ public class TwowaysLambdaAMI
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -1087,16 +990,14 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opDerivedI extends Callback_MyDerivedClass_opDerived
+ private static class opDerivedI
{
- @Override
public void response()
{
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -1109,16 +1010,14 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opDoubleMarshalingI extends Callback_MyClass_opDoubleMarshaling
+ private static class opDoubleMarshalingI
{
- @Override
public void response()
{
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -1131,16 +1030,14 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opIdempotentI extends Callback_MyClass_opIdempotent
+ private static class opIdempotentI
{
- @Override
public void response()
{
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -1153,16 +1050,14 @@ public class TwowaysLambdaAMI
private Callback callback = new Callback();
}
- private static class opNonmutatingI extends Callback_MyClass_opNonmutating
+ private static class opNonmutatingI
{
- @Override
public void response()
{
callback.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(Ice.Exception ex)
{
test(false);
}
@@ -1182,31 +1077,31 @@ public class TwowaysLambdaAMI
{
pingI cb = new pingI();
- p.begin_ice_ping(() -> cb.response(), (Ice.LocalException ex) -> test(false));
+ p.begin_ice_ping(() -> cb.response(), (Ice.Exception ex) -> test(false));
cb.check();
}
{
isAI cb = new isAI();
- p.begin_ice_isA(MyClass.ice_staticId(), (boolean r) -> cb.response(r), (Ice.LocalException ex) -> test(false));
+ p.begin_ice_isA(MyClass.ice_staticId(), (boolean r) -> cb.response(r), (Ice.Exception ex) -> test(false));
cb.check();
}
{
idI cb = new idI();
- p.begin_ice_id((String id) -> cb.response(id), (Ice.LocalException ex) -> test(false));
+ p.begin_ice_id((String id) -> cb.response(id), (Ice.Exception ex) -> test(false));
cb.check();
}
{
idsI cb = new idsI();
- p.begin_ice_ids((String[] ids) -> cb.response(ids), (Ice.LocalException ex) -> test(false));
+ p.begin_ice_ids((String[] ids) -> cb.response(ids), (Ice.Exception ex) -> test(false));
cb.check();
}
{
opVoidI cb = new opVoidI();
- p.begin_opVoid(() -> cb.response(), (Ice.LocalException ex) -> test(false));
+ p.begin_opVoid(() -> cb.response(), (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1214,7 +1109,7 @@ public class TwowaysLambdaAMI
opByteI cb = new opByteI();
p.begin_opByte((byte)0xff, (byte)0x0f,
(byte p1, byte p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1222,7 +1117,7 @@ public class TwowaysLambdaAMI
opBoolI cb = new opBoolI();
p.begin_opBool(true, false,
(boolean p1, boolean p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1230,7 +1125,7 @@ public class TwowaysLambdaAMI
opShortIntLongI cb = new opShortIntLongI();
p.begin_opShortIntLong((short)10, 11, 12L,
(long p1, short p2, int p3, long p4) -> cb.response(p1, p2, p3, p4),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1238,7 +1133,7 @@ public class TwowaysLambdaAMI
opFloatDoubleI cb = new opFloatDoubleI();
p.begin_opFloatDouble(3.14f, 1.1E10,
(double p1, float p2, double p3) -> cb.response(p1, p2, p3),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1246,7 +1141,7 @@ public class TwowaysLambdaAMI
opStringI cb = new opStringI();
p.begin_opString("hello", "world",
(String p1, String p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1254,7 +1149,7 @@ public class TwowaysLambdaAMI
opMyEnumI cb = new opMyEnumI();
p.begin_opMyEnum(MyEnum.enum2,
(MyEnum p1, MyEnum p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1262,7 +1157,7 @@ public class TwowaysLambdaAMI
opMyClassI cb = new opMyClassI(communicator);
p.begin_opMyClass(p,
(MyClassPrx p1, MyClassPrx p2, MyClassPrx p3) -> cb.response(p1, p2, p3),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1281,7 +1176,7 @@ public class TwowaysLambdaAMI
opStructI cb = new opStructI(communicator);
p.begin_opStruct(si1, si2,
(Structure p1, Structure p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1304,7 +1199,7 @@ public class TwowaysLambdaAMI
opByteSI cb = new opByteSI();
p.begin_opByteS(bsi1, bsi2,
(byte[] p1, byte[] p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1315,7 +1210,7 @@ public class TwowaysLambdaAMI
opBoolSI cb = new opBoolSI();
p.begin_opBoolS(bsi1, bsi2,
(boolean[] p1, boolean[] p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1327,7 +1222,7 @@ public class TwowaysLambdaAMI
opShortIntLongSI cb = new opShortIntLongSI();
p.begin_opShortIntLongS(ssi, isi, lsi,
(long[] p1, short[] p2, int[] p3, long[] p4) -> cb.response(p1, p2, p3, p4),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1338,7 +1233,7 @@ public class TwowaysLambdaAMI
opFloatDoubleSI cb = new opFloatDoubleSI();
p.begin_opFloatDoubleS(fsi, dsi,
(double[] p1, float[] p2, double[] p3) -> cb.response(p1, p2, p3),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1349,7 +1244,7 @@ public class TwowaysLambdaAMI
opStringSI cb = new opStringSI();
p.begin_opStringS(ssi1, ssi2,
(String[] p1, String[] p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1368,7 +1263,7 @@ public class TwowaysLambdaAMI
opByteSSI cb = new opByteSSI();
p.begin_opByteSS(bsi1, bsi2,
(byte[][] p1, byte[][] p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1387,7 +1282,7 @@ public class TwowaysLambdaAMI
opFloatDoubleSSI cb = new opFloatDoubleSSI();
p.begin_opFloatDoubleSS(fsi, dsi,
(double[][] p1, float[][] p2, double[][] p3) -> cb.response(p1, p2, p3),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1407,7 +1302,7 @@ public class TwowaysLambdaAMI
opStringSSI cb = new opStringSSI();
p.begin_opStringSS(ssi1, ssi2,
(String[][] p1, String[][] p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1451,7 +1346,7 @@ public class TwowaysLambdaAMI
opStringSSSI cb = new opStringSSSI();
p.begin_opStringSSS(sssi1, sssi2,
(String[][][] p1, String[][][] p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1467,7 +1362,7 @@ public class TwowaysLambdaAMI
opByteBoolDI cb = new opByteBoolDI();
p.begin_opByteBoolD(di1, di2,
(Map<Byte, Boolean> p1, Map<Byte, Boolean> p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1483,7 +1378,7 @@ public class TwowaysLambdaAMI
opShortIntDI cb = new opShortIntDI();
p.begin_opShortIntD(di1, di2,
(Map<Short, Integer> p1, Map<Short, Integer> p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1499,7 +1394,7 @@ public class TwowaysLambdaAMI
opLongFloatDI cb = new opLongFloatDI();
p.begin_opLongFloatD(di1, di2,
(Map<Long, Float> p1, Map<Long, Float> p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1515,7 +1410,7 @@ public class TwowaysLambdaAMI
opStringStringDI cb = new opStringStringDI();
p.begin_opStringStringD(di1, di2,
(Map<String, String> p1, Map<String, String> p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1531,7 +1426,7 @@ public class TwowaysLambdaAMI
opStringMyEnumDI cb = new opStringMyEnumDI();
p.begin_opStringMyEnumD(di1, di2,
(Map<String, MyEnum> p1, Map<String, MyEnum> p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1545,7 +1440,7 @@ public class TwowaysLambdaAMI
opMyEnumStringDI cb = new opMyEnumStringDI();
p.begin_opMyEnumStringD(di1, di2,
(Map<MyEnum, String> p1, Map<MyEnum, String> p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1565,7 +1460,7 @@ public class TwowaysLambdaAMI
opMyStructMyEnumDI cb = new opMyStructMyEnumDI();
p.begin_opMyStructMyEnumD(di1, di2,
(Map<MyStruct, MyEnum> p1, Map<MyStruct, MyEnum> p2) -> cb.response(p1, p2),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1582,7 +1477,7 @@ public class TwowaysLambdaAMI
opIntSI cb = new opIntSI(l);
p.begin_opIntS(s,
(int[] p1) -> cb.response(p1),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
}
@@ -1597,13 +1492,15 @@ public class TwowaysLambdaAMI
opDoubleMarshalingI cb = new opDoubleMarshalingI();
p.begin_opDoubleMarshaling(d, ds,
() -> cb.response(),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
{
opIdempotentI cb = new opIdempotentI();
- p.begin_opIdempotent(cb);
+ p.begin_opIdempotent(
+ () -> cb.response(),
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1611,7 +1508,7 @@ public class TwowaysLambdaAMI
opNonmutatingI cb = new opNonmutatingI();
p.begin_opNonmutating(
() -> cb.response(),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
@@ -1621,7 +1518,7 @@ public class TwowaysLambdaAMI
opDerivedI cb = new opDerivedI();
derived.begin_opDerived(
() -> cb.response(),
- (Ice.LocalException ex) -> test(false));
+ (Ice.Exception ex) -> test(false));
cb.check();
}
}
diff --git a/java/test/Ice/optional/lambda/AllTests.java b/java/test/Ice/optional/lambda/AllTests.java
index 4ba65813336..db9fce3f89d 100644
--- a/java/test/Ice/optional/lambda/AllTests.java
+++ b/java/test/Ice/optional/lambda/AllTests.java
@@ -84,7 +84,7 @@ public class AllTests
initial.begin_opByte(p1.get(),
(Ice.ByteOptional ret, Ice.ByteOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -93,7 +93,7 @@ public class AllTests
initial.begin_opByte(p1,
(Ice.ByteOptional ret, Ice.ByteOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -105,7 +105,7 @@ public class AllTests
initial.begin_opBool(p1.get(),
(Ice.BooleanOptional ret, Ice.BooleanOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -114,7 +114,7 @@ public class AllTests
initial.begin_opBool(p1,
(Ice.BooleanOptional ret, Ice.BooleanOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -126,7 +126,7 @@ public class AllTests
initial.begin_opShort(p1.get(),
(Ice.ShortOptional ret, Ice.ShortOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
{
@@ -134,7 +134,7 @@ public class AllTests
initial.begin_opShort(p1,
(Ice.ShortOptional ret, Ice.ShortOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -146,7 +146,7 @@ public class AllTests
initial.begin_opInt(p1.get(),
(Ice.IntOptional ret, Ice.IntOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -155,7 +155,7 @@ public class AllTests
initial.begin_opInt(p1,
(Ice.IntOptional ret, Ice.IntOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -167,7 +167,7 @@ public class AllTests
initial.begin_opLong(p1.get(),
(Ice.LongOptional ret, Ice.LongOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -176,7 +176,7 @@ public class AllTests
initial.begin_opLong(p1,
(Ice.LongOptional ret, Ice.LongOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -188,7 +188,7 @@ public class AllTests
initial.begin_opFloat(p1.get(),
(Ice.FloatOptional ret, Ice.FloatOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -197,7 +197,7 @@ public class AllTests
initial.begin_opFloat(p1,
(Ice.FloatOptional ret, Ice.FloatOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -209,7 +209,7 @@ public class AllTests
initial.begin_opDouble(p1.get(),
(Ice.DoubleOptional ret, Ice.DoubleOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -218,7 +218,7 @@ public class AllTests
initial.begin_opDouble(p1,
(Ice.DoubleOptional ret, Ice.DoubleOptional p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -230,7 +230,7 @@ public class AllTests
initial.begin_opString(p1.get(),
(Ice.Optional<String> ret, Ice.Optional<String> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -239,7 +239,7 @@ public class AllTests
initial.begin_opString(p1,
(Ice.Optional<String> ret, Ice.Optional<String> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -251,7 +251,7 @@ public class AllTests
initial.begin_opMyEnum(p1.get(),
(Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -260,7 +260,7 @@ public class AllTests
initial.begin_opMyEnum(p1,
(Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -272,7 +272,7 @@ public class AllTests
initial.begin_opSmallStruct(p1.get(),
(Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -281,7 +281,7 @@ public class AllTests
initial.begin_opSmallStruct(p1,
(Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -293,7 +293,7 @@ public class AllTests
initial.begin_opFixedStruct(p1.get(),
(Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -302,7 +302,7 @@ public class AllTests
initial.begin_opFixedStruct(p1,
(Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -314,7 +314,7 @@ public class AllTests
initial.begin_opVarStruct(p1.get(),
(Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -323,7 +323,7 @@ public class AllTests
initial.begin_opVarStruct(p1,
(Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -336,7 +336,7 @@ public class AllTests
(Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() &&
ret.get().getA() == p1.get().getA()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -346,7 +346,7 @@ public class AllTests
(Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() &&
ret.get().getA() == p1.get().getA()),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -359,7 +359,7 @@ public class AllTests
initial.begin_opOneOptionalProxy(p1.get(),
(Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -368,7 +368,7 @@ public class AllTests
initial.begin_opOneOptionalProxy(p1,
(Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -383,7 +383,7 @@ public class AllTests
(Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -393,7 +393,7 @@ public class AllTests
(Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -407,7 +407,7 @@ public class AllTests
(Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -417,7 +417,7 @@ public class AllTests
(Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -431,7 +431,7 @@ public class AllTests
(Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -441,7 +441,7 @@ public class AllTests
(Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -455,7 +455,7 @@ public class AllTests
(Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -465,7 +465,7 @@ public class AllTests
(Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -479,7 +479,7 @@ public class AllTests
(Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -489,7 +489,7 @@ public class AllTests
(Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -503,7 +503,7 @@ public class AllTests
(Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -513,7 +513,7 @@ public class AllTests
(Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -527,7 +527,7 @@ public class AllTests
(Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -537,7 +537,7 @@ public class AllTests
(Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -551,7 +551,7 @@ public class AllTests
(Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -561,7 +561,7 @@ public class AllTests
(Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -580,7 +580,7 @@ public class AllTests
(Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -590,7 +590,7 @@ public class AllTests
(Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -608,7 +608,7 @@ public class AllTests
initial.begin_opSmallStructList(p1.get(),
(Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -617,7 +617,7 @@ public class AllTests
initial.begin_opSmallStructList(p1,
(Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -636,7 +636,7 @@ public class AllTests
(Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -646,7 +646,7 @@ public class AllTests
(Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -664,7 +664,7 @@ public class AllTests
initial.begin_opFixedStructList(p1.get(),
(Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -673,7 +673,7 @@ public class AllTests
initial.begin_opFixedStructList(p1,
(Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -692,7 +692,7 @@ public class AllTests
(Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -702,7 +702,7 @@ public class AllTests
(Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) ->
cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
java.util.Arrays.equals(ret.get(), p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -715,7 +715,7 @@ public class AllTests
initial.begin_opSerializable(p1.get(),
(Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -724,7 +724,7 @@ public class AllTests
initial.begin_opSerializable(p1,
(Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -741,7 +741,7 @@ public class AllTests
(Ice.Optional<java.util.Map<Integer, Integer>> ret,
Ice.Optional<java.util.Map<Integer, Integer>> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -751,7 +751,7 @@ public class AllTests
(Ice.Optional<java.util.Map<Integer, Integer>> ret,
Ice.Optional<java.util.Map<Integer, Integer>> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
@@ -768,7 +768,7 @@ public class AllTests
(Ice.Optional<java.util.Map<String, Integer>> ret,
Ice.Optional<java.util.Map<String, Integer>> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
@@ -778,7 +778,7 @@ public class AllTests
(Ice.Optional<java.util.Map<String, Integer>> ret,
Ice.Optional<java.util.Map<String, Integer>> p2) ->
cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
- (Ice.LocalException ex) -> cb.called(false));
+ (Ice.Exception ex) -> cb.called(false));
cb.check();
}
}
diff --git a/java/test/Ice/proxy/AllTests.java b/java/test/Ice/proxy/AllTests.java
index bf601d4eb7b..8699bdbbf5f 100644
--- a/java/test/Ice/proxy/AllTests.java
+++ b/java/test/Ice/proxy/AllTests.java
@@ -633,13 +633,7 @@ public class AllTests
String ref13 = "test -e 1.3:default -p 12010";
MyClassPrx cl13 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13));
cl13.ice_ping();
- try
- {
- cl13.end_ice_ping(cl13.begin_ice_ping());
- }
- catch(Ice.CollocationOptimizationException ex)
- {
- }
+ cl13.end_ice_ping(cl13.begin_ice_ping());
try
{
@@ -706,13 +700,7 @@ public class AllTests
ref13 = "test -p 1.3:default -p 12010";
cl13 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13));
cl13.ice_ping();
- try
- {
- cl13.end_ice_ping(cl13.begin_ice_ping());
- }
- catch(Ice.CollocationOptimizationException ex)
- {
- }
+ cl13.end_ice_ping(cl13.begin_ice_ping());
out.println("ok");
out.print("testing opaque endpoints... ");
diff --git a/java/test/Ice/retry/AllTests.java b/java/test/Ice/retry/AllTests.java
index 553e5b987dd..42f40727eef 100644
--- a/java/test/Ice/retry/AllTests.java
+++ b/java/test/Ice/retry/AllTests.java
@@ -99,7 +99,7 @@ public class AllTests
public void
exception(Ice.LocalException ex)
{
- test(ex instanceof Ice.ConnectionLostException);
+ test(ex instanceof Ice.ConnectionLostException || ex instanceof Ice.UnknownLocalException);
callback.called();
}
@@ -139,6 +139,8 @@ public class AllTests
retry1.op(false);
out.println("ok");
+ int invocationCount = 3;
+
out.print("calling operation to kill connection with second proxy... ");
out.flush();
try
@@ -146,14 +148,24 @@ public class AllTests
retry2.op(true);
test(false);
}
+ catch(Ice.UnknownLocalException ex)
+ {
+ // Expected with collocation
+ }
catch(Ice.ConnectionLostException ex)
{
- out.println("ok");
}
-
+ Instrumentation.testInvocationCount(invocationCount + 1);
+ Instrumentation.testFailureCount(1);
+ Instrumentation.testRetryCount(0);
+ out.println("ok");
+
out.print("calling regular operation with first proxy again... ");
out.flush();
retry1.op(false);
+ Instrumentation.testInvocationCount(invocationCount + 2);
+ Instrumentation.testFailureCount(1);
+ Instrumentation.testRetryCount(0);
out.println("ok");
AMIRegular cb1 = new AMIRegular();
@@ -162,18 +174,92 @@ public class AllTests
out.print("calling regular AMI operation with first proxy... ");
retry1.begin_op(false, cb1);
cb1.check();
+ Instrumentation.testInvocationCount(invocationCount + 3);
+ Instrumentation.testFailureCount(1);
+ Instrumentation.testRetryCount(0);
out.println("ok");
out.print("calling AMI operation to kill connection with second proxy... ");
retry2.begin_op(true, cb2);
cb2.check();
+ Instrumentation.testInvocationCount(invocationCount + 4);
+ Instrumentation.testFailureCount(2);
+ Instrumentation.testRetryCount(0);
out.println("ok");
out.print("calling regular AMI operation with first proxy again... ");
retry1.begin_op(false, cb1);
cb1.check();
+ Instrumentation.testInvocationCount(invocationCount + 5);
+ Instrumentation.testFailureCount(2);
+ Instrumentation.testRetryCount(0);
+ out.println("ok");
+
+ out.print("testing idempotent operation... ");
+ test(retry1.opIdempotent(0) == 4);
+ Instrumentation.testInvocationCount(invocationCount + 6);
+ Instrumentation.testFailureCount(2);
+ Instrumentation.testRetryCount(4);
+ test(retry1.end_opIdempotent(retry1.begin_opIdempotent(4)) == 8);
+ Instrumentation.testInvocationCount(invocationCount + 7);
+ Instrumentation.testFailureCount(2);
+ Instrumentation.testRetryCount(8);
+ out.println("ok");
+
+ out.print("testing non-idempotent operation... ");
+ try
+ {
+ retry1.opNotIdempotent(8);
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ Instrumentation.testInvocationCount(invocationCount + 8);
+ Instrumentation.testFailureCount(3);
+ Instrumentation.testRetryCount(8);
+ try
+ {
+ retry1.end_opNotIdempotent(retry1.begin_opNotIdempotent(9));
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ Instrumentation.testInvocationCount(invocationCount + 9);
+ Instrumentation.testFailureCount(4);
+ Instrumentation.testRetryCount(8);
out.println("ok");
+ if(retry1.ice_getConnection() == null)
+ {
+ invocationCount = invocationCount + 10;
+ out.print("testing system exception... ");
+ try
+ {
+ retry1.opSystemException();
+ test(false);
+ }
+ catch(SystemFailure ex)
+ {
+ }
+ Instrumentation.testInvocationCount(invocationCount + 1);
+ Instrumentation.testFailureCount(5);
+ Instrumentation.testRetryCount(8);
+ try
+ {
+ retry1.end_opSystemException(retry1.begin_opSystemException());
+ test(false);
+ }
+ catch(SystemFailure ex)
+ {
+ }
+ Instrumentation.testInvocationCount(invocationCount + 2);
+ Instrumentation.testFailureCount(6);
+ Instrumentation.testRetryCount(8);
+ out.println("ok");
+ }
+
return retry1;
}
}
diff --git a/java/test/Ice/retry/Client.java b/java/test/Ice/retry/Client.java
index c87c6160088..df8d88c92c9 100644
--- a/java/test/Ice/retry/Client.java
+++ b/java/test/Ice/retry/Client.java
@@ -25,11 +25,11 @@ public class Client extends test.Util.Application
{
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(argsH);
+ initData.observer = Instrumentation.getObserver();
+
initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
- //
- // For this test, we want to disable retries.
- //
- initData.properties.setProperty("Ice.RetryIntervals", "-1");
+
+ initData.properties.setProperty("Ice.RetryIntervals", "0 10 20 30");
//
// We don't want connection warnings because of the timeout
diff --git a/java/test/Ice/retry/Collocated.java b/java/test/Ice/retry/Collocated.java
new file mode 100644
index 00000000000..388d6888f30
--- /dev/null
+++ b/java/test/Ice/retry/Collocated.java
@@ -0,0 +1,57 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.retry;
+
+import test.Ice.retry.Test.RetryPrx;
+
+public class Collocated extends test.Util.Application
+{
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new RetryI(), communicator.stringToIdentity("retry"));
+ //adapter.activate();
+
+ RetryPrx retry = AllTests.allTests(communicator, getWriter());
+ retry.shutdown();
+ return 0;
+ }
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.observer = Instrumentation.getObserver();
+
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+
+ initData.properties.setProperty("Ice.RetryIntervals", "0 10 20 30");
+
+ //
+ // We don't want connection warnings because of the timeout
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
+
diff --git a/java/test/Ice/retry/Instrumentation.java b/java/test/Ice/retry/Instrumentation.java
new file mode 100644
index 00000000000..05916a2293d
--- /dev/null
+++ b/java/test/Ice/retry/Instrumentation.java
@@ -0,0 +1,184 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.retry;
+
+public class Instrumentation
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static class InvocationObserverI implements Ice.Instrumentation.InvocationObserver
+ {
+ public void
+ attach()
+ {
+ }
+
+ public void
+ detach()
+ {
+ synchronized(Instrumentation.class)
+ {
+ ++nInvocation.value;
+ }
+ }
+
+ public void
+ failed(String msg)
+ {
+ synchronized(Instrumentation.class)
+ {
+ ++nFailure.value;
+ }
+ }
+
+ public void
+ retried()
+ {
+ synchronized(Instrumentation.class)
+ {
+ ++nRetry.value;
+ }
+ }
+
+ public void
+ userException()
+ {
+ }
+
+ public Ice.Instrumentation.RemoteObserver
+ getRemoteObserver(Ice.ConnectionInfo ci, Ice.Endpoint ei, int i, int j)
+ {
+ return null;
+ }
+
+ public Ice.Instrumentation.RemoteObserver
+ getCollocatedObserver(int i , int j)
+ {
+ return null;
+ }
+
+ };
+ static private Ice.Instrumentation.InvocationObserver invocationObserver = new InvocationObserverI();
+
+ static class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
+ {
+ public Ice.Instrumentation.Observer
+ getConnectionEstablishmentObserver(Ice.Endpoint e, String s)
+ {
+ return null;
+ }
+
+ public Ice.Instrumentation.Observer
+ getEndpointLookupObserver(Ice.Endpoint e)
+ {
+ return null;
+ }
+
+ public Ice.Instrumentation.ConnectionObserver
+ getConnectionObserver(Ice.ConnectionInfo ci,
+ Ice.Endpoint ei,
+ Ice.Instrumentation.ConnectionState s,
+ Ice.Instrumentation.ConnectionObserver o)
+ {
+ return null;
+ }
+
+ public Ice.Instrumentation.ThreadObserver
+ getThreadObserver(String p,
+ String n,
+ Ice.Instrumentation.ThreadState s,
+ Ice.Instrumentation.ThreadObserver o)
+ {
+ return null;
+ }
+
+ public Ice.Instrumentation.InvocationObserver
+ getInvocationObserver(Ice.ObjectPrx p, String o, java.util.Map<String, String> c)
+ {
+ return invocationObserver;
+ }
+
+ public Ice.Instrumentation.DispatchObserver
+ getDispatchObserver(Ice.Current c, int i)
+ {
+ return null;
+ }
+
+ public void
+ setObserverUpdater(Ice.Instrumentation.ObserverUpdater u)
+ {
+ }
+ };
+
+ static private Ice.Instrumentation.CommunicatorObserver communicatorObserver = new CommunicatorObserverI();
+
+ static public Ice.Instrumentation.CommunicatorObserver
+ getObserver()
+ {
+ return communicatorObserver;
+ }
+
+ static private void
+ testEqual(Ice.IntHolder value, int expected)
+ {
+ int retry = 0;
+ while(retry < 100)
+ {
+ synchronized(Instrumentation.class)
+ {
+ if(value.value == expected)
+ {
+ break;
+ }
+ }
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ if(value.value != expected)
+ {
+ System.err.println("value = " + value.value + ", expected = " + expected);
+ test(false);
+ }
+ }
+
+ static public void
+ testRetryCount(int expected)
+ {
+ testEqual(nRetry, expected);
+ }
+
+ static public void
+ testFailureCount(int expected)
+ {
+ testEqual(nFailure, expected);
+ }
+
+ static public void
+ testInvocationCount(int expected)
+ {
+ testEqual(nInvocation, expected);
+ }
+
+ static private Ice.IntHolder nRetry = new Ice.IntHolder(0);
+ static private Ice.IntHolder nFailure = new Ice.IntHolder(0);
+ static private Ice.IntHolder nInvocation = new Ice.IntHolder(0);
+};
diff --git a/java/test/Ice/retry/RetryI.java b/java/test/Ice/retry/RetryI.java
index 22a98b566ad..ae336cac007 100644
--- a/java/test/Ice/retry/RetryI.java
+++ b/java/test/Ice/retry/RetryI.java
@@ -22,13 +22,66 @@ public final class RetryI extends _RetryDisp
{
if(kill)
{
- current.con.close(true);
+ if(current.con != null)
+ {
+ current.con.close(true);
+ }
+ else
+ {
+ throw new Ice.ConnectionLostException();
+ }
}
}
+ public int
+ opIdempotent(int counter, Ice.Current current)
+ {
+ if(counter + nRetry > _counter)
+ {
+ ++_counter;
+ if(current.con != null)
+ {
+ current.con.close(true);
+ }
+ else
+ {
+ throw new Ice.ConnectionLostException();
+ }
+ }
+ return _counter;
+ }
+
+ public void
+ opNotIdempotent(int counter, Ice.Current current)
+ {
+ if(_counter != counter)
+ {
+ return;
+ }
+
+ ++_counter;
+ if(current.con != null)
+ {
+ current.con.close(true);
+ }
+ else
+ {
+ throw new Ice.ConnectionLostException();
+ }
+ }
+
+ public void
+ opSystemException(Ice.Current c)
+ {
+ throw new SystemFailure();
+ }
+
public void
shutdown(Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
+
+ private int _counter;
+ static final int nRetry = 4;
}
diff --git a/java/test/Ice/retry/SystemFailure.java b/java/test/Ice/retry/SystemFailure.java
new file mode 100644
index 00000000000..f6c81c39694
--- /dev/null
+++ b/java/test/Ice/retry/SystemFailure.java
@@ -0,0 +1,19 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.retry;
+
+class SystemFailure extends Ice.SystemException
+{
+ public String
+ ice_name()
+ {
+ return "SystemFailure";
+ }
+};
diff --git a/java/test/Ice/retry/Test.ice b/java/test/Ice/retry/Test.ice
index 8b749ba2f6a..aeffa8e72fc 100644
--- a/java/test/Ice/retry/Test.ice
+++ b/java/test/Ice/retry/Test.ice
@@ -16,6 +16,11 @@ module Test
interface Retry
{
void op(bool kill);
+
+ idempotent int opIdempotent(int c);
+ void opNotIdempotent(int c);
+ void opSystemException();
+
void shutdown();
};
diff --git a/java/test/Ice/retry/run.py b/java/test/Ice/retry/run.py
index 33fc2e8f3ac..a40df1a1bcb 100755
--- a/java/test/Ice/retry/run.py
+++ b/java/test/Ice/retry/run.py
@@ -20,4 +20,7 @@ if len(path) == 0:
sys.path.append(os.path.join(path[0], "scripts"))
import TestUtil
+print("tests with regular server.")
TestUtil.clientServerTest()
+print("tests with collocated server.")
+TestUtil.collocatedTest()
diff --git a/java/test/Ice/servantLocator/AllTests.java b/java/test/Ice/servantLocator/AllTests.java
index a66a8906a61..15273a5b687 100644
--- a/java/test/Ice/servantLocator/AllTests.java
+++ b/java/test/Ice/servantLocator/AllTests.java
@@ -36,7 +36,7 @@ public class AllTests
}
public static void
- testExceptions(TestIntfPrx obj, boolean collocated)
+ testExceptions(TestIntfPrx obj)
{
try
{
@@ -45,12 +45,9 @@ public class AllTests
}
catch(ObjectNotExistException ex)
{
- if(!collocated)
- {
- test(ex.id.equals(obj.ice_getIdentity()));
- test(ex.facet.equals(obj.ice_getFacet()));
- test(ex.operation.equals("requestFailedException"));
- }
+ test(ex.id.equals(obj.ice_getIdentity()));
+ test(ex.facet.equals(obj.ice_getFacet()));
+ test(ex.operation.equals("requestFailedException"));
}
try
@@ -210,9 +207,9 @@ public class AllTests
}
public static TestIntfPrx
- allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ allTests(Ice.Communicator communicator, PrintWriter out)
{
- out.print("testing stringToProxy... ");
+ out.print("testing stringToProxy... ");
out.flush();
String ref = "asm:default -p 12010";
Ice.ObjectPrx base = communicator.stringToProxy(ref);
@@ -298,14 +295,14 @@ public class AllTests
out.flush();
base = communicator.stringToProxy("category/locate:default -p 12010");
obj = TestIntfPrxHelper.checkedCast(base);
- testExceptions(obj, collocated);
+ testExceptions(obj);
out.println("ok");
out.print("testing finished exceptions... ");
out.flush();
base = communicator.stringToProxy("category/finished:default -p 12010");
obj = TestIntfPrxHelper.checkedCast(base);
- testExceptions(obj, collocated);
+ testExceptions(obj);
//
// Only call these for category/finished.
diff --git a/java/test/Ice/servantLocator/Client.java b/java/test/Ice/servantLocator/Client.java
index 00097374f4d..6b173584769 100644
--- a/java/test/Ice/servantLocator/Client.java
+++ b/java/test/Ice/servantLocator/Client.java
@@ -15,7 +15,7 @@ public class Client extends test.Util.Application
{
public int run(String[] args)
{
- TestIntfPrx obj = AllTests.allTests(communicator(), false, getWriter());
+ TestIntfPrx obj = AllTests.allTests(communicator(), getWriter());
obj.shutdown();
return 0;
}
diff --git a/java/test/Ice/servantLocator/Collocated.java b/java/test/Ice/servantLocator/Collocated.java
index 8d53f1206bb..0c0d2d9e35d 100644
--- a/java/test/Ice/servantLocator/Collocated.java
+++ b/java/test/Ice/servantLocator/Collocated.java
@@ -18,7 +18,7 @@ public class Collocated extends test.Util.Application
adapter.addServantLocator(new ServantLocatorI(""), "");
adapter.add(new TestI(), communicator().stringToIdentity("asm"));
adapter.add(new TestActivationI(), communicator().stringToIdentity("test/activation"));
- AllTests.allTests(communicator(), true, getWriter());
+ AllTests.allTests(communicator(), getWriter());
return 0;
}
diff --git a/java/test/Ice/timeout/AllTests.java b/java/test/Ice/timeout/AllTests.java
index 20614e308fb..0d2a1cc2f05 100644
--- a/java/test/Ice/timeout/AllTests.java
+++ b/java/test/Ice/timeout/AllTests.java
@@ -428,6 +428,69 @@ public class AllTests
}
out.println("ok");
+ out.print("testing invocation timeouts with collocated calls... ");
+ out.flush();
+ {
+ communicator.getProperties().setProperty("TimeoutCollocated.AdapterId", "timeoutAdapter");
+
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TimeoutCollocated");
+ adapter.activate();
+
+ TimeoutPrx proxy = TimeoutPrxHelper.uncheckedCast(adapter.addWithUUID(new TimeoutI()));
+ proxy = (TimeoutPrx)proxy.ice_invocationTimeout(100);
+ try
+ {
+ proxy.sleep(150);
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ }
+
+ try
+ {
+ proxy.end_sleep(proxy.begin_sleep(150));
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ }
+
+ ((TimeoutPrx)proxy.ice_invocationTimeout(-1)).ice_ping();
+
+ TimeoutPrx batchTimeout = (TimeoutPrx)proxy.ice_batchOneway();
+ batchTimeout.ice_ping();
+ batchTimeout.ice_ping();
+ batchTimeout.ice_ping();
+
+ ((TimeoutPrx)proxy.ice_invocationTimeout(-1)).begin_sleep(150); // Keep the server thread pool busy.
+ try
+ {
+ batchTimeout.ice_flushBatchRequests();
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ }
+
+ batchTimeout.ice_ping();
+ batchTimeout.ice_ping();
+ batchTimeout.ice_ping();
+
+ ((TimeoutPrx)proxy.ice_invocationTimeout(-1)).begin_sleep(150); // Keep the server thread pool busy.
+ try
+ {
+ batchTimeout.end_ice_flushBatchRequests(batchTimeout.begin_ice_flushBatchRequests());
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ }
+
+ adapter.destroy();
+ }
+ out.println("ok");
+
return timeout;
}
}
diff --git a/java/test/Slice/generation/list-generated.out b/java/test/Slice/generation/list-generated.out
index d5e237fd5b7..cbacf36a41c 100644
--- a/java/test/Slice/generation/list-generated.out
+++ b/java/test/Slice/generation/list-generated.out
@@ -9,9 +9,6 @@
<file name="classes/test/Slice/generation/Test/Interface1PrxHolder.java"/>
<file name="classes/test/Slice/generation/Test/Interface1PrxHelper.java"/>
<file name="classes/test/Slice/generation/Test/Interface1Prx.java"/>
- <file name="classes/test/Slice/generation/Test/_Interface1Del.java"/>
- <file name="classes/test/Slice/generation/Test/_Interface1DelM.java"/>
- <file name="classes/test/Slice/generation/Test/_Interface1DelD.java"/>
<file name="classes/test/Slice/generation/Test/_Interface1Disp.java"/>
<file name="classes/test/Slice/generation/Test/Callback_Interface1_method.java"/>
<output></output>
@@ -25,9 +22,6 @@
<file name="classes/test/Slice/generation/Test/Interface2PrxHolder.java"/>
<file name="classes/test/Slice/generation/Test/Interface2PrxHelper.java"/>
<file name="classes/test/Slice/generation/Test/Interface2Prx.java"/>
- <file name="classes/test/Slice/generation/Test/_Interface2Del.java"/>
- <file name="classes/test/Slice/generation/Test/_Interface2DelM.java"/>
- <file name="classes/test/Slice/generation/Test/_Interface2DelD.java"/>
<file name="classes/test/Slice/generation/Test/_Interface2Disp.java"/>
<file name="classes/test/Slice/generation/Test/Callback_Interface2_method.java"/>
<output></output>