summaryrefslogtreecommitdiff
path: root/java/src/Ice
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/Ice')
-rw-r--r--java/src/Ice/AMI_Object_ice_invoke.java50
-rw-r--r--java/src/Ice/Application.java332
-rw-r--r--java/src/Ice/BlobjectAsync.java22
-rw-r--r--java/src/Ice/CommunicatorI.java44
-rw-r--r--java/src/Ice/ConnectionI.java4182
-rw-r--r--java/src/Ice/ImplicitContextI.java646
-rw-r--r--java/src/Ice/InputStreamI.java2
-rw-r--r--java/src/Ice/LocalException.java18
-rw-r--r--java/src/Ice/LoggerI.java64
-rw-r--r--java/src/Ice/ObjectAdapterI.java1650
-rw-r--r--java/src/Ice/ObjectHolder.java22
-rw-r--r--java/src/Ice/ObjectImpl.java86
-rw-r--r--java/src/Ice/ObjectPrxHelper.java92
-rw-r--r--java/src/Ice/ObjectPrxHelperBase.java398
-rw-r--r--java/src/Ice/PluginManagerI.java350
-rw-r--r--java/src/Ice/PropertiesI.java172
-rw-r--r--java/src/Ice/ProxyIdentityFacetKey.java20
-rw-r--r--java/src/Ice/ProxyIdentityKey.java24
-rw-r--r--java/src/Ice/SysLoggerI.java80
-rw-r--r--java/src/Ice/UserException.java18
-rw-r--r--java/src/Ice/Util.java222
-rw-r--r--java/src/Ice/_AMD_Object_ice_invoke.java24
-rw-r--r--java/src/Ice/_ObjectDelD.java72
-rw-r--r--java/src/Ice/_ObjectDelM.java248
24 files changed, 4419 insertions, 4419 deletions
diff --git a/java/src/Ice/AMI_Object_ice_invoke.java b/java/src/Ice/AMI_Object_ice_invoke.java
index 54268e3ea61..1965ac41b48 100644
--- a/java/src/Ice/AMI_Object_ice_invoke.java
+++ b/java/src/Ice/AMI_Object_ice_invoke.java
@@ -15,35 +15,35 @@ public abstract class AMI_Object_ice_invoke extends IceInternal.OutgoingAsync
public abstract void ice_exception(LocalException ex);
public final void __invoke(Ice.ObjectPrx prx, String operation, OperationMode mode,
- byte[] inParams, java.util.Map context)
+ byte[] inParams, java.util.Map context)
{
- try
- {
- __prepare(prx, operation, mode, context);
- __os.writeBlob(inParams);
- __os.endWriteEncaps();
- }
- catch(LocalException ex)
- {
- __finished(ex);
- return;
- }
- __send();
+ try
+ {
+ __prepare(prx, operation, mode, context);
+ __os.writeBlob(inParams);
+ __os.endWriteEncaps();
+ }
+ catch(LocalException ex)
+ {
+ __finished(ex);
+ return;
+ }
+ __send();
}
protected final void __response(boolean ok) // ok == true means no user exception.
{
- byte[] outParams;
- try
- {
- int sz = __is.getReadEncapsSize();
- outParams = __is.readBlob(sz);
- }
- catch(LocalException ex)
- {
- __finished(ex);
- return;
- }
- ice_response(ok, outParams);
+ byte[] outParams;
+ try
+ {
+ int sz = __is.getReadEncapsSize();
+ outParams = __is.readBlob(sz);
+ }
+ catch(LocalException ex)
+ {
+ __finished(ex);
+ return;
+ }
+ ice_response(ok, outParams);
}
}
diff --git a/java/src/Ice/Application.java b/java/src/Ice/Application.java
index 2facc7f362d..8e83712269e 100644
--- a/java/src/Ice/Application.java
+++ b/java/src/Ice/Application.java
@@ -36,10 +36,10 @@ public abstract class Application
InitializationData initData = new InitializationData();
if(configFile != null)
{
- try
+ try
{
- initData.properties = Util.createProperties();
- initData.properties.load(configFile);
+ initData.properties = Util.createProperties();
+ initData.properties.load(configFile);
}
catch(LocalException ex)
{
@@ -54,7 +54,7 @@ public abstract class Application
return 1;
}
}
- return main(appName, args, initData);
+ return main(appName, args, initData);
}
/**
@@ -68,8 +68,8 @@ public abstract class Application
{
try
{
- initData.properties = Util.createProperties();
- initData.properties.load(configFile);
+ initData.properties = Util.createProperties();
+ initData.properties.load(configFile);
}
catch(LocalException ex)
{
@@ -84,8 +84,8 @@ public abstract class Application
return 1;
}
}
- initData.logger = logger;
- return main(appName, args, initData);
+ initData.logger = logger;
+ return main(appName, args, initData);
}
public final int
@@ -103,7 +103,7 @@ public abstract class Application
try
{
- StringSeqHolder argHolder = new StringSeqHolder(args);
+ StringSeqHolder argHolder = new StringSeqHolder(args);
_communicator = Util.initialize(argHolder, initData);
//
@@ -125,46 +125,46 @@ public abstract class Application
ex.printStackTrace();
status = 1;
}
- catch(java.lang.Error err)
- {
- //
- // We catch Error to avoid hangs in some non-fatal situations
- //
- System.err.println(_appName + ": Java error");
+ catch(java.lang.Error err)
+ {
+ //
+ // We catch Error to avoid hangs in some non-fatal situations
+ //
+ System.err.println(_appName + ": Java error");
err.printStackTrace();
status = 1;
- }
-
- // This clears any set interrupt.
- defaultInterrupt();
-
- synchronized(_mutex)
- {
- while(_callbackInProgress)
- {
- try
- {
- _mutex.wait();
- }
- catch(java.lang.InterruptedException ex)
- {
- }
- }
-
- if(_destroyed)
- {
- _communicator = null;
- }
- else
- {
- _destroyed = true;
- //
- // And _communicator != null, meaning will be
- // destroyed next, _destroyed = true also ensures that
- // any remaining callback won't do anything
- //
- }
- }
+ }
+
+ // This clears any set interrupt.
+ defaultInterrupt();
+
+ synchronized(_mutex)
+ {
+ while(_callbackInProgress)
+ {
+ try
+ {
+ _mutex.wait();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ if(_destroyed)
+ {
+ _communicator = null;
+ }
+ else
+ {
+ _destroyed = true;
+ //
+ // And _communicator != null, meaning will be
+ // destroyed next, _destroyed = true also ensures that
+ // any remaining callback won't do anything
+ //
+ }
+ }
if(_communicator != null)
{
@@ -228,48 +228,48 @@ public abstract class Application
destroyOnInterrupt()
{
synchronized(_mutex)
- {
- //
- // As soon as the destroy hook ends all the threads are
- // terminated. So the destroy hook will join the current
- // thread before to end.
- //
- try
- {
- changeHook(new DestroyHook());
- }
- catch(java.lang.IllegalStateException ex)
- {
- if(_communicator != null)
- {
- _communicator.destroy();
- }
- }
- }
+ {
+ //
+ // As soon as the destroy hook ends all the threads are
+ // terminated. So the destroy hook will join the current
+ // thread before to end.
+ //
+ try
+ {
+ changeHook(new DestroyHook());
+ }
+ catch(java.lang.IllegalStateException ex)
+ {
+ if(_communicator != null)
+ {
+ _communicator.destroy();
+ }
+ }
+ }
}
public static void
shutdownOnInterrupt()
{
synchronized(_mutex)
- {
- //
- // As soon as the shutdown hook ends all the threads are
- // terminated. So the shutdown hook will join the current
- // thread before to end.
- //
- try
- {
- changeHook(new ShutdownHook());
- }
- catch(java.lang.IllegalStateException ex)
- {
- if(_communicator != null)
- {
- _communicator.shutdown();
- }
- }
- }
+ {
+ //
+ // As soon as the shutdown hook ends all the threads are
+ // terminated. So the shutdown hook will join the current
+ // thread before to end.
+ //
+ try
+ {
+ changeHook(new ShutdownHook());
+ }
+ catch(java.lang.IllegalStateException ex)
+ {
+ if(_communicator != null)
+ {
+ _communicator.shutdown();
+ }
+ }
+ }
}
//
@@ -284,14 +284,14 @@ public abstract class Application
public static void
setInterruptHook(java.lang.Thread newHook) // Pun intended.
{
- try
- {
- changeHook(new CustomHook(newHook));
- }
- catch(java.lang.IllegalStateException ex)
- {
- // Ignore.
- }
+ try
+ {
+ changeHook(new CustomHook(newHook));
+ }
+ catch(java.lang.IllegalStateException ex)
+ {
+ // Ignore.
+ }
}
//
@@ -300,81 +300,81 @@ public abstract class Application
public static void
defaultInterrupt()
{
- changeHook(null);
+ changeHook(null);
}
public static boolean
interrupted()
{
synchronized(_mutex)
- {
- return _interrupted;
- }
+ {
+ return _interrupted;
+ }
}
private static void
changeHook(AppHook newHook)
{
synchronized(_mutex)
- {
- //
- // Remove any existing shutdown hooks.
- //
- try
- {
- if(_appHook != null)
- {
- Runtime.getRuntime().removeShutdownHook(_appHook);
- _appHook.done();
+ {
+ //
+ // Remove any existing shutdown hooks.
+ //
+ try
+ {
+ if(_appHook != null)
+ {
+ Runtime.getRuntime().removeShutdownHook(_appHook);
+ _appHook.done();
_appHook = null;
- }
- }
- catch(java.lang.IllegalStateException ex)
- {
- //
- // Expected if we are in the process of shutting down.
- //
- }
-
- //
- // Note that we let the IllegalStateException propogate
- // out if necessary.
- //
- if(newHook != null)
- {
- Runtime.getRuntime().addShutdownHook(newHook);
- _appHook = newHook;
- }
- }
+ }
+ }
+ catch(java.lang.IllegalStateException ex)
+ {
+ //
+ // Expected if we are in the process of shutting down.
+ //
+ }
+
+ //
+ // Note that we let the IllegalStateException propogate
+ // out if necessary.
+ //
+ if(newHook != null)
+ {
+ Runtime.getRuntime().addShutdownHook(newHook);
+ _appHook = newHook;
+ }
+ }
}
private static boolean
setCallbackInProgress(boolean destroy)
{
synchronized(_mutex)
- {
+ {
if(_destroyed)
- {
- //
- // Being destroyed by main thread
- //
- return false;
- }
- _callbackInProgress = true;
- _destroyed = destroy;
- _interrupted = true;
- return true;
- }
+ {
+ //
+ // Being destroyed by main thread
+ //
+ return false;
+ }
+ _callbackInProgress = true;
+ _destroyed = destroy;
+ _interrupted = true;
+ return true;
+ }
}
private static void
clearCallbackInProgress()
{
synchronized(_mutex)
- {
+ {
_callbackInProgress = false;
- _mutex.notify();
- }
+ _mutex.notify();
+ }
}
static class AppHook extends Thread
@@ -400,10 +400,10 @@ public abstract class Application
{
synchronized(_doneMutex)
{
- if(!setCallbackInProgress(true))
- {
- return;
- }
+ if(!setCallbackInProgress(true))
+ {
+ return;
+ }
Communicator communicator = communicator();
if(communicator != null)
@@ -411,7 +411,7 @@ public abstract class Application
communicator.destroy();
}
- clearCallbackInProgress();
+ clearCallbackInProgress();
while(!_done)
{
@@ -434,10 +434,10 @@ public abstract class Application
{
synchronized(_doneMutex)
{
- if(!setCallbackInProgress(false))
- {
- return;
- }
+ if(!setCallbackInProgress(false))
+ {
+ return;
+ }
Communicator communicator = communicator();
if(communicator != null)
@@ -445,7 +445,7 @@ public abstract class Application
communicator.shutdown();
}
- clearCallbackInProgress();
+ clearCallbackInProgress();
while(!_done)
{
@@ -467,32 +467,32 @@ public abstract class Application
// support code.
static class CustomHook extends AppHook
{
- CustomHook(Thread hook)
- {
- _hook = hook;
- }
+ CustomHook(Thread hook)
+ {
+ _hook = hook;
+ }
public void
run()
{
synchronized(_doneMutex)
{
- if(!setCallbackInProgress(false))
- {
- return;
- }
-
- _hook.run();
-
- clearCallbackInProgress();
-
- //
- // Don't bother to join with main, we're done.
- //
+ if(!setCallbackInProgress(false))
+ {
+ return;
+ }
+
+ _hook.run();
+
+ clearCallbackInProgress();
+
+ //
+ // Don't bother to join with main, we're done.
+ //
}
}
- private Thread _hook;
+ private Thread _hook;
}
private static String _appName;
diff --git a/java/src/Ice/BlobjectAsync.java b/java/src/Ice/BlobjectAsync.java
index 19f164e5df5..5418015561f 100644
--- a/java/src/Ice/BlobjectAsync.java
+++ b/java/src/Ice/BlobjectAsync.java
@@ -18,17 +18,17 @@ public abstract class BlobjectAsync extends Ice.ObjectImpl
__dispatch(IceInternal.Incoming in, Current current)
{
byte[] inParams;
- int sz = in.is().getReadEncapsSize();
+ int sz = in.is().getReadEncapsSize();
inParams = in.is().readBlob(sz);
- AMD_Object_ice_invoke cb = new _AMD_Object_ice_invoke(in);
- try
- {
- ice_invoke_async(cb, inParams, current);
- }
- catch(java.lang.Exception ex)
- {
- cb.ice_exception(ex);
- }
- return IceInternal.DispatchStatus.DispatchAsync;
+ AMD_Object_ice_invoke cb = new _AMD_Object_ice_invoke(in);
+ try
+ {
+ ice_invoke_async(cb, inParams, current);
+ }
+ catch(java.lang.Exception ex)
+ {
+ cb.ice_exception(ex);
+ }
+ return IceInternal.DispatchStatus.DispatchAsync;
}
}
diff --git a/java/src/Ice/CommunicatorI.java b/java/src/Ice/CommunicatorI.java
index 9c97424dec1..2d0064c318f 100644
--- a/java/src/Ice/CommunicatorI.java
+++ b/java/src/Ice/CommunicatorI.java
@@ -14,19 +14,19 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator
public void
destroy()
{
- _instance.destroy();
+ _instance.destroy();
}
public void
shutdown()
{
- _instance.objectAdapterFactory().shutdown();
+ _instance.objectAdapterFactory().shutdown();
}
public void
waitForShutdown()
{
- _instance.objectAdapterFactory().waitForShutdown();
+ _instance.objectAdapterFactory().waitForShutdown();
}
public boolean
@@ -68,19 +68,19 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator
public ObjectAdapter
createObjectAdapter(String name)
{
- return _instance.objectAdapterFactory().createObjectAdapter(name, "", null);
+ return _instance.objectAdapterFactory().createObjectAdapter(name, "", null);
}
public ObjectAdapter
createObjectAdapterWithEndpoints(String name, String endpoints)
{
- return _instance.objectAdapterFactory().createObjectAdapter(name, endpoints, null);
+ return _instance.objectAdapterFactory().createObjectAdapter(name, endpoints, null);
}
public ObjectAdapter
createObjectAdapterWithRouter(String name, RouterPrx router)
{
- return _instance.objectAdapterFactory().createObjectAdapter(name, "", router);
+ return _instance.objectAdapterFactory().createObjectAdapter(name, "", router);
}
public void
@@ -143,7 +143,7 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator
public java.util.Map
getDefaultContext()
{
- return _instance.getDefaultContext();
+ return _instance.getDefaultContext();
}
/**
@@ -152,13 +152,13 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator
public void
setDefaultContext(java.util.Map ctx)
{
- _instance.setDefaultContext(ctx);
+ _instance.setDefaultContext(ctx);
}
public ImplicitContext
getImplicitContext()
{
- return _instance.getImplicitContext();
+ return _instance.getImplicitContext();
}
public PluginManager
@@ -186,10 +186,10 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator
finalize()
throws Throwable
{
- if(!_instance.destroyed())
- {
- _instance.logger().warning("Ice::Communicator::destroy() has not been called");
- }
+ if(!_instance.destroyed())
+ {
+ _instance.logger().warning("Ice::Communicator::destroy() has not been called");
+ }
super.finalize();
}
@@ -202,15 +202,15 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator
void
finishSetup(StringSeqHolder args)
{
- try
- {
- _instance.finishSetup(args);
- }
- catch(RuntimeException ex)
- {
- _instance.destroy();
- throw ex;
- }
+ try
+ {
+ _instance.finishSetup(args);
+ }
+ catch(RuntimeException ex)
+ {
+ _instance.destroy();
+ throw ex;
+ }
}
//
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java
index 4d55cb3a05b..85425864879 100644
--- a/java/src/Ice/ConnectionI.java
+++ b/java/src/Ice/ConnectionI.java
@@ -27,229 +27,229 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public void
validate()
{
- if(!_endpoint.datagram()) // Datagram connections are always implicitly validated.
- {
- boolean active;
-
- synchronized(this)
- {
- if(_thread != null && _thread != Thread.currentThread())
- {
- //
- // In thread per connection mode, this connection's thread
- // will take care of connection validation. Therefore all we
- // have to do here is to wait until this thread has completed
- // validation.
- //
- while(_state == StateNotValidated)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- if(_state >= StateClosing)
- {
- assert(_exception != null);
- throw _exception;
- }
-
- return;
- }
-
- //
- // The connection might already be closed (e.g.: the communicator
- // was destroyed or object adapter deactivated.)
- //
- assert(_state == StateNotValidated || _state == StateClosed);
- if(_state == StateClosed)
- {
- assert(_exception != null);
- throw _exception;
- }
-
- if(_adapter != null)
- {
- active = true; // The server side has the active role for connection validation.
- }
- else
- {
- active = false; // The client side has the passive role for connection validation.
- }
- }
-
- try
- {
- int timeout;
- IceInternal.DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
- if(defaultsAndOverrides.overrideConnectTimeout)
- {
- timeout = defaultsAndOverrides.overrideConnectTimeoutValue;
- }
- else
- {
- timeout = _endpoint.timeout();
- }
-
- if(active)
- {
- synchronized(_sendMutex)
- {
- if(_transceiver == null) // Has the transceiver already been closed?
- {
- assert(_exception != null);
- throw _exception; // The exception is immutable at this point.
- }
-
- IceInternal.BasicStream os = new IceInternal.BasicStream(_instance);
- os.writeBlob(IceInternal.Protocol.magic);
- os.writeByte(IceInternal.Protocol.protocolMajor);
- os.writeByte(IceInternal.Protocol.protocolMinor);
- os.writeByte(IceInternal.Protocol.encodingMajor);
- os.writeByte(IceInternal.Protocol.encodingMinor);
- os.writeByte(IceInternal.Protocol.validateConnectionMsg);
- os.writeByte((byte)0); // Compression status (always zero for validate connection).
- os.writeInt(IceInternal.Protocol.headerSize); // Message size.
- IceInternal.TraceUtil.traceHeader("sending validate connection", os, _logger, _traceLevels);
- try
- {
- _transceiver.write(os, timeout);
- }
- catch(Ice.TimeoutException ex)
- {
- throw new Ice.ConnectTimeoutException();
- }
- }
- }
- else
- {
- IceInternal.BasicStream is = new IceInternal.BasicStream(_instance);
- is.resize(IceInternal.Protocol.headerSize, true);
- is.pos(0);
- try
- {
- _transceiver.read(is, timeout);
- }
- catch(Ice.TimeoutException ex)
- {
- throw new Ice.ConnectTimeoutException();
- }
- assert(is.pos() == IceInternal.Protocol.headerSize);
- is.pos(0);
- byte[] m = is.readBlob(4);
- if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] ||
- m[2] != IceInternal.Protocol.magic[2] || m[3] != IceInternal.Protocol.magic[3])
- {
- BadMagicException ex = new BadMagicException();
- ex.badMagic = m;
- throw ex;
- }
- byte pMajor = is.readByte();
- byte pMinor = is.readByte();
- if(pMajor != IceInternal.Protocol.protocolMajor)
- {
- UnsupportedProtocolException e = new UnsupportedProtocolException();
- e.badMajor = pMajor < 0 ? pMajor + 255 : pMajor;
- e.badMinor = pMinor < 0 ? pMinor + 255 : pMinor;
- e.major = IceInternal.Protocol.protocolMajor;
- e.minor = IceInternal.Protocol.protocolMinor;
- throw e;
- }
- byte eMajor = is.readByte();
- byte eMinor = is.readByte();
- if(eMajor != IceInternal.Protocol.encodingMajor)
- {
- UnsupportedEncodingException e = new UnsupportedEncodingException();
- e.badMajor = eMajor < 0 ? eMajor + 255 : eMajor;
- e.badMinor = eMinor < 0 ? eMinor + 255 : eMinor;
- e.major = IceInternal.Protocol.encodingMajor;
- e.minor = IceInternal.Protocol.encodingMinor;
- throw e;
- }
- byte messageType = is.readByte();
- if(messageType != IceInternal.Protocol.validateConnectionMsg)
- {
- throw new ConnectionNotValidatedException();
- }
- byte compress = is.readByte(); // Ignore compression status for validate connection.
- int size = is.readInt();
- if(size != IceInternal.Protocol.headerSize)
- {
- throw new IllegalMessageSizeException();
- }
- IceInternal.TraceUtil.traceHeader("received validate connection", is, _logger, _traceLevels);
- }
- }
- catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
- {
- synchronized(this)
- {
- setState(StateClosed, ex.get());
- assert(_exception != null);
- throw _exception;
- }
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- assert(_exception != null);
- throw _exception;
- }
- }
- }
-
- synchronized(this)
- {
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
- }
-
- //
- // We start out in holding state.
- //
- setState(StateHolding);
- }
+ if(!_endpoint.datagram()) // Datagram connections are always implicitly validated.
+ {
+ boolean active;
+
+ synchronized(this)
+ {
+ if(_thread != null && _thread != Thread.currentThread())
+ {
+ //
+ // In thread per connection mode, this connection's thread
+ // will take care of connection validation. Therefore all we
+ // have to do here is to wait until this thread has completed
+ // validation.
+ //
+ while(_state == StateNotValidated)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(_state >= StateClosing)
+ {
+ assert(_exception != null);
+ throw _exception;
+ }
+
+ return;
+ }
+
+ //
+ // The connection might already be closed (e.g.: the communicator
+ // was destroyed or object adapter deactivated.)
+ //
+ assert(_state == StateNotValidated || _state == StateClosed);
+ if(_state == StateClosed)
+ {
+ assert(_exception != null);
+ throw _exception;
+ }
+
+ if(_adapter != null)
+ {
+ active = true; // The server side has the active role for connection validation.
+ }
+ else
+ {
+ active = false; // The client side has the passive role for connection validation.
+ }
+ }
+
+ try
+ {
+ int timeout;
+ IceInternal.DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ if(defaultsAndOverrides.overrideConnectTimeout)
+ {
+ timeout = defaultsAndOverrides.overrideConnectTimeoutValue;
+ }
+ else
+ {
+ timeout = _endpoint.timeout();
+ }
+
+ if(active)
+ {
+ synchronized(_sendMutex)
+ {
+ if(_transceiver == null) // Has the transceiver already been closed?
+ {
+ assert(_exception != null);
+ throw _exception; // The exception is immutable at this point.
+ }
+
+ IceInternal.BasicStream os = new IceInternal.BasicStream(_instance);
+ os.writeBlob(IceInternal.Protocol.magic);
+ os.writeByte(IceInternal.Protocol.protocolMajor);
+ os.writeByte(IceInternal.Protocol.protocolMinor);
+ os.writeByte(IceInternal.Protocol.encodingMajor);
+ os.writeByte(IceInternal.Protocol.encodingMinor);
+ os.writeByte(IceInternal.Protocol.validateConnectionMsg);
+ os.writeByte((byte)0); // Compression status (always zero for validate connection).
+ os.writeInt(IceInternal.Protocol.headerSize); // Message size.
+ IceInternal.TraceUtil.traceHeader("sending validate connection", os, _logger, _traceLevels);
+ try
+ {
+ _transceiver.write(os, timeout);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ throw new Ice.ConnectTimeoutException();
+ }
+ }
+ }
+ else
+ {
+ IceInternal.BasicStream is = new IceInternal.BasicStream(_instance);
+ is.resize(IceInternal.Protocol.headerSize, true);
+ is.pos(0);
+ try
+ {
+ _transceiver.read(is, timeout);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ throw new Ice.ConnectTimeoutException();
+ }
+ assert(is.pos() == IceInternal.Protocol.headerSize);
+ is.pos(0);
+ byte[] m = is.readBlob(4);
+ if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] ||
+ m[2] != IceInternal.Protocol.magic[2] || m[3] != IceInternal.Protocol.magic[3])
+ {
+ BadMagicException ex = new BadMagicException();
+ ex.badMagic = m;
+ throw ex;
+ }
+ byte pMajor = is.readByte();
+ byte pMinor = is.readByte();
+ if(pMajor != IceInternal.Protocol.protocolMajor)
+ {
+ UnsupportedProtocolException e = new UnsupportedProtocolException();
+ e.badMajor = pMajor < 0 ? pMajor + 255 : pMajor;
+ e.badMinor = pMinor < 0 ? pMinor + 255 : pMinor;
+ e.major = IceInternal.Protocol.protocolMajor;
+ e.minor = IceInternal.Protocol.protocolMinor;
+ throw e;
+ }
+ byte eMajor = is.readByte();
+ byte eMinor = is.readByte();
+ if(eMajor != IceInternal.Protocol.encodingMajor)
+ {
+ UnsupportedEncodingException e = new UnsupportedEncodingException();
+ e.badMajor = eMajor < 0 ? eMajor + 255 : eMajor;
+ e.badMinor = eMinor < 0 ? eMinor + 255 : eMinor;
+ e.major = IceInternal.Protocol.encodingMajor;
+ e.minor = IceInternal.Protocol.encodingMinor;
+ throw e;
+ }
+ byte messageType = is.readByte();
+ if(messageType != IceInternal.Protocol.validateConnectionMsg)
+ {
+ throw new ConnectionNotValidatedException();
+ }
+ byte compress = is.readByte(); // Ignore compression status for validate connection.
+ int size = is.readInt();
+ if(size != IceInternal.Protocol.headerSize)
+ {
+ throw new IllegalMessageSizeException();
+ }
+ IceInternal.TraceUtil.traceHeader("received validate connection", is, _logger, _traceLevels);
+ }
+ }
+ catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex.get());
+ assert(_exception != null);
+ throw _exception;
+ }
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ assert(_exception != null);
+ throw _exception;
+ }
+ }
+ }
+
+ synchronized(this)
+ {
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
+ }
+
+ //
+ // We start out in holding state.
+ //
+ setState(StateHolding);
+ }
}
public synchronized void
activate()
{
- while(_state == StateNotValidated)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- setState(StateActive);
+ while(_state == StateNotValidated)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ setState(StateActive);
}
public synchronized void
hold()
{
- while(_state == StateNotValidated)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- setState(StateHolding);
+ while(_state == StateNotValidated)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ setState(StateHolding);
}
// DestructionReason.
@@ -259,93 +259,93 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public synchronized void
destroy(int reason)
{
- switch(reason)
- {
- case ObjectAdapterDeactivated:
- {
- setState(StateClosing, new ObjectAdapterDeactivatedException());
- break;
- }
-
- case CommunicatorDestroyed:
- {
- setState(StateClosing, new CommunicatorDestroyedException());
- break;
- }
- }
+ switch(reason)
+ {
+ case ObjectAdapterDeactivated:
+ {
+ setState(StateClosing, new ObjectAdapterDeactivatedException());
+ break;
+ }
+
+ case CommunicatorDestroyed:
+ {
+ setState(StateClosing, new CommunicatorDestroyedException());
+ break;
+ }
+ }
}
public synchronized void
close(boolean force)
{
- if(force)
- {
- setState(StateClosed, new ForcedCloseConnectionException());
- }
- else
- {
- //
- // If we do a graceful shutdown, then we wait until all
- // outstanding requests have been completed. Otherwise,
- // the CloseConnectionException will cause all outstanding
- // requests to be retried, regardless of whether the
- // server has processed them or not.
- //
- while(!_requests.isEmpty() || !_asyncRequests.isEmpty())
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- setState(StateClosing, new CloseConnectionException());
- }
+ if(force)
+ {
+ setState(StateClosed, new ForcedCloseConnectionException());
+ }
+ else
+ {
+ //
+ // If we do a graceful shutdown, then we wait until all
+ // outstanding requests have been completed. Otherwise,
+ // the CloseConnectionException will cause all outstanding
+ // requests to be retried, regardless of whether the
+ // server has processed them or not.
+ //
+ while(!_requests.isEmpty() || !_asyncRequests.isEmpty())
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ setState(StateClosing, new CloseConnectionException());
+ }
}
public synchronized boolean
isDestroyed()
{
- return _state >= StateClosing;
+ return _state >= StateClosing;
}
public boolean
isFinished()
{
- Thread threadPerConnection = null;
-
- synchronized(this)
- {
- if(_transceiver != null || _dispatchCount != 0 || (_thread != null && _thread.isAlive()))
- {
- return false;
- }
-
- assert(_state == StateClosed);
-
- threadPerConnection = _thread;
- _thread = null;
- }
-
- if(threadPerConnection != null)
- {
- while(true)
- {
- try
- {
- threadPerConnection.join();
- break;
- }
- catch(InterruptedException ex)
- {
- }
- }
- }
-
- return true;
+ Thread threadPerConnection = null;
+
+ synchronized(this)
+ {
+ if(_transceiver != null || _dispatchCount != 0 || (_thread != null && _thread.isAlive()))
+ {
+ return false;
+ }
+
+ assert(_state == StateClosed);
+
+ threadPerConnection = _thread;
+ _thread = null;
+ }
+
+ if(threadPerConnection != null)
+ {
+ while(true)
+ {
+ try
+ {
+ threadPerConnection.join();
+ break;
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ return true;
}
public synchronized void
@@ -361,457 +361,457 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public synchronized void
waitUntilHolding()
{
- while(_state < StateHolding || _dispatchCount > 0)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
+ while(_state < StateHolding || _dispatchCount > 0)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
}
}
public void
waitUntilFinished()
{
- Thread threadPerConnection = null;
-
- synchronized(this)
- {
- //
- // We wait indefinitely until connection closing has been
- // initiated. We also wait indefinitely until all outstanding
- // requests are completed. Otherwise we couldn't guarantee
- // that there are no outstanding calls when deactivate() is
- // called on the servant locators.
- //
- while(_state < StateClosing || _dispatchCount > 0)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- //
- // Now we must wait until close() has been called on the
- // transceiver.
- //
- while(_transceiver != null)
- {
- try
- {
- if(_state != StateClosed && _endpoint.timeout() >= 0)
- {
- long absoluteWaitTime = _stateTime + _endpoint.timeout();
- long waitTime = absoluteWaitTime - System.currentTimeMillis();
-
- if(waitTime > 0)
- {
- //
- // We must wait a bit longer until we close this
- // connection.
- //
- wait(waitTime);
- if(System.currentTimeMillis() >= absoluteWaitTime)
- {
- setState(StateClosed, new CloseTimeoutException());
- }
- }
- else
- {
- //
- // We already waited long enough, so let's close this
- // connection!
- //
- setState(StateClosed, new CloseTimeoutException());
- }
-
- //
- // No return here, we must still wait until
- // close() is called on the _transceiver.
- //
- }
- else
- {
- wait();
- }
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- assert(_state == StateClosed);
-
- threadPerConnection = _thread;
- _thread = null;
+ Thread threadPerConnection = null;
+
+ synchronized(this)
+ {
+ //
+ // We wait indefinitely until connection closing has been
+ // initiated. We also wait indefinitely until all outstanding
+ // requests are completed. Otherwise we couldn't guarantee
+ // that there are no outstanding calls when deactivate() is
+ // called on the servant locators.
+ //
+ while(_state < StateClosing || _dispatchCount > 0)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ //
+ // Now we must wait until close() has been called on the
+ // transceiver.
+ //
+ while(_transceiver != null)
+ {
+ try
+ {
+ if(_state != StateClosed && _endpoint.timeout() >= 0)
+ {
+ long absoluteWaitTime = _stateTime + _endpoint.timeout();
+ long waitTime = absoluteWaitTime - System.currentTimeMillis();
+
+ if(waitTime > 0)
+ {
+ //
+ // We must wait a bit longer until we close this
+ // connection.
+ //
+ wait(waitTime);
+ if(System.currentTimeMillis() >= absoluteWaitTime)
+ {
+ setState(StateClosed, new CloseTimeoutException());
+ }
+ }
+ else
+ {
+ //
+ // We already waited long enough, so let's close this
+ // connection!
+ //
+ setState(StateClosed, new CloseTimeoutException());
+ }
+
+ //
+ // No return here, we must still wait until
+ // close() is called on the _transceiver.
+ //
+ }
+ else
+ {
+ wait();
+ }
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ assert(_state == StateClosed);
+
+ threadPerConnection = _thread;
+ _thread = null;
//
// Clear the OA. See bug 1673 for the details of why this is necessary.
//
_adapter = null;
- }
-
- if(threadPerConnection != null)
- {
- while(true)
- {
- try
- {
- threadPerConnection.join();
- break;
- }
- catch(InterruptedException ex)
- {
- }
- }
- }
+ }
+
+ if(threadPerConnection != null)
+ {
+ while(true)
+ {
+ try
+ {
+ threadPerConnection.join();
+ break;
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
}
public synchronized void
monitor()
{
- if(_state != StateActive)
- {
- return;
- }
-
- //
- // Check for timed out async requests.
- //
- java.util.Iterator i = _asyncRequests.entryIterator();
- while(i.hasNext())
- {
- IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next();
- IceInternal.OutgoingAsync out = (IceInternal.OutgoingAsync)e.getValue();
- if(out.__timedOut())
- {
- setState(StateClosed, new TimeoutException());
- return;
- }
- }
-
- //
- // Active connection management for idle connections.
- //
- if(_acmTimeout > 0 &&
- _requests.isEmpty() && _asyncRequests.isEmpty() &&
- !_batchStreamInUse && _batchStream.isEmpty() &&
- _dispatchCount == 0)
- {
- if(System.currentTimeMillis() >= _acmAbsoluteTimeoutMillis)
- {
- setState(StateClosing, new ConnectionTimeoutException());
- return;
- }
- }
+ if(_state != StateActive)
+ {
+ return;
+ }
+
+ //
+ // Check for timed out async requests.
+ //
+ java.util.Iterator i = _asyncRequests.entryIterator();
+ while(i.hasNext())
+ {
+ IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next();
+ IceInternal.OutgoingAsync out = (IceInternal.OutgoingAsync)e.getValue();
+ if(out.__timedOut())
+ {
+ setState(StateClosed, new TimeoutException());
+ return;
+ }
+ }
+
+ //
+ // Active connection management for idle connections.
+ //
+ if(_acmTimeout > 0 &&
+ _requests.isEmpty() && _asyncRequests.isEmpty() &&
+ !_batchStreamInUse && _batchStream.isEmpty() &&
+ _dispatchCount == 0)
+ {
+ if(System.currentTimeMillis() >= _acmAbsoluteTimeoutMillis)
+ {
+ setState(StateClosing, new ConnectionTimeoutException());
+ return;
+ }
+ }
}
public void
sendRequest(IceInternal.BasicStream os, IceInternal.Outgoing out, boolean compress)
throws IceInternal.LocalExceptionWrapper
{
- int requestId = 0;
- IceInternal.BasicStream stream = null;
-
- synchronized(this)
- {
- assert(!(out != null && _endpoint.datagram())); // Twoway requests cannot be datagrams.
-
- if(_exception != null)
- {
- //
- // If the connection is closed before we even have a chance
- // to send our request, we always try to send the request
- // again.
- //
- throw new IceInternal.LocalExceptionWrapper(_exception, true);
- }
-
- assert(_state > StateNotValidated);
- assert(_state < StateClosing);
-
- //
- // Only add to the request map if this is a twoway call.
- //
- if(out != null)
- {
- //
- // Create a new unique request ID.
- //
- requestId = _nextRequestId++;
- if(requestId <= 0)
- {
- _nextRequestId = 1;
- requestId = _nextRequestId++;
- }
-
- //
- // Fill in the request ID.
- //
- os.pos(IceInternal.Protocol.headerSize);
- os.writeInt(requestId);
-
- //
- // Add to the requests map.
- //
- _requests.put(requestId, out);
- }
-
- stream = doCompress(os, _overrideCompress ? _overrideCompressValue : compress);
-
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
- }
- }
-
- try
- {
- synchronized(_sendMutex)
- {
- if(_transceiver == null) // Has the transceiver already been closed?
- {
- assert(_exception != null);
- throw _exception; // The exception is immutable at this point.
- }
-
- //
- // Send the request.
- //
- IceInternal.TraceUtil.traceRequest("sending request", os, _logger, _traceLevels);
- _transceiver.write(stream, _endpoint.timeout());
- }
- }
- catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
- {
- synchronized(this)
- {
- setState(StateClosed, ex.get());
- assert(_exception != null);
-
- if(out != null)
- {
- //
- // If the request has already been removed from
- // the request map, we are out of luck. It would
- // mean that finished() has been called already,
- // and therefore the exception has been set using
- // the Outgoing::finished() callback. In this
- // case, we cannot throw the exception here,
- // because we must not both raise an exception and
- // have Outgoing::finished() called with an
- // exception. This means that in some rare cases,
- // a request will not be retried even though it
- // could. But I honestly don't know how I could
- // avoid this, without a very elaborate and
- // complex design, which would be bad for
- // performance.
- //
- IceInternal.Outgoing o = (IceInternal.Outgoing)_requests.remove(requestId);
- if(o != null)
- {
- assert(o == out);
- throw new IceInternal.LocalExceptionWrapper(_exception, ex.retry());
- }
- }
- else
- {
- throw new IceInternal.LocalExceptionWrapper(_exception, ex.retry());
- }
- }
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- assert(_exception != null);
-
- if(out != null)
- {
- //
- // If the request has already been removed from
- // the request map, we are out of luck. It would
- // mean that finished() has been called already,
- // and therefore the exception has been set using
- // the Outgoing::finished() callback. In this
- // case, we cannot throw the exception here,
- // because we must not both raise an exception and
- // have Outgoing::finished() called with an
- // exception. This means that in some rare cases,
- // a request will not be retried even though it
- // could. But I honestly don't know how I could
- // avoid this, without a very elaborate and
- // complex design, which would be bad for
- // performance.
- //
- IceInternal.Outgoing o = (IceInternal.Outgoing)_requests.remove(requestId);
- if(o != null)
- {
- assert(o == out);
- throw _exception;
- }
- }
- else
- {
- throw _exception;
- }
- }
- }
+ int requestId = 0;
+ IceInternal.BasicStream stream = null;
+
+ synchronized(this)
+ {
+ assert(!(out != null && _endpoint.datagram())); // Twoway requests cannot be datagrams.
+
+ if(_exception != null)
+ {
+ //
+ // If the connection is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw new IceInternal.LocalExceptionWrapper(_exception, true);
+ }
+
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
+
+ //
+ // Only add to the request map if this is a twoway call.
+ //
+ if(out != null)
+ {
+ //
+ // Create a new unique request ID.
+ //
+ requestId = _nextRequestId++;
+ if(requestId <= 0)
+ {
+ _nextRequestId = 1;
+ requestId = _nextRequestId++;
+ }
+
+ //
+ // Fill in the request ID.
+ //
+ os.pos(IceInternal.Protocol.headerSize);
+ os.writeInt(requestId);
+
+ //
+ // Add to the requests map.
+ //
+ _requests.put(requestId, out);
+ }
+
+ stream = doCompress(os, _overrideCompress ? _overrideCompressValue : compress);
+
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
+ }
+ }
+
+ try
+ {
+ synchronized(_sendMutex)
+ {
+ if(_transceiver == null) // Has the transceiver already been closed?
+ {
+ assert(_exception != null);
+ throw _exception; // The exception is immutable at this point.
+ }
+
+ //
+ // Send the request.
+ //
+ IceInternal.TraceUtil.traceRequest("sending request", os, _logger, _traceLevels);
+ _transceiver.write(stream, _endpoint.timeout());
+ }
+ }
+ catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex.get());
+ assert(_exception != null);
+
+ if(out != null)
+ {
+ //
+ // If the request has already been removed from
+ // the request map, we are out of luck. It would
+ // mean that finished() has been called already,
+ // and therefore the exception has been set using
+ // the Outgoing::finished() callback. In this
+ // case, we cannot throw the exception here,
+ // because we must not both raise an exception and
+ // have Outgoing::finished() called with an
+ // exception. This means that in some rare cases,
+ // a request will not be retried even though it
+ // could. But I honestly don't know how I could
+ // avoid this, without a very elaborate and
+ // complex design, which would be bad for
+ // performance.
+ //
+ IceInternal.Outgoing o = (IceInternal.Outgoing)_requests.remove(requestId);
+ if(o != null)
+ {
+ assert(o == out);
+ throw new IceInternal.LocalExceptionWrapper(_exception, ex.retry());
+ }
+ }
+ else
+ {
+ throw new IceInternal.LocalExceptionWrapper(_exception, ex.retry());
+ }
+ }
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ assert(_exception != null);
+
+ if(out != null)
+ {
+ //
+ // If the request has already been removed from
+ // the request map, we are out of luck. It would
+ // mean that finished() has been called already,
+ // and therefore the exception has been set using
+ // the Outgoing::finished() callback. In this
+ // case, we cannot throw the exception here,
+ // because we must not both raise an exception and
+ // have Outgoing::finished() called with an
+ // exception. This means that in some rare cases,
+ // a request will not be retried even though it
+ // could. But I honestly don't know how I could
+ // avoid this, without a very elaborate and
+ // complex design, which would be bad for
+ // performance.
+ //
+ IceInternal.Outgoing o = (IceInternal.Outgoing)_requests.remove(requestId);
+ if(o != null)
+ {
+ assert(o == out);
+ throw _exception;
+ }
+ }
+ else
+ {
+ throw _exception;
+ }
+ }
+ }
}
public void
sendAsyncRequest(IceInternal.BasicStream os, IceInternal.OutgoingAsync out, boolean compress)
throws IceInternal.LocalExceptionWrapper
{
- int requestId = 0;
- IceInternal.BasicStream stream = null;
-
- synchronized(this)
- {
- assert(!_endpoint.datagram()); // Twoway requests cannot be datagrams, and async implies twoway.
-
- if(_exception != null)
- {
- //
- // If the connection is closed before we even have a chance
- // to send our request, we always try to send the request
- // again.
- //
- throw new IceInternal.LocalExceptionWrapper(_exception, true);
- }
-
- assert(_state > StateNotValidated);
- assert(_state < StateClosing);
-
- //
- // Create a new unique request ID.
- //
- requestId = _nextRequestId++;
- if(requestId <= 0)
- {
- _nextRequestId = 1;
- requestId = _nextRequestId++;
- }
-
- //
- // Fill in the request ID.
- //
- os.pos(IceInternal.Protocol.headerSize);
- os.writeInt(requestId);
-
- //
- // Add to the async requests map.
- //
- _asyncRequests.put(requestId, out);
-
- stream = doCompress(os, _overrideCompress ? _overrideCompressValue : compress);
-
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
- }
- }
-
- try
- {
- synchronized(_sendMutex)
- {
- if(_transceiver == null) // Has the transceiver already been closed?
- {
- assert(_exception != null);
- throw _exception; // The exception is immutable at this point.
- }
-
- //
- // Send the request.
- //
- IceInternal.TraceUtil.traceRequest("sending asynchronous request", os, _logger, _traceLevels);
- _transceiver.write(stream, _endpoint.timeout());
- }
- }
- catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
- {
- synchronized(this)
- {
- setState(StateClosed, ex.get());
- assert(_exception != null);
-
- //
- // If the request has already been removed from the
- // async request map, we are out of luck. It would
- // mean that finished() has been called already, and
- // therefore the exception has been set using the
- // OutgoingAsync::__finished() callback. In this case,
- // we cannot throw the exception here, because we must
- // not both raise an exception and have
- // OutgoingAsync::__finished() called with an
- // exception. This means that in some rare cases, a
- // request will not be retried even though it
- // could. But I honestly don't know how I could avoid
- // this, without a very elaborate and complex design,
- // which would be bad for performance.
- //
- IceInternal.OutgoingAsync o = (IceInternal.OutgoingAsync)_asyncRequests.remove(requestId);
- if(o != null)
- {
- assert(o == out);
- throw new IceInternal.LocalExceptionWrapper(_exception, ex.retry());
- }
- }
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- assert(_exception != null);
-
- //
- // If the request has already been removed from the
- // async request map, we are out of luck. It would
- // mean that finished() has been called already, and
- // therefore the exception has been set using the
- // OutgoingAsync::__finished() callback. In this case,
- // we cannot throw the exception here, because we must
- // not both raise an exception and have
- // OutgoingAsync::__finished() called with an
- // exception. This means that in some rare cases, a
- // request will not be retried even though it
- // could. But I honestly don't know how I could avoid
- // this, without a very elaborate and complex design,
- // which would be bad for performance.
- //
- IceInternal.OutgoingAsync o = (IceInternal.OutgoingAsync)_asyncRequests.remove(requestId);
- if(o != null)
- {
- assert(o == out);
- throw _exception;
- }
- }
- }
+ int requestId = 0;
+ IceInternal.BasicStream stream = null;
+
+ synchronized(this)
+ {
+ assert(!_endpoint.datagram()); // Twoway requests cannot be datagrams, and async implies twoway.
+
+ if(_exception != null)
+ {
+ //
+ // If the connection is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw new IceInternal.LocalExceptionWrapper(_exception, true);
+ }
+
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
+
+ //
+ // Create a new unique request ID.
+ //
+ requestId = _nextRequestId++;
+ if(requestId <= 0)
+ {
+ _nextRequestId = 1;
+ requestId = _nextRequestId++;
+ }
+
+ //
+ // Fill in the request ID.
+ //
+ os.pos(IceInternal.Protocol.headerSize);
+ os.writeInt(requestId);
+
+ //
+ // Add to the async requests map.
+ //
+ _asyncRequests.put(requestId, out);
+
+ stream = doCompress(os, _overrideCompress ? _overrideCompressValue : compress);
+
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
+ }
+ }
+
+ try
+ {
+ synchronized(_sendMutex)
+ {
+ if(_transceiver == null) // Has the transceiver already been closed?
+ {
+ assert(_exception != null);
+ throw _exception; // The exception is immutable at this point.
+ }
+
+ //
+ // Send the request.
+ //
+ IceInternal.TraceUtil.traceRequest("sending asynchronous request", os, _logger, _traceLevels);
+ _transceiver.write(stream, _endpoint.timeout());
+ }
+ }
+ catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex.get());
+ assert(_exception != null);
+
+ //
+ // If the request has already been removed from the
+ // async request map, we are out of luck. It would
+ // mean that finished() has been called already, and
+ // therefore the exception has been set using the
+ // OutgoingAsync::__finished() callback. In this case,
+ // we cannot throw the exception here, because we must
+ // not both raise an exception and have
+ // OutgoingAsync::__finished() called with an
+ // exception. This means that in some rare cases, a
+ // request will not be retried even though it
+ // could. But I honestly don't know how I could avoid
+ // this, without a very elaborate and complex design,
+ // which would be bad for performance.
+ //
+ IceInternal.OutgoingAsync o = (IceInternal.OutgoingAsync)_asyncRequests.remove(requestId);
+ if(o != null)
+ {
+ assert(o == out);
+ throw new IceInternal.LocalExceptionWrapper(_exception, ex.retry());
+ }
+ }
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ assert(_exception != null);
+
+ //
+ // If the request has already been removed from the
+ // async request map, we are out of luck. It would
+ // mean that finished() has been called already, and
+ // therefore the exception has been set using the
+ // OutgoingAsync::__finished() callback. In this case,
+ // we cannot throw the exception here, because we must
+ // not both raise an exception and have
+ // OutgoingAsync::__finished() called with an
+ // exception. This means that in some rare cases, a
+ // request will not be retried even though it
+ // could. But I honestly don't know how I could avoid
+ // this, without a very elaborate and complex design,
+ // which would be bad for performance.
+ //
+ IceInternal.OutgoingAsync o = (IceInternal.OutgoingAsync)_asyncRequests.remove(requestId);
+ if(o != null)
+ {
+ assert(o == out);
+ throw _exception;
+ }
+ }
+ }
}
public synchronized void
prepareBatchRequest(IceInternal.BasicStream os)
{
- while(_batchStreamInUse && _exception == null)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
+ while(_batchStreamInUse && _exception == null)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
if(_exception != null)
{
@@ -819,29 +819,29 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
assert(_state > StateNotValidated);
- assert(_state < StateClosing);
+ assert(_state < StateClosing);
if(_batchStream.isEmpty())
{
- try
- {
- _batchStream.writeBlob(IceInternal.Protocol.requestBatchHdr);
- }
- catch(LocalException ex)
- {
- setState(StateClosed, ex);
- throw ex;
- }
+ try
+ {
+ _batchStream.writeBlob(IceInternal.Protocol.requestBatchHdr);
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ throw ex;
+ }
}
_batchStreamInUse = true;
- _batchMarker = _batchStream.size();
- _batchStream.swap(os);
+ _batchMarker = _batchStream.size();
+ _batchStream.swap(os);
- //
- // The batch stream now belongs to the caller, until
- // finishBatchRequest() or abortBatchRequest() is called.
- //
+ //
+ // The batch stream now belongs to the caller, until
+ // finishBatchRequest() or abortBatchRequest() is called.
+ //
}
public void
@@ -859,43 +859,43 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
if(_batchAutoFlush)
{
- synchronized(_sendMutex)
- {
- if(_transceiver == null)
- {
- assert(_exception != null);
- throw _exception; // The exception is immutable at this point.
- }
- //
- // Throw memory limit exception if the first
- // message added causes us to go over
- // limit. Otherwise put aside the marshalled
- // message that caused limit to be exceeded and
- // rollback stream to the marker.
- try
- {
- _transceiver.checkSendSize(_batchStream, _instance.messageSizeMax());
- }
- catch(Ice.LocalException ex)
- {
- if(_batchRequestNum == 0)
- {
- resetBatch(true);
- throw ex;
- }
-
- lastRequest = new byte[_batchStream.size() - _batchMarker];
- java.nio.ByteBuffer buffer = _batchStream.prepareRead();
- buffer.position(_batchMarker);
- buffer.get(lastRequest);
- _batchStream.resize(_batchMarker, false);
- autoflush = true;
- }
- }
- }
-
- if(!autoflush)
- {
+ synchronized(_sendMutex)
+ {
+ if(_transceiver == null)
+ {
+ assert(_exception != null);
+ throw _exception; // The exception is immutable at this point.
+ }
+ //
+ // Throw memory limit exception if the first
+ // message added causes us to go over
+ // limit. Otherwise put aside the marshalled
+ // message that caused limit to be exceeded and
+ // rollback stream to the marker.
+ try
+ {
+ _transceiver.checkSendSize(_batchStream, _instance.messageSizeMax());
+ }
+ catch(Ice.LocalException ex)
+ {
+ if(_batchRequestNum == 0)
+ {
+ resetBatch(true);
+ throw ex;
+ }
+
+ lastRequest = new byte[_batchStream.size() - _batchMarker];
+ java.nio.ByteBuffer buffer = _batchStream.prepareRead();
+ buffer.position(_batchMarker);
+ buffer.get(lastRequest);
+ _batchStream.resize(_batchMarker, false);
+ autoflush = true;
+ }
+ }
+ }
+
+ if(!autoflush)
+ {
//
// Increment the number of requests in the batch.
//
@@ -989,10 +989,10 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
private void
flushBatchRequestsInternal(boolean ignoreInUse)
{
- IceInternal.BasicStream stream = null;
+ IceInternal.BasicStream stream = null;
- synchronized(this)
- {
+ synchronized(this)
+ {
if(!ignoreInUse)
{
while(_batchStreamInUse && _exception == null)
@@ -1006,98 +1006,98 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
}
}
-
- if(_exception != null)
- {
- throw _exception;
- }
-
- if(_batchStream.isEmpty())
- {
- return; // Nothing to do.
- }
-
- assert(_state > StateNotValidated);
- assert(_state < StateClosing);
-
- //
- // Fill in the message size.
- //
- _batchStream.pos(10);
- _batchStream.writeInt(_batchStream.size());
-
- //
- // Fill in the number of requests in the batch.
- //
- _batchStream.writeInt(_batchRequestNum);
-
- stream = doCompress(_batchStream, _overrideCompress ? _overrideCompressValue : _batchRequestCompress);
-
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
- }
-
- //
- // Prevent that new batch requests are added while we are
- // flushing.
- //
- _batchStreamInUse = true;
- }
-
- try
- {
- synchronized(_sendMutex)
- {
- if(_transceiver == null) // Has the transceiver already been closed?
- {
- assert(_exception != null);
- throw _exception; // The exception is immutable at this point.
- }
-
- //
- // Send the batch request.
- //
- IceInternal.TraceUtil.traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
- _transceiver.write(stream, _endpoint.timeout());
- }
- }
- catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
- {
- synchronized(this)
- {
- setState(StateClosed, ex.get());
- assert(_exception != null);
-
- //
- // Since batch requests are all oneways (or datagrams), we
- // must report the exception to the caller.
- //
- throw _exception;
- }
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- assert(_exception != null);
-
- //
- // Since batch requests are all oneways (or datagrams), we
- // must report the exception to the caller.
- //
- throw _exception;
- }
- }
-
- synchronized(this)
- {
- //
- // Reset the batch stream, and notify that flushing is over.
- //
+
+ if(_exception != null)
+ {
+ throw _exception;
+ }
+
+ if(_batchStream.isEmpty())
+ {
+ return; // Nothing to do.
+ }
+
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
+
+ //
+ // Fill in the message size.
+ //
+ _batchStream.pos(10);
+ _batchStream.writeInt(_batchStream.size());
+
+ //
+ // Fill in the number of requests in the batch.
+ //
+ _batchStream.writeInt(_batchRequestNum);
+
+ stream = doCompress(_batchStream, _overrideCompress ? _overrideCompressValue : _batchRequestCompress);
+
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
+ }
+
+ //
+ // Prevent that new batch requests are added while we are
+ // flushing.
+ //
+ _batchStreamInUse = true;
+ }
+
+ try
+ {
+ synchronized(_sendMutex)
+ {
+ if(_transceiver == null) // Has the transceiver already been closed?
+ {
+ assert(_exception != null);
+ throw _exception; // The exception is immutable at this point.
+ }
+
+ //
+ // Send the batch request.
+ //
+ IceInternal.TraceUtil.traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
+ _transceiver.write(stream, _endpoint.timeout());
+ }
+ }
+ catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex.get());
+ assert(_exception != null);
+
+ //
+ // Since batch requests are all oneways (or datagrams), we
+ // must report the exception to the caller.
+ //
+ throw _exception;
+ }
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ assert(_exception != null);
+
+ //
+ // Since batch requests are all oneways (or datagrams), we
+ // must report the exception to the caller.
+ //
+ throw _exception;
+ }
+ }
+
+ synchronized(this)
+ {
+ //
+ // Reset the batch stream, and notify that flushing is over.
+ //
resetBatch(!ignoreInUse);
- }
+ }
}
private void
@@ -1121,98 +1121,98 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public void
sendResponse(IceInternal.BasicStream os, byte compressFlag)
{
- IceInternal.BasicStream stream = null;
- try
- {
- synchronized(_sendMutex)
- {
- if(_transceiver == null) // Has the transceiver already been closed?
- {
- assert(_exception != null);
- throw _exception; // The exception is immutable at this point.
- }
-
- stream = doCompress(os, compressFlag != 0);
-
- //
- // Send the reply.
- //
- IceInternal.TraceUtil.traceReply("sending reply", os, _logger, _traceLevels);
- _transceiver.write(stream, _endpoint.timeout());
- }
- }
- catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
- {
- synchronized(this)
- {
- setState(StateClosed, ex.get());
- }
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- }
- }
-
- synchronized(this)
- {
- assert(_state > StateNotValidated);
-
- try
- {
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
-
- if(_state == StateClosing && _dispatchCount == 0)
- {
- initiateShutdown();
- }
-
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
- }
- }
- catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
- {
- setState(StateClosed, ex.get());
- }
- catch(LocalException ex)
- {
- setState(StateClosed, ex);
- }
- }
+ IceInternal.BasicStream stream = null;
+ try
+ {
+ synchronized(_sendMutex)
+ {
+ if(_transceiver == null) // Has the transceiver already been closed?
+ {
+ assert(_exception != null);
+ throw _exception; // The exception is immutable at this point.
+ }
+
+ stream = doCompress(os, compressFlag != 0);
+
+ //
+ // Send the reply.
+ //
+ IceInternal.TraceUtil.traceReply("sending reply", os, _logger, _traceLevels);
+ _transceiver.write(stream, _endpoint.timeout());
+ }
+ }
+ catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex.get());
+ }
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+
+ synchronized(this)
+ {
+ assert(_state > StateNotValidated);
+
+ try
+ {
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
+
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
+ }
+ }
+ catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
+ {
+ setState(StateClosed, ex.get());
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
+ }
}
public synchronized void
sendNoResponse()
{
- assert(_state > StateNotValidated);
-
- try
- {
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
-
- if(_state == StateClosing && _dispatchCount == 0)
- {
- initiateShutdown();
- }
- }
- catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
- {
- setState(StateClosed, ex.get());
- }
- catch(LocalException ex)
- {
- setState(StateClosed, ex);
- }
+ assert(_state > StateNotValidated);
+
+ try
+ {
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
+ }
+ catch(IceInternal.LocalExceptionWrapper ex) // Java-specific workaround in Transceiver.write().
+ {
+ setState(StateClosed, ex.get());
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
}
public IceInternal.EndpointI
@@ -1231,39 +1231,39 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public synchronized void
setAdapter(ObjectAdapter adapter)
{
- if(_exception != null)
- {
- throw _exception;
- }
-
- assert(_state < StateClosing);
-
- _adapter = adapter;
-
- if(_adapter != null)
- {
- _servantManager = ((ObjectAdapterI)_adapter).getServantManager();
- if(_servantManager == null)
- {
- _adapter = null;
- }
- }
- else
- {
- _servantManager = null;
- }
-
- //
- // We never change the thread pool with which we were
- // initially registered, even if we add or remove an object
- // adapter.
- //
+ if(_exception != null)
+ {
+ throw _exception;
+ }
+
+ assert(_state < StateClosing);
+
+ _adapter = adapter;
+
+ if(_adapter != null)
+ {
+ _servantManager = ((ObjectAdapterI)_adapter).getServantManager();
+ if(_servantManager == null)
+ {
+ _adapter = null;
+ }
+ }
+ else
+ {
+ _servantManager = null;
+ }
+
+ //
+ // We never change the thread pool with which we were
+ // initially registered, even if we add or remove an object
+ // adapter.
+ //
}
public synchronized ObjectAdapter
getAdapter()
{
- return _adapter;
+ return _adapter;
}
public synchronized ObjectPrx
@@ -1276,7 +1276,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
ConnectionI[] connections = new ConnectionI[1];
connections[0] = this;
IceInternal.Reference ref =
- _instance.referenceFactory().create(ident, _instance.getDefaultContext(), "",
+ _instance.referenceFactory().create(ident, _instance.getDefaultContext(), "",
IceInternal.Reference.ModeTwoway, connections);
return _instance.proxyFactory().referenceToProxy(ref);
}
@@ -1288,205 +1288,205 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public boolean
datagram()
{
- assert(!_threadPerConnection); // Only for use with a thread pool.
- return _endpoint.datagram(); // No mutex protection necessary, _endpoint is immutable.
+ assert(!_threadPerConnection); // Only for use with a thread pool.
+ return _endpoint.datagram(); // No mutex protection necessary, _endpoint is immutable.
}
public boolean
readable()
{
- assert(!_threadPerConnection); // Only for use with a thread pool.
+ assert(!_threadPerConnection); // Only for use with a thread pool.
return true;
}
public boolean
read(IceInternal.BasicStream stream)
{
- assert(!_threadPerConnection); // Only for use with a thread pool.
+ assert(!_threadPerConnection); // Only for use with a thread pool.
- return _transceiver.read(stream, 0);
+ return _transceiver.read(stream, 0);
- //
- // Updating _acmAbsoluteTimeoutMillis is too expensive here,
- // because we would have to acquire a lock just for this
- // purpose. Instead, we update _acmAbsoluteTimeoutMillis in
- // message().
- //
+ //
+ // Updating _acmAbsoluteTimeoutMillis is too expensive here,
+ // because we would have to acquire a lock just for this
+ // purpose. Instead, we update _acmAbsoluteTimeoutMillis in
+ // message().
+ //
}
public void
message(IceInternal.BasicStream stream, IceInternal.ThreadPool threadPool)
{
- assert(!_threadPerConnection); // Only for use with a thread pool.
+ assert(!_threadPerConnection); // Only for use with a thread pool.
- MessageInfo info = new MessageInfo(stream);
+ MessageInfo info = new MessageInfo(stream);
synchronized(this)
{
- //
- // We must promote within the synchronization, otherwise
- // there could be various race conditions with close
- // connection messages and other messages.
- //
- threadPool.promoteFollower();
+ //
+ // We must promote within the synchronization, otherwise
+ // there could be various race conditions with close
+ // connection messages and other messages.
+ //
+ threadPool.promoteFollower();
if(_state != StateClosed)
{
- parseMessage(info);
- }
-
- //
- // parseMessage() can close the connection, so we must check
- // for closed state again.
- //
- if(_state == StateClosed)
- {
- return;
- }
- }
-
- //
- // Asynchronous replies must be handled outside the thread
- // synchronization, so that nested calls are possible.
- //
- if(info.outAsync != null)
- {
- info.outAsync.__finished(info.stream);
- }
-
- //
- // Method invocation (or multiple invocations for batch messages)
- // must be done outside the thread synchronization, so that nested
- // calls are possible.
- //
- invokeAll(info.stream, info.invokeNum, info.requestId, info.compress, info.servantManager, info.adapter);
+ parseMessage(info);
+ }
+
+ //
+ // parseMessage() can close the connection, so we must check
+ // for closed state again.
+ //
+ if(_state == StateClosed)
+ {
+ return;
+ }
+ }
+
+ //
+ // Asynchronous replies must be handled outside the thread
+ // synchronization, so that nested calls are possible.
+ //
+ if(info.outAsync != null)
+ {
+ info.outAsync.__finished(info.stream);
+ }
+
+ //
+ // Method invocation (or multiple invocations for batch messages)
+ // must be done outside the thread synchronization, so that nested
+ // calls are possible.
+ //
+ invokeAll(info.stream, info.invokeNum, info.requestId, info.compress, info.servantManager, info.adapter);
}
public void
finished(IceInternal.ThreadPool threadPool)
{
- assert(!_threadPerConnection); // Only for use with a thread pool.
-
- threadPool.promoteFollower();
-
- LocalException localEx = null;
-
- IceInternal.IntMap requests = null;
- IceInternal.IntMap asyncRequests = null;
-
- synchronized(this)
- {
- --_finishedCount;
- if(_finishedCount == 0 && _state == StateClosed)
- {
- //
- // We must make sure that nobody is sending when we
- // close the transceiver.
- //
- synchronized(_sendMutex)
- {
- try
- {
- _transceiver.close();
- }
- catch(LocalException ex)
- {
- localEx = ex;
- }
-
- _transceiver = null;
- notifyAll();
- }
- }
-
- if(_state == StateClosed || _state == StateClosing)
- {
- requests = _requests;
- _requests = new IceInternal.IntMap();
-
- asyncRequests = _asyncRequests;
- _asyncRequests = new IceInternal.IntMap();
- }
- }
-
- if(requests != null)
- {
- java.util.Iterator i = requests.entryIterator();
- while(i.hasNext())
- {
- IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next();
- IceInternal.Outgoing out = (IceInternal.Outgoing)e.getValue();
- out.finished(_exception); // The exception is immutable at this point.
- }
- }
-
- if(asyncRequests != null)
- {
- java.util.Iterator i = asyncRequests.entryIterator();
- while(i.hasNext())
- {
- IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next();
- IceInternal.OutgoingAsync out = (IceInternal.OutgoingAsync)e.getValue();
- out.__finished(_exception); // The exception is immutable at this point.
- }
- }
-
- if(localEx != null)
- {
- throw localEx;
- }
+ assert(!_threadPerConnection); // Only for use with a thread pool.
+
+ threadPool.promoteFollower();
+
+ LocalException localEx = null;
+
+ IceInternal.IntMap requests = null;
+ IceInternal.IntMap asyncRequests = null;
+
+ synchronized(this)
+ {
+ --_finishedCount;
+ if(_finishedCount == 0 && _state == StateClosed)
+ {
+ //
+ // We must make sure that nobody is sending when we
+ // close the transceiver.
+ //
+ synchronized(_sendMutex)
+ {
+ try
+ {
+ _transceiver.close();
+ }
+ catch(LocalException ex)
+ {
+ localEx = ex;
+ }
+
+ _transceiver = null;
+ notifyAll();
+ }
+ }
+
+ if(_state == StateClosed || _state == StateClosing)
+ {
+ requests = _requests;
+ _requests = new IceInternal.IntMap();
+
+ asyncRequests = _asyncRequests;
+ _asyncRequests = new IceInternal.IntMap();
+ }
+ }
+
+ if(requests != null)
+ {
+ java.util.Iterator i = requests.entryIterator();
+ while(i.hasNext())
+ {
+ IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next();
+ IceInternal.Outgoing out = (IceInternal.Outgoing)e.getValue();
+ out.finished(_exception); // The exception is immutable at this point.
+ }
+ }
+
+ if(asyncRequests != null)
+ {
+ java.util.Iterator i = asyncRequests.entryIterator();
+ while(i.hasNext())
+ {
+ IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next();
+ IceInternal.OutgoingAsync out = (IceInternal.OutgoingAsync)e.getValue();
+ out.__finished(_exception); // The exception is immutable at this point.
+ }
+ }
+
+ if(localEx != null)
+ {
+ throw localEx;
+ }
}
public synchronized void
exception(LocalException ex)
{
- setState(StateClosed, ex);
+ setState(StateClosed, ex);
}
public synchronized void
invokeException(LocalException ex, int invokeNum)
{
- //
- // Fatal exception while invoking a request. Since sendResponse/sendNoResponse isn't
- // called in case of a fatal exception we decrement _dispatchCount here.
- //
-
- setState(StateClosed, ex);
-
- if(invokeNum > 0)
- {
- assert(_dispatchCount > 0);
- _dispatchCount -= invokeNum;
- assert(_dispatchCount >= 0);
- if(_dispatchCount == 0)
- {
- notifyAll();
- }
- }
+ //
+ // Fatal exception while invoking a request. Since sendResponse/sendNoResponse isn't
+ // called in case of a fatal exception we decrement _dispatchCount here.
+ //
+
+ setState(StateClosed, ex);
+
+ if(invokeNum > 0)
+ {
+ assert(_dispatchCount > 0);
+ _dispatchCount -= invokeNum;
+ assert(_dispatchCount >= 0);
+ if(_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+ }
}
public String
type()
{
- return _type; // No mutex lock, _type is immutable.
+ return _type; // No mutex lock, _type is immutable.
}
public int
timeout()
{
- return _endpoint.timeout(); // No mutex protection necessary, _endpoint is immutable.
+ return _endpoint.timeout(); // No mutex protection necessary, _endpoint is immutable.
}
public String
toString()
{
- return _toString();
+ return _toString();
}
public String
_toString()
{
- return _desc; // No mutex lock, _desc is immutable.
+ return _desc; // No mutex lock, _desc is immutable.
}
//
@@ -1498,143 +1498,143 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public IceInternal.Transceiver
getTransceiver()
{
- return _transceiver;
+ return _transceiver;
}
public ConnectionI(IceInternal.Instance instance, IceInternal.Transceiver transceiver,
- IceInternal.EndpointI endpoint, ObjectAdapter adapter, boolean threadPerConnection)
+ IceInternal.EndpointI endpoint, ObjectAdapter adapter, boolean threadPerConnection)
{
super(instance);
_threadPerConnection = threadPerConnection;
_transceiver = transceiver;
- _desc = transceiver.toString();
+ _desc = transceiver.toString();
_type = transceiver.type();
_endpoint = endpoint;
_adapter = adapter;
_logger = instance.initializationData().logger; // Cached for better performance.
_traceLevels = instance.traceLevels(); // Cached for better performance.
- _registeredWithPool = false;
- _finishedCount = 0;
- _warn = _instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Connections") > 0 ? true : false;
- _cacheBuffers = _instance.initializationData().properties.getPropertyAsIntWithDefault(
- "Ice.CacheMessageBuffers", 1) == 1;
- _acmAbsoluteTimeoutMillis = 0;
+ _registeredWithPool = false;
+ _finishedCount = 0;
+ _warn = _instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Connections") > 0 ? true : false;
+ _cacheBuffers = _instance.initializationData().properties.getPropertyAsIntWithDefault(
+ "Ice.CacheMessageBuffers", 1) == 1;
+ _acmAbsoluteTimeoutMillis = 0;
_nextRequestId = 1;
- _batchAutoFlush = _instance.initializationData().properties.getPropertyAsIntWithDefault(
+ _batchAutoFlush = _instance.initializationData().properties.getPropertyAsIntWithDefault(
"Ice.BatchAutoFlush", 1) > 0 ? true : false;
_batchStream = new IceInternal.BasicStream(instance, _batchAutoFlush);
- _batchStreamInUse = false;
- _batchRequestNum = 0;
- _batchRequestCompress = false;
+ _batchStreamInUse = false;
+ _batchRequestNum = 0;
+ _batchRequestCompress = false;
_dispatchCount = 0;
_state = StateNotValidated;
- _stateTime = System.currentTimeMillis();
-
- if(_endpoint.datagram())
- {
- _acmTimeout = 0;
- }
- else
- {
- if(_adapter != null)
- {
- _acmTimeout = _instance.serverACM();
- }
- else
- {
- _acmTimeout = _instance.clientACM();
- }
- }
-
- int compressionLevel =
- _instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Compression.Level", 1);
- if(compressionLevel < 1)
- {
- compressionLevel = 1;
- }
- else if(compressionLevel > 9)
- {
- compressionLevel = 9;
- }
- _compressionLevel = compressionLevel;
-
- if(_adapter != null)
- {
- _servantManager = ((ObjectAdapterI)_adapter).getServantManager();
- }
- else
- {
- _servantManager = null;
- }
-
- try
- {
- if(!threadPerConnection)
- {
- //
- // Only set _threadPool if we really need it, i.e., if we are
- // not in thread per connection mode. Thread pools have lazy
- // initialization in Instance, and we don't want them to be
- // created if they are not needed.
- //
- if(_adapter != null)
- {
- _threadPool = ((ObjectAdapterI)_adapter).getThreadPool();
- }
- else
- {
- _threadPool = _instance.clientThreadPool();
- }
- }
- else
- {
- _threadPool = null;
-
- //
- // If we are in thread per connection mode, create the thread
- // for this connection.
- //
- _thread = new ThreadPerConnection();
- _thread.start();
- }
- }
- catch(java.lang.Exception ex)
- {
- if(threadPerConnection)
- {
- java.io.StringWriter sw = new java.io.StringWriter();
- java.io.PrintWriter pw = new java.io.PrintWriter(sw);
- ex.printStackTrace(pw);
- pw.flush();
- _logger.error("cannot create thread for connection:\n" + sw.toString());
- }
-
- try
- {
- _transceiver.close();
- }
- catch(LocalException e)
- {
- // Here we ignore any exceptions in close().
- }
-
- Ice.SyscallException e = new Ice.SyscallException();
- e.initCause(ex);
- throw e;
- }
-
- _overrideCompress = _instance.defaultsAndOverrides().overrideCompress;
- _overrideCompressValue = _instance.defaultsAndOverrides().overrideCompressValue;
+ _stateTime = System.currentTimeMillis();
+
+ if(_endpoint.datagram())
+ {
+ _acmTimeout = 0;
+ }
+ else
+ {
+ if(_adapter != null)
+ {
+ _acmTimeout = _instance.serverACM();
+ }
+ else
+ {
+ _acmTimeout = _instance.clientACM();
+ }
+ }
+
+ int compressionLevel =
+ _instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Compression.Level", 1);
+ if(compressionLevel < 1)
+ {
+ compressionLevel = 1;
+ }
+ else if(compressionLevel > 9)
+ {
+ compressionLevel = 9;
+ }
+ _compressionLevel = compressionLevel;
+
+ if(_adapter != null)
+ {
+ _servantManager = ((ObjectAdapterI)_adapter).getServantManager();
+ }
+ else
+ {
+ _servantManager = null;
+ }
+
+ try
+ {
+ if(!threadPerConnection)
+ {
+ //
+ // Only set _threadPool if we really need it, i.e., if we are
+ // not in thread per connection mode. Thread pools have lazy
+ // initialization in Instance, and we don't want them to be
+ // created if they are not needed.
+ //
+ if(_adapter != null)
+ {
+ _threadPool = ((ObjectAdapterI)_adapter).getThreadPool();
+ }
+ else
+ {
+ _threadPool = _instance.clientThreadPool();
+ }
+ }
+ else
+ {
+ _threadPool = null;
+
+ //
+ // If we are in thread per connection mode, create the thread
+ // for this connection.
+ //
+ _thread = new ThreadPerConnection();
+ _thread.start();
+ }
+ }
+ catch(java.lang.Exception ex)
+ {
+ if(threadPerConnection)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ _logger.error("cannot create thread for connection:\n" + sw.toString());
+ }
+
+ try
+ {
+ _transceiver.close();
+ }
+ catch(LocalException e)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ Ice.SyscallException e = new Ice.SyscallException();
+ e.initCause(ex);
+ throw e;
+ }
+
+ _overrideCompress = _instance.defaultsAndOverrides().overrideCompress;
+ _overrideCompressValue = _instance.defaultsAndOverrides().overrideCompressValue;
}
protected synchronized void
finalize()
throws Throwable
{
- IceUtil.Assert.FinalizerAssert(_state == StateClosed);
- IceUtil.Assert.FinalizerAssert(_transceiver == null);
- IceUtil.Assert.FinalizerAssert(_dispatchCount == 0);
- IceUtil.Assert.FinalizerAssert(_thread == null);
+ IceUtil.Assert.FinalizerAssert(_state == StateClosed);
+ IceUtil.Assert.FinalizerAssert(_transceiver == null);
+ IceUtil.Assert.FinalizerAssert(_dispatchCount == 0);
+ IceUtil.Assert.FinalizerAssert(_thread == null);
super.finalize();
}
@@ -1648,11 +1648,11 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
private void
setState(int state, LocalException ex)
{
- //
- // If setState() is called with an exception, then only closed
- // and closing states are permissible.
- //
- assert(state == StateClosing || state == StateClosed);
+ //
+ // If setState() is called with an exception, then only closed
+ // and closing states are permissible.
+ //
+ assert(state == StateClosing || state == StateClosed);
if(_state == state) // Don't switch twice.
{
@@ -1661,36 +1661,36 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
if(_exception == null)
{
- _exception = ex;
+ _exception = ex;
if(_warn)
{
- //
- // We don't warn if we are not validated.
- //
- if(_state > StateNotValidated)
- {
- //
- // Don't warn about certain expected exceptions.
- //
- if(!(_exception instanceof CloseConnectionException ||
- _exception instanceof ForcedCloseConnectionException ||
- _exception instanceof ConnectionTimeoutException ||
- _exception instanceof CommunicatorDestroyedException ||
- _exception instanceof ObjectAdapterDeactivatedException ||
- (_exception instanceof ConnectionLostException && _state == StateClosing)))
- {
- warning("connection exception", _exception);
- }
- }
- }
- }
-
- //
- // We must set the new state before we notify requests of any
- // exceptions. Otherwise new requests may retry on a
- // connection that is not yet marked as closed or closing.
- //
+ //
+ // We don't warn if we are not validated.
+ //
+ if(_state > StateNotValidated)
+ {
+ //
+ // Don't warn about certain expected exceptions.
+ //
+ if(!(_exception instanceof CloseConnectionException ||
+ _exception instanceof ForcedCloseConnectionException ||
+ _exception instanceof ConnectionTimeoutException ||
+ _exception instanceof CommunicatorDestroyedException ||
+ _exception instanceof ObjectAdapterDeactivatedException ||
+ (_exception instanceof ConnectionLostException && _state == StateClosing)))
+ {
+ warning("connection exception", _exception);
+ }
+ }
+ }
+ }
+
+ //
+ // We must set the new state before we notify requests of any
+ // exceptions. Otherwise new requests may retry on a
+ // connection that is not yet marked as closed or closing.
+ //
setState(state);
}
@@ -1706,13 +1706,13 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
state = StateClosed;
}
- //
- // Skip graceful shutdown if we are destroyed before validation.
- //
- if(_state == StateNotValidated && state == StateClosing)
- {
- state = StateClosed;
- }
+ //
+ // Skip graceful shutdown if we are destroyed before validation.
+ //
+ if(_state == StateNotValidated && state == StateClosing)
+ {
+ state = StateClosed;
+ }
if(_state == state) // Don't switch twice.
{
@@ -1721,147 +1721,147 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
switch(state)
{
- case StateNotValidated:
- {
- assert(false);
- break;
- }
+ case StateNotValidated:
+ {
+ assert(false);
+ break;
+ }
case StateActive:
{
- //
- // Can only switch from holding or not validated to
- // active.
- //
+ //
+ // Can only switch from holding or not validated to
+ // active.
+ //
if(_state != StateHolding && _state != StateNotValidated)
{
return;
}
- if(!_threadPerConnection)
- {
- registerWithPool();
- }
+ if(!_threadPerConnection)
+ {
+ registerWithPool();
+ }
break;
}
case StateHolding:
{
- //
- // Can only switch from active or not validated to
- // holding.
- //
- if(_state != StateActive && _state != StateNotValidated)
- {
+ //
+ // Can only switch from active or not validated to
+ // holding.
+ //
+ if(_state != StateActive && _state != StateNotValidated)
+ {
return;
}
- if(!_threadPerConnection)
- {
- unregisterWithPool();
- }
+ if(!_threadPerConnection)
+ {
+ unregisterWithPool();
+ }
break;
}
case StateClosing:
{
- //
- // Can't change back from closed.
- //
+ //
+ // Can't change back from closed.
+ //
if(_state == StateClosed)
{
return;
}
- if(!_threadPerConnection)
- {
- registerWithPool(); // We need to continue to read in closing state.
- }
+ if(!_threadPerConnection)
+ {
+ registerWithPool(); // We need to continue to read in closing state.
+ }
break;
}
-
+
case StateClosed:
{
- if(_threadPerConnection)
- {
- //
- // If we are in thread per connection mode, we
- // shutdown both for reading and writing. This will
- // unblock and read call with an exception. The thread
- // per connection then closes the transceiver.
- //
- _transceiver.shutdownReadWrite();
- }
- else if(_state == StateNotValidated)
- {
- //
- // If we change from not validated, we can close right
- // away.
- //
- assert(!_registeredWithPool);
-
- //
- // We must make sure that nobody is sending when we
- // close the transceiver.
- //
- synchronized(_sendMutex)
- {
- try
- {
- _transceiver.close();
- }
- catch(LocalException ex)
- {
- // Here we ignore any exceptions in close().
- }
-
- _transceiver = null;
- //notifyAll(); // We notify already below.
- }
- }
- else
- {
- //
- // Otherwise we first must make sure that we are
- // registered, then we unregister, and let finished()
- // do the close.
- //
- registerWithPool();
- unregisterWithPool();
-
- //
- // We must prevent any further writes when _state == StateClosed.
- // However, functions such as sendResponse cannot acquire the main
- // mutex in order to check _state. Therefore we shut down the write
- // end of the transceiver, which causes subsequent write attempts
- // to fail with an exception.
- //
- _transceiver.shutdownWrite();
- }
- break;
- }
- }
-
- //
- // We only register with the connection monitor if our new state
- // is StateActive. Otherwise we unregister with the connection
- // monitor, but only if we were registered before, i.e., if our
- // old state was StateActive.
- //
- IceInternal.ConnectionMonitor connectionMonitor = _instance.connectionMonitor();
- if(connectionMonitor != null)
- {
- if(state == StateActive)
- {
- connectionMonitor.add(this);
- }
- else if(_state == StateActive)
- {
- connectionMonitor.remove(this);
- }
- }
+ if(_threadPerConnection)
+ {
+ //
+ // If we are in thread per connection mode, we
+ // shutdown both for reading and writing. This will
+ // unblock and read call with an exception. The thread
+ // per connection then closes the transceiver.
+ //
+ _transceiver.shutdownReadWrite();
+ }
+ else if(_state == StateNotValidated)
+ {
+ //
+ // If we change from not validated, we can close right
+ // away.
+ //
+ assert(!_registeredWithPool);
+
+ //
+ // We must make sure that nobody is sending when we
+ // close the transceiver.
+ //
+ synchronized(_sendMutex)
+ {
+ try
+ {
+ _transceiver.close();
+ }
+ catch(LocalException ex)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ _transceiver = null;
+ //notifyAll(); // We notify already below.
+ }
+ }
+ else
+ {
+ //
+ // Otherwise we first must make sure that we are
+ // registered, then we unregister, and let finished()
+ // do the close.
+ //
+ registerWithPool();
+ unregisterWithPool();
+
+ //
+ // We must prevent any further writes when _state == StateClosed.
+ // However, functions such as sendResponse cannot acquire the main
+ // mutex in order to check _state. Therefore we shut down the write
+ // end of the transceiver, which causes subsequent write attempts
+ // to fail with an exception.
+ //
+ _transceiver.shutdownWrite();
+ }
+ break;
+ }
+ }
+
+ //
+ // We only register with the connection monitor if our new state
+ // is StateActive. Otherwise we unregister with the connection
+ // monitor, but only if we were registered before, i.e., if our
+ // old state was StateActive.
+ //
+ IceInternal.ConnectionMonitor connectionMonitor = _instance.connectionMonitor();
+ if(connectionMonitor != null)
+ {
+ if(state == StateActive)
+ {
+ connectionMonitor.add(this);
+ }
+ else if(_state == StateActive)
+ {
+ connectionMonitor.remove(this);
+ }
+ }
_state = state;
- _stateTime = System.currentTimeMillis();
+ _stateTime = System.currentTimeMillis();
- notifyAll();
+ notifyAll();
if(_state == StateClosing && _dispatchCount == 0)
{
@@ -1882,665 +1882,665 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
private void
initiateShutdown()
- throws IceInternal.LocalExceptionWrapper // Java-specific workaround in Transceiver.write().
+ throws IceInternal.LocalExceptionWrapper // Java-specific workaround in Transceiver.write().
{
- assert(_state == StateClosing);
- assert(_dispatchCount == 0);
-
- if(!_endpoint.datagram())
- {
- synchronized(_sendMutex)
- {
- //
- // Before we shut down, we send a close connection
- // message.
- //
- IceInternal.BasicStream os = new IceInternal.BasicStream(_instance);
- os.writeBlob(IceInternal.Protocol.magic);
- os.writeByte(IceInternal.Protocol.protocolMajor);
- os.writeByte(IceInternal.Protocol.protocolMinor);
- os.writeByte(IceInternal.Protocol.encodingMajor);
- os.writeByte(IceInternal.Protocol.encodingMinor);
- os.writeByte(IceInternal.Protocol.closeConnectionMsg);
- os.writeByte(_compressionSupported ? (byte)1 : (byte)0);
- os.writeInt(IceInternal.Protocol.headerSize); // Message size.
-
- //
- // Send the message.
- //
- IceInternal.TraceUtil.traceHeader("sending close connection", os, _logger, _traceLevels);
- _transceiver.write(os, _endpoint.timeout());
- //
- // The CloseConnection message should be sufficient. Closing the write
- // end of the socket is probably an artifact of how things were done
- // in IIOP. In fact, shutting down the write end of the socket causes
- // problems on Windows by preventing the peer from using the socket.
- // For example, the peer is no longer able to continue writing a large
- // message after the socket is shutdown.
- //
- //_transceiver.shutdownWrite();
- }
- }
+ assert(_state == StateClosing);
+ assert(_dispatchCount == 0);
+
+ if(!_endpoint.datagram())
+ {
+ synchronized(_sendMutex)
+ {
+ //
+ // Before we shut down, we send a close connection
+ // message.
+ //
+ IceInternal.BasicStream os = new IceInternal.BasicStream(_instance);
+ os.writeBlob(IceInternal.Protocol.magic);
+ os.writeByte(IceInternal.Protocol.protocolMajor);
+ os.writeByte(IceInternal.Protocol.protocolMinor);
+ os.writeByte(IceInternal.Protocol.encodingMajor);
+ os.writeByte(IceInternal.Protocol.encodingMinor);
+ os.writeByte(IceInternal.Protocol.closeConnectionMsg);
+ os.writeByte(_compressionSupported ? (byte)1 : (byte)0);
+ os.writeInt(IceInternal.Protocol.headerSize); // Message size.
+
+ //
+ // Send the message.
+ //
+ IceInternal.TraceUtil.traceHeader("sending close connection", os, _logger, _traceLevels);
+ _transceiver.write(os, _endpoint.timeout());
+ //
+ // The CloseConnection message should be sufficient. Closing the write
+ // end of the socket is probably an artifact of how things were done
+ // in IIOP. In fact, shutting down the write end of the socket causes
+ // problems on Windows by preventing the peer from using the socket.
+ // For example, the peer is no longer able to continue writing a large
+ // message after the socket is shutdown.
+ //
+ //_transceiver.shutdownWrite();
+ }
+ }
}
private void
registerWithPool()
{
- assert(!_threadPerConnection); // Only for use with a thread pool.
+ assert(!_threadPerConnection); // Only for use with a thread pool.
- if(!_registeredWithPool)
- {
- _threadPool._register(_transceiver.fd(), this);
- _registeredWithPool = true;
- }
+ if(!_registeredWithPool)
+ {
+ _threadPool._register(_transceiver.fd(), this);
+ _registeredWithPool = true;
+ }
}
private void
unregisterWithPool()
{
- assert(!_threadPerConnection); // Only for use with a thread pool.
-
- if(_registeredWithPool)
- {
- _threadPool.unregister(_transceiver.fd());
- _registeredWithPool = false;
- ++_finishedCount; // For each unregistration, finished() is called once.
- }
+ assert(!_threadPerConnection); // Only for use with a thread pool.
+
+ if(_registeredWithPool)
+ {
+ _threadPool.unregister(_transceiver.fd());
+ _registeredWithPool = false;
+ ++_finishedCount; // For each unregistration, finished() is called once.
+ }
}
private IceInternal.BasicStream
doCompress(IceInternal.BasicStream uncompressed, boolean compress)
{
- if(_compressionSupported)
- {
- if(compress && uncompressed.size() >= 100)
- {
- //
- // Do compression.
- //
- IceInternal.BasicStream cstream = uncompressed.compress(IceInternal.Protocol.headerSize,
- _compressionLevel);
- if(cstream != null)
- {
- //
- // Set compression status.
- //
- cstream.pos(9);
- cstream.writeByte((byte)2);
-
- //
- // Write the size of the compressed stream into the header.
- //
- cstream.pos(10);
- cstream.writeInt(cstream.size());
-
- //
- // Write the compression status and size of the compressed stream into the header of the
- // uncompressed stream -- we need this to trace requests correctly.
- //
- uncompressed.pos(9);
- uncompressed.writeByte((byte)2);
- uncompressed.writeInt(cstream.size());
-
- return cstream;
- }
- }
- }
-
- uncompressed.pos(9);
- uncompressed.writeByte((byte)((_compressionSupported && compress) ? 1 : 0));
-
- //
- // Not compressed, fill in the message size.
- //
- uncompressed.pos(10);
- uncompressed.writeInt(uncompressed.size());
-
- return uncompressed;
+ if(_compressionSupported)
+ {
+ if(compress && uncompressed.size() >= 100)
+ {
+ //
+ // Do compression.
+ //
+ IceInternal.BasicStream cstream = uncompressed.compress(IceInternal.Protocol.headerSize,
+ _compressionLevel);
+ if(cstream != null)
+ {
+ //
+ // Set compression status.
+ //
+ cstream.pos(9);
+ cstream.writeByte((byte)2);
+
+ //
+ // Write the size of the compressed stream into the header.
+ //
+ cstream.pos(10);
+ cstream.writeInt(cstream.size());
+
+ //
+ // Write the compression status and size of the compressed stream into the header of the
+ // uncompressed stream -- we need this to trace requests correctly.
+ //
+ uncompressed.pos(9);
+ uncompressed.writeByte((byte)2);
+ uncompressed.writeInt(cstream.size());
+
+ return cstream;
+ }
+ }
+ }
+
+ uncompressed.pos(9);
+ uncompressed.writeByte((byte)((_compressionSupported && compress) ? 1 : 0));
+
+ //
+ // Not compressed, fill in the message size.
+ //
+ uncompressed.pos(10);
+ uncompressed.writeInt(uncompressed.size());
+
+ return uncompressed;
}
private static class MessageInfo
{
- MessageInfo(IceInternal.BasicStream stream)
- {
- this.stream = stream;
- }
-
- IceInternal.BasicStream stream;
- int invokeNum;
- int requestId;
- byte compress;
- IceInternal.ServantManager servantManager;
- ObjectAdapter adapter;
- IceInternal.OutgoingAsync outAsync;
+ MessageInfo(IceInternal.BasicStream stream)
+ {
+ this.stream = stream;
+ }
+
+ IceInternal.BasicStream stream;
+ int invokeNum;
+ int requestId;
+ byte compress;
+ IceInternal.ServantManager servantManager;
+ ObjectAdapter adapter;
+ IceInternal.OutgoingAsync outAsync;
}
private void
parseMessage(MessageInfo info)
{
- assert(_state > StateNotValidated && _state < StateClosed);
-
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
- }
-
- try
- {
- //
- // We don't need to check magic and version here. This has
- // already been done by the ThreadPool or ThreadPerConnection,
- // which provides us with the stream.
- //
- assert(info.stream.pos() == info.stream.size());
- info.stream.pos(8);
- byte messageType = info.stream.readByte();
- info.compress = info.stream.readByte();
- if(info.compress == (byte)2)
- {
- if(_compressionSupported)
- {
- IceInternal.BasicStream ustream = info.stream.uncompress(IceInternal.Protocol.headerSize);
- if(ustream != info.stream)
- {
- info.stream = ustream;
- }
- }
- else
- {
- FeatureNotSupportedException ex = new FeatureNotSupportedException();
- ex.unsupportedFeature = "Cannot uncompress compressed message: "
- + "org.apache.tools.bzip2.CBZip2OutputStream was not found";
- throw ex;
- }
- }
- info.stream.pos(IceInternal.Protocol.headerSize);
-
- switch(messageType)
- {
- case IceInternal.Protocol.closeConnectionMsg:
- {
- IceInternal.TraceUtil.traceHeader("received close connection", info.stream, _logger, _traceLevels);
- if(_endpoint.datagram())
- {
- if(_warn)
- {
- _logger.warning("ignoring close connection message for datagram connection:\n" + _desc);
- }
- }
- else
- {
- setState(StateClosed, new CloseConnectionException());
- }
- break;
- }
-
- case IceInternal.Protocol.requestMsg:
- {
- if(_state == StateClosing)
- {
- IceInternal.TraceUtil.traceRequest("received request during closing\n" +
- "(ignored by server, client will retry)",
- info.stream, _logger, _traceLevels);
- }
- else
- {
- IceInternal.TraceUtil.traceRequest("received request", info.stream, _logger, _traceLevels);
- info.requestId = info.stream.readInt();
- info.invokeNum = 1;
- info.servantManager = _servantManager;
- info.adapter = _adapter;
- ++_dispatchCount;
- }
- break;
- }
-
- case IceInternal.Protocol.requestBatchMsg:
- {
- if(_state == StateClosing)
- {
- IceInternal.TraceUtil.traceBatchRequest("received batch request during closing\n" +
- "(ignored by server, client will retry)",
- info.stream, _logger, _traceLevels);
- }
- else
- {
- IceInternal.TraceUtil.traceBatchRequest("received batch request", info.stream, _logger,
- _traceLevels);
- info.invokeNum = info.stream.readInt();
- if(info.invokeNum < 0)
- {
- info.invokeNum = 0;
- throw new NegativeSizeException();
- }
- info.servantManager = _servantManager;
- info.adapter = _adapter;
- _dispatchCount += info.invokeNum;
- }
- break;
- }
-
- case IceInternal.Protocol.replyMsg:
- {
- IceInternal.TraceUtil.traceReply("received reply", info.stream, _logger, _traceLevels);
- info.requestId = info.stream.readInt();
- IceInternal.Outgoing out = (IceInternal.Outgoing)_requests.remove(info.requestId);
- if(out != null)
- {
- out.finished(info.stream);
- }
- else
- {
- info.outAsync = (IceInternal.OutgoingAsync)_asyncRequests.remove(info.requestId);
- if(info.outAsync == null)
- {
- throw new UnknownRequestIdException();
- }
- }
- break;
- }
-
- case IceInternal.Protocol.validateConnectionMsg:
- {
- IceInternal.TraceUtil.traceHeader("received validate connection", info.stream, _logger,
- _traceLevels);
- if(_warn)
- {
- _logger.warning("ignoring unexpected validate connection message:\n" + _desc);
- }
- break;
- }
-
- default:
- {
- IceInternal.TraceUtil.traceHeader("received unknown message\n" +
- "(invalid, closing connection)", info.stream, _logger,
- _traceLevels);
- throw new UnknownMessageException();
- }
- }
- }
- catch(SocketException ex)
- {
- setState(StateClosed, ex);
- }
- catch(LocalException ex)
- {
- if(_endpoint.datagram())
- {
- if(_warn)
- {
- _logger.warning("udp connection exception:\n" + ex + _desc);
- }
- }
- else
- {
- setState(StateClosed, ex);
- }
- }
+ assert(_state > StateNotValidated && _state < StateClosed);
+
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000;
+ }
+
+ try
+ {
+ //
+ // We don't need to check magic and version here. This has
+ // already been done by the ThreadPool or ThreadPerConnection,
+ // which provides us with the stream.
+ //
+ assert(info.stream.pos() == info.stream.size());
+ info.stream.pos(8);
+ byte messageType = info.stream.readByte();
+ info.compress = info.stream.readByte();
+ if(info.compress == (byte)2)
+ {
+ if(_compressionSupported)
+ {
+ IceInternal.BasicStream ustream = info.stream.uncompress(IceInternal.Protocol.headerSize);
+ if(ustream != info.stream)
+ {
+ info.stream = ustream;
+ }
+ }
+ else
+ {
+ FeatureNotSupportedException ex = new FeatureNotSupportedException();
+ ex.unsupportedFeature = "Cannot uncompress compressed message: "
+ + "org.apache.tools.bzip2.CBZip2OutputStream was not found";
+ throw ex;
+ }
+ }
+ info.stream.pos(IceInternal.Protocol.headerSize);
+
+ switch(messageType)
+ {
+ case IceInternal.Protocol.closeConnectionMsg:
+ {
+ IceInternal.TraceUtil.traceHeader("received close connection", info.stream, _logger, _traceLevels);
+ if(_endpoint.datagram())
+ {
+ if(_warn)
+ {
+ _logger.warning("ignoring close connection message for datagram connection:\n" + _desc);
+ }
+ }
+ else
+ {
+ setState(StateClosed, new CloseConnectionException());
+ }
+ break;
+ }
+
+ case IceInternal.Protocol.requestMsg:
+ {
+ if(_state == StateClosing)
+ {
+ IceInternal.TraceUtil.traceRequest("received request during closing\n" +
+ "(ignored by server, client will retry)",
+ info.stream, _logger, _traceLevels);
+ }
+ else
+ {
+ IceInternal.TraceUtil.traceRequest("received request", info.stream, _logger, _traceLevels);
+ info.requestId = info.stream.readInt();
+ info.invokeNum = 1;
+ info.servantManager = _servantManager;
+ info.adapter = _adapter;
+ ++_dispatchCount;
+ }
+ break;
+ }
+
+ case IceInternal.Protocol.requestBatchMsg:
+ {
+ if(_state == StateClosing)
+ {
+ IceInternal.TraceUtil.traceBatchRequest("received batch request during closing\n" +
+ "(ignored by server, client will retry)",
+ info.stream, _logger, _traceLevels);
+ }
+ else
+ {
+ IceInternal.TraceUtil.traceBatchRequest("received batch request", info.stream, _logger,
+ _traceLevels);
+ info.invokeNum = info.stream.readInt();
+ if(info.invokeNum < 0)
+ {
+ info.invokeNum = 0;
+ throw new NegativeSizeException();
+ }
+ info.servantManager = _servantManager;
+ info.adapter = _adapter;
+ _dispatchCount += info.invokeNum;
+ }
+ break;
+ }
+
+ case IceInternal.Protocol.replyMsg:
+ {
+ IceInternal.TraceUtil.traceReply("received reply", info.stream, _logger, _traceLevels);
+ info.requestId = info.stream.readInt();
+ IceInternal.Outgoing out = (IceInternal.Outgoing)_requests.remove(info.requestId);
+ if(out != null)
+ {
+ out.finished(info.stream);
+ }
+ else
+ {
+ info.outAsync = (IceInternal.OutgoingAsync)_asyncRequests.remove(info.requestId);
+ if(info.outAsync == null)
+ {
+ throw new UnknownRequestIdException();
+ }
+ }
+ break;
+ }
+
+ case IceInternal.Protocol.validateConnectionMsg:
+ {
+ IceInternal.TraceUtil.traceHeader("received validate connection", info.stream, _logger,
+ _traceLevels);
+ if(_warn)
+ {
+ _logger.warning("ignoring unexpected validate connection message:\n" + _desc);
+ }
+ break;
+ }
+
+ default:
+ {
+ IceInternal.TraceUtil.traceHeader("received unknown message\n" +
+ "(invalid, closing connection)", info.stream, _logger,
+ _traceLevels);
+ throw new UnknownMessageException();
+ }
+ }
+ }
+ catch(SocketException ex)
+ {
+ setState(StateClosed, ex);
+ }
+ catch(LocalException ex)
+ {
+ if(_endpoint.datagram())
+ {
+ if(_warn)
+ {
+ _logger.warning("udp connection exception:\n" + ex + _desc);
+ }
+ }
+ else
+ {
+ setState(StateClosed, ex);
+ }
+ }
}
private void
invokeAll(IceInternal.BasicStream stream, int invokeNum, int requestId, byte compress,
- IceInternal.ServantManager servantManager, ObjectAdapter adapter)
+ IceInternal.ServantManager servantManager, ObjectAdapter adapter)
{
- //
- // Note: In contrast to other private or protected methods, this
- // operation must be called *without* the mutex locked.
- //
-
- IceInternal.Incoming in = null;
- try
- {
- while(invokeNum > 0)
- {
-
- //
- // Prepare the invocation.
- //
- boolean response = !_endpoint.datagram() && requestId != 0;
- in = getIncoming(adapter, response, compress, requestId);
- IceInternal.BasicStream is = in.is();
- stream.swap(is);
- IceInternal.BasicStream os = in.os();
-
- //
- // Prepare the response if necessary.
- //
- if(response)
- {
- assert(invokeNum == 1); // No further invocations if a response is expected.
- os.writeBlob(IceInternal.Protocol.replyHdr);
-
- //
- // Add the request ID.
- //
- os.writeInt(requestId);
- }
-
- in.invoke(servantManager);
-
- //
- // If there are more invocations, we need the stream back.
- //
- if(--invokeNum > 0)
- {
- stream.swap(is);
- }
-
- reclaimIncoming(in);
- in = null;
- }
- }
- catch(LocalException ex)
- {
- invokeException(ex, invokeNum);
- }
- catch(java.lang.AssertionError ex) // Upon assertion, we print the stack trace.
- {
- UnknownException uex = new UnknownException();
- 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(uex, invokeNum);
- }
- finally
- {
- if(in != null)
- {
- reclaimIncoming(in);
- }
- }
+ //
+ // Note: In contrast to other private or protected methods, this
+ // operation must be called *without* the mutex locked.
+ //
+
+ IceInternal.Incoming in = null;
+ try
+ {
+ while(invokeNum > 0)
+ {
+
+ //
+ // Prepare the invocation.
+ //
+ boolean response = !_endpoint.datagram() && requestId != 0;
+ in = getIncoming(adapter, response, compress, requestId);
+ IceInternal.BasicStream is = in.is();
+ stream.swap(is);
+ IceInternal.BasicStream os = in.os();
+
+ //
+ // Prepare the response if necessary.
+ //
+ if(response)
+ {
+ assert(invokeNum == 1); // No further invocations if a response is expected.
+ os.writeBlob(IceInternal.Protocol.replyHdr);
+
+ //
+ // Add the request ID.
+ //
+ os.writeInt(requestId);
+ }
+
+ in.invoke(servantManager);
+
+ //
+ // If there are more invocations, we need the stream back.
+ //
+ if(--invokeNum > 0)
+ {
+ stream.swap(is);
+ }
+
+ reclaimIncoming(in);
+ in = null;
+ }
+ }
+ catch(LocalException ex)
+ {
+ invokeException(ex, invokeNum);
+ }
+ catch(java.lang.AssertionError ex) // Upon assertion, we print the stack trace.
+ {
+ UnknownException uex = new UnknownException();
+ 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(uex, invokeNum);
+ }
+ finally
+ {
+ if(in != null)
+ {
+ reclaimIncoming(in);
+ }
+ }
}
private void
run()
{
- //
- // For non-datagram connections, the thread-per-connection
- // must validate and activate this connection, and not in the
- // connection factory. Please see the comments in the
- // connection factory for details.
- //
- if(!_endpoint.datagram())
- {
- try
- {
- validate();
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- assert(_state == StateClosed);
-
- //
- // We must make sure that nobody is sending when
- // we close the transceiver.
- //
- synchronized(_sendMutex)
- {
- if(_transceiver != null)
- {
- try
- {
- _transceiver.close();
- }
- catch(LocalException e)
- {
- // Here we ignore any exceptions in close().
- }
-
- _transceiver = null;
- }
- notifyAll();
- }
- }
- return;
- }
-
- activate();
- }
-
- boolean warnUdp = _instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Datagrams") > 0;
-
- boolean closed = false;
-
- IceInternal.BasicStream stream = new IceInternal.BasicStream(_instance);
-
- while(!closed)
- {
- //
- // We must accept new connections outside the thread
- // synchronization, because we use blocking accept.
- //
-
- try
- {
- try
- {
- stream.resize(IceInternal.Protocol.headerSize, true);
- stream.pos(0);
- _transceiver.read(stream, -1);
-
- int pos = stream.pos();
- if(pos < IceInternal.Protocol.headerSize)
- {
- //
- // This situation is possible for small UDP packets.
- //
- throw new IllegalMessageSizeException();
- }
- stream.pos(0);
- byte[] m = stream.readBlob(4);
- if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] ||
- m[2] != IceInternal.Protocol.magic[2] || m[3] != IceInternal.Protocol.magic[3])
- {
- BadMagicException ex = new BadMagicException();
- ex.badMagic = m;
- throw ex;
- }
- byte pMajor = stream.readByte();
- byte pMinor = stream.readByte();
- if(pMajor != IceInternal.Protocol.protocolMajor)
- {
- UnsupportedProtocolException e = new UnsupportedProtocolException();
- e.badMajor = pMajor < 0 ? pMajor + 255 : pMajor;
- e.badMinor = pMinor < 0 ? pMinor + 255 : pMinor;
- e.major = IceInternal.Protocol.protocolMajor;
- e.minor = IceInternal.Protocol.protocolMinor;
- throw e;
- }
- byte eMajor = stream.readByte();
- byte eMinor = stream.readByte();
- if(eMajor != IceInternal.Protocol.encodingMajor)
- {
- UnsupportedEncodingException e = new UnsupportedEncodingException();
- e.badMajor = eMajor < 0 ? eMajor + 255 : eMajor;
- e.badMinor = eMinor < 0 ? eMinor + 255 : eMinor;
- e.major = IceInternal.Protocol.encodingMajor;
- e.minor = IceInternal.Protocol.encodingMinor;
- throw e;
- }
- byte messageType = stream.readByte();
- byte compress = stream.readByte();
- int size = stream.readInt();
- if(size < IceInternal.Protocol.headerSize)
- {
- throw new IllegalMessageSizeException();
- }
- if(size > _instance.messageSizeMax())
- {
- throw new MemoryLimitException();
- }
- if(size > stream.size())
- {
- stream.resize(size, true);
- }
- stream.pos(pos);
-
- if(pos != stream.size())
- {
- if(_endpoint.datagram())
- {
- if(warnUdp)
- {
- _logger.warning("DatagramLimitException: maximum size of " + pos + " exceeded");
- }
- throw new DatagramLimitException();
- }
- else
- {
- _transceiver.read(stream, -1);
- assert(stream.pos() == stream.size());
- }
- }
- }
- catch(DatagramLimitException ex) // Expected.
- {
- continue;
- }
- catch(SocketException ex)
- {
- exception(ex);
- }
- catch(LocalException ex)
- {
- if(_endpoint.datagram())
- {
- if(_warn)
- {
- _logger.warning("datagram connection exception:\n" + ex + "\n" + _desc);
- }
- continue;
- }
- else
- {
- exception(ex);
- }
- }
-
- MessageInfo info = new MessageInfo(stream);
-
- LocalException localEx = null;
-
- IceInternal.IntMap requests = null;
- IceInternal.IntMap asyncRequests = null;
-
- synchronized(this)
- {
- while(_state == StateHolding)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- if(_state != StateClosed)
- {
- parseMessage(info);
- }
-
- //
- // parseMessage() can close the connection, so we must
- // check for closed state again.
- //
- if(_state == StateClosed)
- {
- //
- // We must make sure that nobody is sending when we close
- // the transceiver.
- //
- synchronized(_sendMutex)
- {
- try
- {
- _transceiver.close();
- }
- catch(LocalException ex)
- {
- localEx = ex;
- }
-
- _transceiver = null;
- notifyAll();
- }
-
- //
- // We cannot simply return here. We have to make sure
- // that all requests (regular and async) are notified
- // about the closed connection below.
- //
- closed = true;
- }
-
- if(_state == StateClosed || _state == StateClosing)
- {
- requests = _requests;
- _requests = new IceInternal.IntMap();
-
- asyncRequests = _asyncRequests;
- _asyncRequests = new IceInternal.IntMap();
- }
- }
-
- //
- // Asynchronous replies must be handled outside the thread
- // synchronization, so that nested calls are possible.
- //
- if(info.outAsync != null)
- {
- info.outAsync.__finished(info.stream);
- }
-
- //
- // Method invocation (or multiple invocations for batch messages)
- // must be done outside the thread synchronization, so that nested
- // calls are possible.
- //
- invokeAll(info.stream, info.invokeNum, info.requestId, info.compress, info.servantManager,
- info.adapter);
-
- if(requests != null)
- {
- java.util.Iterator i = requests.entryIterator();
- while(i.hasNext())
- {
- IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next();
- IceInternal.Outgoing out = (IceInternal.Outgoing)e.getValue();
- out.finished(_exception); // The exception is immutable at this point.
- }
- }
-
- if(asyncRequests != null)
- {
- java.util.Iterator i = asyncRequests.entryIterator();
- while(i.hasNext())
- {
- IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next();
- IceInternal.OutgoingAsync out = (IceInternal.OutgoingAsync)e.getValue();
- out.__finished(_exception); // The exception is immutable at this point.
- }
- }
-
- if(localEx != null)
- {
- assert(closed);
- throw localEx;
- }
- }
- finally
- {
- stream.reset();
- }
- }
+ //
+ // For non-datagram connections, the thread-per-connection
+ // must validate and activate this connection, and not in the
+ // connection factory. Please see the comments in the
+ // connection factory for details.
+ //
+ if(!_endpoint.datagram())
+ {
+ try
+ {
+ validate();
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ assert(_state == StateClosed);
+
+ //
+ // We must make sure that nobody is sending when
+ // we close the transceiver.
+ //
+ synchronized(_sendMutex)
+ {
+ if(_transceiver != null)
+ {
+ try
+ {
+ _transceiver.close();
+ }
+ catch(LocalException e)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ _transceiver = null;
+ }
+ notifyAll();
+ }
+ }
+ return;
+ }
+
+ activate();
+ }
+
+ boolean warnUdp = _instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Datagrams") > 0;
+
+ boolean closed = false;
+
+ IceInternal.BasicStream stream = new IceInternal.BasicStream(_instance);
+
+ while(!closed)
+ {
+ //
+ // We must accept new connections outside the thread
+ // synchronization, because we use blocking accept.
+ //
+
+ try
+ {
+ try
+ {
+ stream.resize(IceInternal.Protocol.headerSize, true);
+ stream.pos(0);
+ _transceiver.read(stream, -1);
+
+ int pos = stream.pos();
+ if(pos < IceInternal.Protocol.headerSize)
+ {
+ //
+ // This situation is possible for small UDP packets.
+ //
+ throw new IllegalMessageSizeException();
+ }
+ stream.pos(0);
+ byte[] m = stream.readBlob(4);
+ if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] ||
+ m[2] != IceInternal.Protocol.magic[2] || m[3] != IceInternal.Protocol.magic[3])
+ {
+ BadMagicException ex = new BadMagicException();
+ ex.badMagic = m;
+ throw ex;
+ }
+ byte pMajor = stream.readByte();
+ byte pMinor = stream.readByte();
+ if(pMajor != IceInternal.Protocol.protocolMajor)
+ {
+ UnsupportedProtocolException e = new UnsupportedProtocolException();
+ e.badMajor = pMajor < 0 ? pMajor + 255 : pMajor;
+ e.badMinor = pMinor < 0 ? pMinor + 255 : pMinor;
+ e.major = IceInternal.Protocol.protocolMajor;
+ e.minor = IceInternal.Protocol.protocolMinor;
+ throw e;
+ }
+ byte eMajor = stream.readByte();
+ byte eMinor = stream.readByte();
+ if(eMajor != IceInternal.Protocol.encodingMajor)
+ {
+ UnsupportedEncodingException e = new UnsupportedEncodingException();
+ e.badMajor = eMajor < 0 ? eMajor + 255 : eMajor;
+ e.badMinor = eMinor < 0 ? eMinor + 255 : eMinor;
+ e.major = IceInternal.Protocol.encodingMajor;
+ e.minor = IceInternal.Protocol.encodingMinor;
+ throw e;
+ }
+ byte messageType = stream.readByte();
+ byte compress = stream.readByte();
+ int size = stream.readInt();
+ if(size < IceInternal.Protocol.headerSize)
+ {
+ throw new IllegalMessageSizeException();
+ }
+ if(size > _instance.messageSizeMax())
+ {
+ throw new MemoryLimitException();
+ }
+ if(size > stream.size())
+ {
+ stream.resize(size, true);
+ }
+ stream.pos(pos);
+
+ if(pos != stream.size())
+ {
+ if(_endpoint.datagram())
+ {
+ if(warnUdp)
+ {
+ _logger.warning("DatagramLimitException: maximum size of " + pos + " exceeded");
+ }
+ throw new DatagramLimitException();
+ }
+ else
+ {
+ _transceiver.read(stream, -1);
+ assert(stream.pos() == stream.size());
+ }
+ }
+ }
+ catch(DatagramLimitException ex) // Expected.
+ {
+ continue;
+ }
+ catch(SocketException ex)
+ {
+ exception(ex);
+ }
+ catch(LocalException ex)
+ {
+ if(_endpoint.datagram())
+ {
+ if(_warn)
+ {
+ _logger.warning("datagram connection exception:\n" + ex + "\n" + _desc);
+ }
+ continue;
+ }
+ else
+ {
+ exception(ex);
+ }
+ }
+
+ MessageInfo info = new MessageInfo(stream);
+
+ LocalException localEx = null;
+
+ IceInternal.IntMap requests = null;
+ IceInternal.IntMap asyncRequests = null;
+
+ synchronized(this)
+ {
+ while(_state == StateHolding)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(_state != StateClosed)
+ {
+ parseMessage(info);
+ }
+
+ //
+ // parseMessage() can close the connection, so we must
+ // check for closed state again.
+ //
+ if(_state == StateClosed)
+ {
+ //
+ // We must make sure that nobody is sending when we close
+ // the transceiver.
+ //
+ synchronized(_sendMutex)
+ {
+ try
+ {
+ _transceiver.close();
+ }
+ catch(LocalException ex)
+ {
+ localEx = ex;
+ }
+
+ _transceiver = null;
+ notifyAll();
+ }
+
+ //
+ // We cannot simply return here. We have to make sure
+ // that all requests (regular and async) are notified
+ // about the closed connection below.
+ //
+ closed = true;
+ }
+
+ if(_state == StateClosed || _state == StateClosing)
+ {
+ requests = _requests;
+ _requests = new IceInternal.IntMap();
+
+ asyncRequests = _asyncRequests;
+ _asyncRequests = new IceInternal.IntMap();
+ }
+ }
+
+ //
+ // Asynchronous replies must be handled outside the thread
+ // synchronization, so that nested calls are possible.
+ //
+ if(info.outAsync != null)
+ {
+ info.outAsync.__finished(info.stream);
+ }
+
+ //
+ // Method invocation (or multiple invocations for batch messages)
+ // must be done outside the thread synchronization, so that nested
+ // calls are possible.
+ //
+ invokeAll(info.stream, info.invokeNum, info.requestId, info.compress, info.servantManager,
+ info.adapter);
+
+ if(requests != null)
+ {
+ java.util.Iterator i = requests.entryIterator();
+ while(i.hasNext())
+ {
+ IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next();
+ IceInternal.Outgoing out = (IceInternal.Outgoing)e.getValue();
+ out.finished(_exception); // The exception is immutable at this point.
+ }
+ }
+
+ if(asyncRequests != null)
+ {
+ java.util.Iterator i = asyncRequests.entryIterator();
+ while(i.hasNext())
+ {
+ IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next();
+ IceInternal.OutgoingAsync out = (IceInternal.OutgoingAsync)e.getValue();
+ out.__finished(_exception); // The exception is immutable at this point.
+ }
+ }
+
+ if(localEx != null)
+ {
+ assert(closed);
+ throw localEx;
+ }
+ }
+ finally
+ {
+ stream.reset();
+ }
+ }
}
private void
@@ -2548,7 +2548,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
- ex.printStackTrace(pw);
+ ex.printStackTrace(pw);
pw.flush();
String s = msg + ":\n" + _desc + "\n" + sw.toString();
_logger.warning(s);
@@ -2559,7 +2559,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
- ex.printStackTrace(pw);
+ ex.printStackTrace(pw);
pw.flush();
String s = msg + ":\n" + _desc + "\n" + sw.toString();
_logger.error(s);
@@ -2570,27 +2570,27 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
IceInternal.Incoming in = null;
- if(_cacheBuffers)
- {
- synchronized(_incomingCacheMutex)
- {
- if(_incomingCache == null)
- {
- in = new IceInternal.Incoming(_instance, this, adapter, response, compress, requestId);
- }
- else
- {
- in = _incomingCache;
- _incomingCache = _incomingCache.next;
- in.reset(_instance, this, adapter, response, compress, requestId);
- in.next = null;
- }
- }
- }
- else
- {
- in = new IceInternal.Incoming(_instance, this, adapter, response, compress, requestId);
- }
+ if(_cacheBuffers)
+ {
+ synchronized(_incomingCacheMutex)
+ {
+ if(_incomingCache == null)
+ {
+ in = new IceInternal.Incoming(_instance, this, adapter, response, compress, requestId);
+ }
+ else
+ {
+ in = _incomingCache;
+ _incomingCache = _incomingCache.next;
+ in.reset(_instance, this, adapter, response, compress, requestId);
+ in.next = null;
+ }
+ }
+ }
+ else
+ {
+ in = new IceInternal.Incoming(_instance, this, adapter, response, compress, requestId);
+ }
return in;
}
@@ -2598,96 +2598,96 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
private void
reclaimIncoming(IceInternal.Incoming in)
{
- if(_cacheBuffers)
- {
- synchronized(_incomingCacheMutex)
- {
- in.next = _incomingCache;
- _incomingCache = in;
- //
- // Clear references to Ice objects as soon as possible.
- //
- _incomingCache.reclaim();
- }
- }
+ if(_cacheBuffers)
+ {
+ synchronized(_incomingCacheMutex)
+ {
+ in.next = _incomingCache;
+ _incomingCache = in;
+ //
+ // Clear references to Ice objects as soon as possible.
+ //
+ _incomingCache.reclaim();
+ }
+ }
}
public IceInternal.Outgoing
getOutgoing(IceInternal.Reference reference, String operation, OperationMode mode, java.util.Map context,
- boolean compress)
- throws IceInternal.LocalExceptionWrapper
+ boolean compress)
+ throws IceInternal.LocalExceptionWrapper
{
- IceInternal.Outgoing out = null;
-
- if(_cacheBuffers)
- {
- synchronized(_outgoingCacheMutex)
- {
- if(_outgoingCache == null)
- {
- out = new IceInternal.Outgoing(this, reference, operation, mode, context, compress);
- }
- else
- {
- out = _outgoingCache;
- _outgoingCache = _outgoingCache.next;
- out.reset(reference, operation, mode, context, compress);
- out.next = null;
- }
- }
- }
- else
- {
- out = new IceInternal.Outgoing(this, reference, operation, mode, context, compress);
- }
-
- return out;
+ IceInternal.Outgoing out = null;
+
+ if(_cacheBuffers)
+ {
+ synchronized(_outgoingCacheMutex)
+ {
+ if(_outgoingCache == null)
+ {
+ out = new IceInternal.Outgoing(this, reference, operation, mode, context, compress);
+ }
+ else
+ {
+ out = _outgoingCache;
+ _outgoingCache = _outgoingCache.next;
+ out.reset(reference, operation, mode, context, compress);
+ out.next = null;
+ }
+ }
+ }
+ else
+ {
+ out = new IceInternal.Outgoing(this, reference, operation, mode, context, compress);
+ }
+
+ return out;
}
public void
reclaimOutgoing(IceInternal.Outgoing out)
{
- if(_cacheBuffers)
- {
- //
- // Clear references to Ice objects as soon as possible.
- //
- out.reclaim();
-
- synchronized(_outgoingCacheMutex)
- {
- out.next = _outgoingCache;
- _outgoingCache = out;
- }
- }
+ if(_cacheBuffers)
+ {
+ //
+ // Clear references to Ice objects as soon as possible.
+ //
+ out.reclaim();
+
+ synchronized(_outgoingCacheMutex)
+ {
+ out.next = _outgoingCache;
+ _outgoingCache = out;
+ }
+ }
}
private class ThreadPerConnection extends Thread
{
- public void
- run()
- {
- if(ConnectionI.this._instance.initializationData().threadHook != null)
- {
- ConnectionI.this._instance.initializationData().threadHook.start();
- }
-
- try
- {
- ConnectionI.this.run();
- }
- catch(Exception ex)
- {
- ConnectionI.this.error("exception in thread per connection", ex);
- }
- finally
- {
- if(ConnectionI.this._instance.initializationData().threadHook != null)
- {
- ConnectionI.this._instance.initializationData().threadHook.stop();
- }
- }
- }
+ public void
+ run()
+ {
+ if(ConnectionI.this._instance.initializationData().threadHook != null)
+ {
+ ConnectionI.this._instance.initializationData().threadHook.start();
+ }
+
+ try
+ {
+ ConnectionI.this.run();
+ }
+ catch(Exception ex)
+ {
+ ConnectionI.this.error("exception in thread per connection", ex);
+ }
+ finally
+ {
+ if(ConnectionI.this._instance.initializationData().threadHook != null)
+ {
+ ConnectionI.this._instance.initializationData().threadHook.stop();
+ }
+ }
+ }
}
private Thread _thread;
private final boolean _threadPerConnection;
diff --git a/java/src/Ice/ImplicitContextI.java b/java/src/Ice/ImplicitContextI.java
index 865c8eed725..e595d2d5a1f 100644
--- a/java/src/Ice/ImplicitContextI.java
+++ b/java/src/Ice/ImplicitContextI.java
@@ -16,27 +16,27 @@ public abstract class ImplicitContextI extends LocalObjectImpl implements Implic
{
public static ImplicitContextI create(String kind)
{
- if(kind.equals("None") || kind.equals(""))
- {
- return null;
- }
- else if(kind.equals("Shared"))
- {
- return new Shared();
- }
- else if(kind.equals("SharedWithoutLocking"))
- {
- return new SharedWithoutLocking();
- }
- else if(kind.equals("PerThread"))
- {
- return new PerThread();
- }
- else
- {
- throw new Ice.InitializationException(
- "'" + kind + "' is not a valid value for Ice.ImplicitContext");
- }
+ if(kind.equals("None") || kind.equals(""))
+ {
+ return null;
+ }
+ else if(kind.equals("Shared"))
+ {
+ return new Shared();
+ }
+ else if(kind.equals("SharedWithoutLocking"))
+ {
+ return new SharedWithoutLocking();
+ }
+ else if(kind.equals("PerThread"))
+ {
+ return new PerThread();
+ }
+ else
+ {
+ throw new Ice.InitializationException(
+ "'" + kind + "' is not a valid value for Ice.ImplicitContext");
+ }
}
abstract public void write(java.util.Map prxContext, IceInternal.BasicStream os);
@@ -45,317 +45,317 @@ public abstract class ImplicitContextI extends LocalObjectImpl implements Implic
static class SharedWithoutLocking extends ImplicitContextI
{
- public java.util.Map getContext()
- {
- return (java.util.Map)_context.clone();
- }
-
- public void setContext(java.util.Map context)
- {
- _context.clear();
- if(context != null && !context.isEmpty())
- {
- _context.putAll(context);
- }
- }
-
- public String get(String key)
- {
- if(key == null)
- {
- key = "";
- }
-
-
- String val = (String)_context.get(key);
- if(val == null)
- {
- throw new Ice.NotSetException(key);
- }
- else
- {
- return val;
- }
- }
-
- public String getWithDefault(String key, String dflt)
- {
- if(key == null)
- {
- key = "";
- }
- if(dflt == null)
- {
- dflt = "";
- }
-
- String val = (String)_context.get(key);
- return val == null ? dflt : val;
- }
-
- public void set(String key, String value)
- {
- if(key == null)
- {
- key = "";
- }
- if(value == null)
- {
- value = "";
- }
-
- _context.put(key, value);
- }
-
- public void remove(String key)
- {
- if(key == null)
- {
- key = "";
- }
-
- if(_context.remove(key) == null)
- {
- throw new Ice.NotSetException(key);
- }
- }
-
- public void write(java.util.Map prxContext, IceInternal.BasicStream os)
- {
- if(prxContext.isEmpty())
- {
- ContextHelper.write(os, _context);
- }
- else if(_context.isEmpty())
- {
- ContextHelper.write(os, prxContext);
- }
- else
- {
- ContextHelper.write(os, combine(prxContext));
- }
- }
-
- java.util.Map combine(java.util.Map prxContext)
- {
- java.util.Map combined = (java.util.Map)_context.clone();
- combined.putAll(prxContext);
- return combined;
- }
-
- protected java.util.HashMap _context = new java.util.HashMap();
+ public java.util.Map getContext()
+ {
+ return (java.util.Map)_context.clone();
+ }
+
+ public void setContext(java.util.Map context)
+ {
+ _context.clear();
+ if(context != null && !context.isEmpty())
+ {
+ _context.putAll(context);
+ }
+ }
+
+ public String get(String key)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+
+
+ String val = (String)_context.get(key);
+ if(val == null)
+ {
+ throw new Ice.NotSetException(key);
+ }
+ else
+ {
+ return val;
+ }
+ }
+
+ public String getWithDefault(String key, String dflt)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+ if(dflt == null)
+ {
+ dflt = "";
+ }
+
+ String val = (String)_context.get(key);
+ return val == null ? dflt : val;
+ }
+
+ public void set(String key, String value)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+ if(value == null)
+ {
+ value = "";
+ }
+
+ _context.put(key, value);
+ }
+
+ public void remove(String key)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+
+ if(_context.remove(key) == null)
+ {
+ throw new Ice.NotSetException(key);
+ }
+ }
+
+ public void write(java.util.Map prxContext, IceInternal.BasicStream os)
+ {
+ if(prxContext.isEmpty())
+ {
+ ContextHelper.write(os, _context);
+ }
+ else if(_context.isEmpty())
+ {
+ ContextHelper.write(os, prxContext);
+ }
+ else
+ {
+ ContextHelper.write(os, combine(prxContext));
+ }
+ }
+
+ java.util.Map combine(java.util.Map prxContext)
+ {
+ java.util.Map combined = (java.util.Map)_context.clone();
+ combined.putAll(prxContext);
+ return combined;
+ }
+
+ protected java.util.HashMap _context = new java.util.HashMap();
}
static class Shared extends SharedWithoutLocking
{
- public synchronized java.util.Map getContext()
- {
- return super.getContext();
- }
-
- public synchronized void setContext(java.util.Map context)
- {
- super.setContext(context);
- }
-
- public synchronized String get(String key)
- {
- return super.get(key);
- }
-
- public synchronized String getWithDefault(String key, String dflt)
- {
- return super.getWithDefault(key, dflt);
- }
-
- public synchronized void set(String key, String value)
- {
- super.set(key, value);
- }
-
- public synchronized void remove(String key)
- {
- super.remove(key);
- }
-
- public void write(java.util.Map prxContext, IceInternal.BasicStream os)
- {
- if(prxContext.isEmpty())
- {
- synchronized(this)
- {
- ContextHelper.write(os, _context);
- }
- }
- else
- {
- java.util.Map ctx = null;
- synchronized(this)
- {
- ctx = _context.isEmpty() ? prxContext : super.combine(prxContext);
- }
- ContextHelper.write(os, ctx);
- }
- }
-
- synchronized java.util.Map combine(java.util.Map prxContext)
- {
- return super.combine(prxContext);
- }
+ public synchronized java.util.Map getContext()
+ {
+ return super.getContext();
+ }
+
+ public synchronized void setContext(java.util.Map context)
+ {
+ super.setContext(context);
+ }
+
+ public synchronized String get(String key)
+ {
+ return super.get(key);
+ }
+
+ public synchronized String getWithDefault(String key, String dflt)
+ {
+ return super.getWithDefault(key, dflt);
+ }
+
+ public synchronized void set(String key, String value)
+ {
+ super.set(key, value);
+ }
+
+ public synchronized void remove(String key)
+ {
+ super.remove(key);
+ }
+
+ public void write(java.util.Map prxContext, IceInternal.BasicStream os)
+ {
+ if(prxContext.isEmpty())
+ {
+ synchronized(this)
+ {
+ ContextHelper.write(os, _context);
+ }
+ }
+ else
+ {
+ java.util.Map ctx = null;
+ synchronized(this)
+ {
+ ctx = _context.isEmpty() ? prxContext : super.combine(prxContext);
+ }
+ ContextHelper.write(os, ctx);
+ }
+ }
+
+ synchronized java.util.Map combine(java.util.Map prxContext)
+ {
+ return super.combine(prxContext);
+ }
}
static class PerThread extends ImplicitContextI
{
-
- public java.util.Map getContext()
- {
- //
- // Note that _map is a *synchronized* map
- //
- java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
-
- if(threadContext == null)
- {
- threadContext = new java.util.HashMap();
- }
- return threadContext;
- }
-
- public void setContext(java.util.Map context)
- {
- if(context == null || context.isEmpty())
- {
- _map.remove(Thread.currentThread());
- }
- else
- {
- java.util.HashMap threadContext = new java.util.HashMap(context);
- _map.put(Thread.currentThread(), threadContext);
- }
- }
-
- public String get(String key)
- {
- if(key == null)
- {
- key = "";
- }
-
- java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
-
- if(threadContext == null)
- {
- throw new Ice.NotSetException(key);
- }
- String val = (String)threadContext.get(key);
- if(val == null)
- {
- throw new Ice.NotSetException(key);
- }
- return val;
- }
-
- public String getWithDefault(String key, String dflt)
- {
- if(key == null)
- {
- key = "";
- }
- if(dflt == null)
- {
- dflt = "";
- }
+
+ public java.util.Map getContext()
+ {
+ //
+ // Note that _map is a *synchronized* map
+ //
+ java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
+
+ if(threadContext == null)
+ {
+ threadContext = new java.util.HashMap();
+ }
+ return threadContext;
+ }
+
+ public void setContext(java.util.Map context)
+ {
+ if(context == null || context.isEmpty())
+ {
+ _map.remove(Thread.currentThread());
+ }
+ else
+ {
+ java.util.HashMap threadContext = new java.util.HashMap(context);
+ _map.put(Thread.currentThread(), threadContext);
+ }
+ }
+
+ public String get(String key)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+
+ java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
+
+ if(threadContext == null)
+ {
+ throw new Ice.NotSetException(key);
+ }
+ String val = (String)threadContext.get(key);
+ if(val == null)
+ {
+ throw new Ice.NotSetException(key);
+ }
+ return val;
+ }
+
+ public String getWithDefault(String key, String dflt)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+ if(dflt == null)
+ {
+ dflt = "";
+ }
- java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
-
- if(threadContext == null)
- {
- return dflt;
- }
- String val = (String)threadContext.get(key);
- if(val == null)
- {
- return dflt;
- }
- return val;
- }
-
- public void set(String key, String value)
- {
- if(key == null)
- {
- key = "";
- }
- if(value == null)
- {
- value = "";
- }
-
- Thread currentThread = Thread.currentThread();
- java.util.HashMap threadContext = (java.util.HashMap)_map.get(currentThread);
-
- if(threadContext == null)
- {
- threadContext = new java.util.HashMap();
- _map.put(currentThread, threadContext);
- }
-
- threadContext.put(key, value);
- }
-
- public void remove(String key)
- {
- if(key == null)
- {
- key = "";
- }
-
- java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
-
- if(threadContext == null)
- {
- throw new Ice.NotSetException(key);
- }
-
- if(threadContext.remove(key) == null)
- {
- throw new Ice.NotSetException(key);
- }
- }
-
- public void write(java.util.Map prxContext, IceInternal.BasicStream os)
- {
- java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
-
- if(threadContext == null || threadContext.isEmpty())
- {
- ContextHelper.write(os, prxContext);
- }
- else if(prxContext.isEmpty())
- {
- ContextHelper.write(os, threadContext);
- }
- else
- {
- java.util.Map combined = (java.util.Map)threadContext.clone();
- combined.putAll(prxContext);
- ContextHelper.write(os, combined);
- }
- }
-
- java.util.Map combine(java.util.Map prxContext)
- {
- java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
-
- java.util.Map combined = (java.util.Map)threadContext.clone();
- combined.putAll(prxContext);
- return combined;
- }
-
- //
- // Synchronized map Thread -> Context
- //
- private java.util.Map _map = java.util.Collections.synchronizedMap(new java.util.HashMap());
+ java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
+
+ if(threadContext == null)
+ {
+ return dflt;
+ }
+ String val = (String)threadContext.get(key);
+ if(val == null)
+ {
+ return dflt;
+ }
+ return val;
+ }
+
+ public void set(String key, String value)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+ if(value == null)
+ {
+ value = "";
+ }
+
+ Thread currentThread = Thread.currentThread();
+ java.util.HashMap threadContext = (java.util.HashMap)_map.get(currentThread);
+
+ if(threadContext == null)
+ {
+ threadContext = new java.util.HashMap();
+ _map.put(currentThread, threadContext);
+ }
+
+ threadContext.put(key, value);
+ }
+
+ public void remove(String key)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+
+ java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
+
+ if(threadContext == null)
+ {
+ throw new Ice.NotSetException(key);
+ }
+
+ if(threadContext.remove(key) == null)
+ {
+ throw new Ice.NotSetException(key);
+ }
+ }
+
+ public void write(java.util.Map prxContext, IceInternal.BasicStream os)
+ {
+ java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
+
+ if(threadContext == null || threadContext.isEmpty())
+ {
+ ContextHelper.write(os, prxContext);
+ }
+ else if(prxContext.isEmpty())
+ {
+ ContextHelper.write(os, threadContext);
+ }
+ else
+ {
+ java.util.Map combined = (java.util.Map)threadContext.clone();
+ combined.putAll(prxContext);
+ ContextHelper.write(os, combined);
+ }
+ }
+
+ java.util.Map combine(java.util.Map prxContext)
+ {
+ java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread());
+
+ java.util.Map combined = (java.util.Map)threadContext.clone();
+ combined.putAll(prxContext);
+ return combined;
+ }
+
+ //
+ // Synchronized map Thread -> Context
+ //
+ private java.util.Map _map = java.util.Collections.synchronizedMap(new java.util.HashMap());
}
}
diff --git a/java/src/Ice/InputStreamI.java b/java/src/Ice/InputStreamI.java
index 790e918125e..b1b1975811a 100644
--- a/java/src/Ice/InputStreamI.java
+++ b/java/src/Ice/InputStreamI.java
@@ -16,7 +16,7 @@ public class InputStreamI implements InputStream
{
_communicator = communicator;
- _is = new IceInternal.BasicInputStream(Util.getInstance(communicator), this);
+ _is = new IceInternal.BasicInputStream(Util.getInstance(communicator), this);
_is.resize(data.length, true);
java.nio.ByteBuffer buf = _is.prepareRead();
buf.position(0);
diff --git a/java/src/Ice/LocalException.java b/java/src/Ice/LocalException.java
index b4cbb83e8f2..65807b5e8f4 100644
--- a/java/src/Ice/LocalException.java
+++ b/java/src/Ice/LocalException.java
@@ -14,15 +14,15 @@ public abstract class LocalException extends RuntimeException
public java.lang.Object clone()
{
java.lang.Object o = null;
- try
- {
- o = super.clone();
- }
- catch(CloneNotSupportedException ex)
- {
- assert false; // Impossible
- }
- return o;
+ try
+ {
+ o = super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert false; // Impossible
+ }
+ return o;
}
public abstract String
diff --git a/java/src/Ice/LoggerI.java b/java/src/Ice/LoggerI.java
index 40341ee089f..72253d59503 100644
--- a/java/src/Ice/LoggerI.java
+++ b/java/src/Ice/LoggerI.java
@@ -14,34 +14,34 @@ public final class LoggerI extends LocalObjectImpl implements Logger
public
LoggerI(String prefix)
{
- if(prefix.length() > 0)
- {
- _prefix = prefix + ": ";
- }
+ if(prefix.length() > 0)
+ {
+ _prefix = prefix + ": ";
+ }
- _lineSeparator = System.getProperties().getProperty("line.separator");
- _date = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT);
- _time = new java.text.SimpleDateFormat(" HH:mm:ss:SSS");
+ _lineSeparator = System.getProperties().getProperty("line.separator");
+ _date = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT);
+ _time = new java.text.SimpleDateFormat(" HH:mm:ss:SSS");
}
public void
print(String message)
{
- System.err.print(message + _lineSeparator);
+ System.err.print(message + _lineSeparator);
}
public void
trace(String category, String message)
{
StringBuffer s = new StringBuffer("[ ");
- s.append(_date.format(new java.util.Date()));
- s.append(_time.format(new java.util.Date()));
- s.append(' ');
- s.append(_prefix);
- s.append(category);
- s.append(": ");
- s.append(message);
- s.append(" ]");
+ s.append(_date.format(new java.util.Date()));
+ s.append(_time.format(new java.util.Date()));
+ s.append(' ');
+ s.append(_prefix);
+ s.append(category);
+ s.append(": ");
+ s.append(message);
+ s.append(" ]");
int idx = 0;
while((idx = s.indexOf("\n", idx)) != -1)
{
@@ -54,27 +54,27 @@ public final class LoggerI extends LocalObjectImpl implements Logger
public void
warning(String message)
{
- StringBuffer s = new StringBuffer();
- s.append(_date.format(new java.util.Date()));
- s.append(_time.format(new java.util.Date()));
- s.append(' ');
- s.append(_prefix);
- s.append("warning: ");
- s.append(message);
- System.err.print(s.toString() + _lineSeparator);
+ StringBuffer s = new StringBuffer();
+ s.append(_date.format(new java.util.Date()));
+ s.append(_time.format(new java.util.Date()));
+ s.append(' ');
+ s.append(_prefix);
+ s.append("warning: ");
+ s.append(message);
+ System.err.print(s.toString() + _lineSeparator);
}
public void
error(String message)
{
- StringBuffer s = new StringBuffer();
- s.append(_date.format(new java.util.Date()));
- s.append(_time.format(new java.util.Date()));
- s.append(' ');
- s.append(_prefix);
- s.append("error: ");
- s.append(message);
- System.err.print(s.toString() + _lineSeparator);
+ StringBuffer s = new StringBuffer();
+ s.append(_date.format(new java.util.Date()));
+ s.append(_time.format(new java.util.Date()));
+ s.append(' ');
+ s.append(_prefix);
+ s.append("error: ");
+ s.append(message);
+ System.err.print(s.toString() + _lineSeparator);
}
String _prefix = "";
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java
index cd27becdc41..ff33df2bf13 100644
--- a/java/src/Ice/ObjectAdapterI.java
+++ b/java/src/Ice/ObjectAdapterI.java
@@ -14,124 +14,124 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public String
getName()
{
- //
+ //
// No mutex lock necessary, _name is immutable.
- //
+ //
return _noConfig ? "" : _name;
}
public synchronized Communicator
getCommunicator()
{
- checkForDeactivation();
-
- return _communicator;
+ checkForDeactivation();
+
+ return _communicator;
}
public void
activate()
{
- IceInternal.LocatorInfo locatorInfo = null;
+ IceInternal.LocatorInfo locatorInfo = null;
boolean registerProcess = false;
- boolean printAdapterReady = false;
-
- synchronized(this)
- {
- checkForDeactivation();
-
- //
- // If the one off initializations of the adapter are already
- // done, we just need to activate the incoming connection
- // factories and we're done.
- //
- if(_activateOneOffDone)
- {
- final int sz = _incomingConnectionFactories.size();
- for(int i = 0; i < sz; ++i)
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
- factory.activate();
- }
- return;
- }
-
- //
- // One off initializations of the adapter: update the
- // locator registry and print the "adapter ready"
- // message. We set the _waitForActivate flag to prevent
- // deactivation from other threads while these one off
- // initializations are done.
- //
- _waitForActivate = true;
-
- locatorInfo = _locatorInfo;
- if(!_noConfig)
- {
- final Properties properties = _instance.initializationData().properties;
- //
- // DEPRECATED PROPERTY: Remove extra code in future release.
- //
- registerProcess = properties.getPropertyAsIntWithDefault(_propertyPrefix + _name +".RegisterProcess",
- properties.getPropertyAsInt(_name +".RegisterProcess")) > 0;
- printAdapterReady = properties.getPropertyAsInt("Ice.PrintAdapterReady") > 0;
- }
- }
-
- try
- {
- Ice.Identity dummy = new Ice.Identity();
- dummy.name = "dummy";
- updateLocatorRegistry(locatorInfo, createDirectProxy(dummy), registerProcess);
- }
- catch(Ice.LocalException ex)
- {
- //
- // If we couldn't update the locator registry, we let the
- // exception go through and don't activate the adapter to
- // allow to user code to retry activating the adapter
- // later.
- //
- synchronized(this)
- {
- _waitForActivate = false;
- notifyAll();
- }
- throw ex;
- }
-
- if(printAdapterReady)
- {
- System.out.println(_name + " ready");
- }
-
- synchronized(this)
- {
- assert(!_deactivated); // Not possible if _waitForActivate = true;
-
- //
- // Signal threads waiting for the activation.
- //
- _waitForActivate = false;
- notifyAll();
-
- _activateOneOffDone = true;
-
- final int sz = _incomingConnectionFactories.size();
- for(int i = 0; i < sz; ++i)
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
- factory.activate();
- }
- }
+ boolean printAdapterReady = false;
+
+ synchronized(this)
+ {
+ checkForDeactivation();
+
+ //
+ // If the one off initializations of the adapter are already
+ // done, we just need to activate the incoming connection
+ // factories and we're done.
+ //
+ if(_activateOneOffDone)
+ {
+ final int sz = _incomingConnectionFactories.size();
+ for(int i = 0; i < sz; ++i)
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
+ factory.activate();
+ }
+ return;
+ }
+
+ //
+ // One off initializations of the adapter: update the
+ // locator registry and print the "adapter ready"
+ // message. We set the _waitForActivate flag to prevent
+ // deactivation from other threads while these one off
+ // initializations are done.
+ //
+ _waitForActivate = true;
+
+ locatorInfo = _locatorInfo;
+ if(!_noConfig)
+ {
+ final Properties properties = _instance.initializationData().properties;
+ //
+ // DEPRECATED PROPERTY: Remove extra code in future release.
+ //
+ registerProcess = properties.getPropertyAsIntWithDefault(_propertyPrefix + _name +".RegisterProcess",
+ properties.getPropertyAsInt(_name +".RegisterProcess")) > 0;
+ printAdapterReady = properties.getPropertyAsInt("Ice.PrintAdapterReady") > 0;
+ }
+ }
+
+ try
+ {
+ Ice.Identity dummy = new Ice.Identity();
+ dummy.name = "dummy";
+ updateLocatorRegistry(locatorInfo, createDirectProxy(dummy), registerProcess);
+ }
+ catch(Ice.LocalException ex)
+ {
+ //
+ // If we couldn't update the locator registry, we let the
+ // exception go through and don't activate the adapter to
+ // allow to user code to retry activating the adapter
+ // later.
+ //
+ synchronized(this)
+ {
+ _waitForActivate = false;
+ notifyAll();
+ }
+ throw ex;
+ }
+
+ if(printAdapterReady)
+ {
+ System.out.println(_name + " ready");
+ }
+
+ synchronized(this)
+ {
+ assert(!_deactivated); // Not possible if _waitForActivate = true;
+
+ //
+ // Signal threads waiting for the activation.
+ //
+ _waitForActivate = false;
+ notifyAll();
+
+ _activateOneOffDone = true;
+
+ final int sz = _incomingConnectionFactories.size();
+ for(int i = 0; i < sz; ++i)
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
+ factory.activate();
+ }
+ }
}
public synchronized void
hold()
{
- checkForDeactivation();
-
+ checkForDeactivation();
+
final int sz = _incomingConnectionFactories.size();
for(int i = 0; i < sz; ++i)
{
@@ -144,52 +144,52 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized void
waitForHold()
{
- checkForDeactivation();
-
- final int sz = _incomingConnectionFactories.size();
- for(int i = 0; i < sz; ++i)
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
- factory.waitUntilHolding();
- }
+ checkForDeactivation();
+
+ final int sz = _incomingConnectionFactories.size();
+ for(int i = 0; i < sz; ++i)
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
+ factory.waitUntilHolding();
+ }
}
public void
deactivate()
{
- IceInternal.OutgoingConnectionFactory outgoingConnectionFactory;
- java.util.ArrayList incomingConnectionFactories;
- IceInternal.LocatorInfo locatorInfo;
- synchronized(this)
- {
- //
- // Ignore deactivation requests if the object adapter has
- // already been deactivated.
- //
- if(_deactivated)
- {
- return;
- }
-
- //
- //
- // Wait for activation to complete. This is necessary to not
- // get out of order locator updates.
- //
- while(_waitForActivate)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- if(_routerInfo != null)
- {
+ IceInternal.OutgoingConnectionFactory outgoingConnectionFactory;
+ java.util.ArrayList incomingConnectionFactories;
+ IceInternal.LocatorInfo locatorInfo;
+ synchronized(this)
+ {
+ //
+ // Ignore deactivation requests if the object adapter has
+ // already been deactivated.
+ //
+ if(_deactivated)
+ {
+ return;
+ }
+
+ //
+ //
+ // Wait for activation to complete. This is necessary to not
+ // get out of order locator updates.
+ //
+ while(_waitForActivate)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(_routerInfo != null)
+ {
//
// Remove entry from the router manager.
//
@@ -199,48 +199,48 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
// Clear this object adapter with the router.
//
_routerInfo.setAdapter(null);
- }
-
- incomingConnectionFactories = new java.util.ArrayList(_incomingConnectionFactories);
- outgoingConnectionFactory = _instance.outgoingConnectionFactory();
- locatorInfo = _locatorInfo;
-
- _deactivated = true;
-
- notifyAll();
- }
-
- try
- {
- updateLocatorRegistry(locatorInfo, null, false);
- }
- catch(Ice.LocalException ex)
- {
- //
- // We can't throw exceptions in deactivate so we ignore
- // failures to update the locator registry.
- //
- }
-
- //
- // Must be called outside the thread synchronization, because
- // Connection::destroy() might block when sending a CloseConnection
- // message.
- //
- final int sz = incomingConnectionFactories.size();
- for(int i = 0; i < sz; ++i)
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)incomingConnectionFactories.get(i);
- factory.destroy();
- }
-
- //
- // Must be called outside the thread synchronization, because
- // changing the object adapter might block if there are still
- // requests being dispatched.
- //
- outgoingConnectionFactory.removeAdapter(this);
+ }
+
+ incomingConnectionFactories = new java.util.ArrayList(_incomingConnectionFactories);
+ outgoingConnectionFactory = _instance.outgoingConnectionFactory();
+ locatorInfo = _locatorInfo;
+
+ _deactivated = true;
+
+ notifyAll();
+ }
+
+ try
+ {
+ updateLocatorRegistry(locatorInfo, null, false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ //
+ // We can't throw exceptions in deactivate so we ignore
+ // failures to update the locator registry.
+ //
+ }
+
+ //
+ // Must be called outside the thread synchronization, because
+ // Connection::destroy() might block when sending a CloseConnection
+ // message.
+ //
+ final int sz = incomingConnectionFactories.size();
+ for(int i = 0; i < sz; ++i)
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)incomingConnectionFactories.get(i);
+ factory.destroy();
+ }
+
+ //
+ // Must be called outside the thread synchronization, because
+ // changing the object adapter might block if there are still
+ // requests being dispatched.
+ //
+ outgoingConnectionFactory.removeAdapter(this);
}
public void
@@ -248,42 +248,42 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
{
IceInternal.IncomingConnectionFactory[] incomingConnectionFactories;
- synchronized(this)
- {
- if(_destroyed)
- {
- return;
- }
-
- //
- // Wait for deactivation of the adapter itself, and
- // for the return of all direct method calls using this
- // adapter.
- //
- while(!_deactivated || _directCount > 0)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- incomingConnectionFactories =
- (IceInternal.IncomingConnectionFactory[])_incomingConnectionFactories.toArray(
- new IceInternal.IncomingConnectionFactory[0]);
- }
-
- //
- // Now we wait for until all incoming connection factories are
- // finished.
- //
- for(int i = 0; i < incomingConnectionFactories.length; ++i)
- {
- incomingConnectionFactories[i].waitUntilFinished();
- }
+ synchronized(this)
+ {
+ if(_destroyed)
+ {
+ return;
+ }
+
+ //
+ // Wait for deactivation of the adapter itself, and
+ // for the return of all direct method calls using this
+ // adapter.
+ //
+ while(!_deactivated || _directCount > 0)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ incomingConnectionFactories =
+ (IceInternal.IncomingConnectionFactory[])_incomingConnectionFactories.toArray(
+ new IceInternal.IncomingConnectionFactory[0]);
+ }
+
+ //
+ // Now we wait for until all incoming connection factories are
+ // finished.
+ //
+ for(int i = 0; i < incomingConnectionFactories.length; ++i)
+ {
+ incomingConnectionFactories[i].waitUntilFinished();
+ }
}
public synchronized boolean
@@ -296,93 +296,93 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
destroy()
{
synchronized(this)
- {
- //
- // Another thread is in the process of destroying the object
- // adapter. Wait for it to finish.
- //
- while(_destroying)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- //
- // Object adpater is already destroyed.
- //
- if(_destroyed)
- {
- return;
- }
-
- _destroying = true;
- }
-
- //
- // Deactivate and wait for completion.
- //
- deactivate();
- waitForDeactivate();
-
- //
- // Now it's also time to clean up our servants and servant
- // locators.
- //
- _servantManager.destroy();
-
- //
- // Destroy the thread pool.
- //
- if(_threadPool != null)
- {
- _threadPool.destroy();
- _threadPool.joinWithAllThreads();
- }
-
- IceInternal.ObjectAdapterFactory objectAdapterFactory;
-
- synchronized(this)
- {
- //
- // Signal that destroying is complete.
- //
- _destroying = false;
- _destroyed = true;
- notifyAll();
-
- //
- // We're done, now we can throw away all incoming connection
- // factories.
- //
- // For compatibility with C#, we set _incomingConnectionFactories
- // to null so that the finalizer does not invoke methods on objects.
- //
- _incomingConnectionFactories = null;
-
- //
- // Remove object references (some of them cyclic).
- //
- _instance = null;
- _threadPool = null;
- _communicator = null;
- _routerEndpoints = null;
- _routerInfo = null;
- _publishedEndpoints = null;
- _locatorInfo = null;
-
- objectAdapterFactory = _objectAdapterFactory;
- _objectAdapterFactory = null;
- }
-
- if(objectAdapterFactory != null)
- {
- objectAdapterFactory.removeObjectAdapter(_name);
- }
+ {
+ //
+ // Another thread is in the process of destroying the object
+ // adapter. Wait for it to finish.
+ //
+ while(_destroying)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ //
+ // Object adpater is already destroyed.
+ //
+ if(_destroyed)
+ {
+ return;
+ }
+
+ _destroying = true;
+ }
+
+ //
+ // Deactivate and wait for completion.
+ //
+ deactivate();
+ waitForDeactivate();
+
+ //
+ // Now it's also time to clean up our servants and servant
+ // locators.
+ //
+ _servantManager.destroy();
+
+ //
+ // Destroy the thread pool.
+ //
+ if(_threadPool != null)
+ {
+ _threadPool.destroy();
+ _threadPool.joinWithAllThreads();
+ }
+
+ IceInternal.ObjectAdapterFactory objectAdapterFactory;
+
+ synchronized(this)
+ {
+ //
+ // Signal that destroying is complete.
+ //
+ _destroying = false;
+ _destroyed = true;
+ notifyAll();
+
+ //
+ // We're done, now we can throw away all incoming connection
+ // factories.
+ //
+ // For compatibility with C#, we set _incomingConnectionFactories
+ // to null so that the finalizer does not invoke methods on objects.
+ //
+ _incomingConnectionFactories = null;
+
+ //
+ // Remove object references (some of them cyclic).
+ //
+ _instance = null;
+ _threadPool = null;
+ _communicator = null;
+ _routerEndpoints = null;
+ _routerInfo = null;
+ _publishedEndpoints = null;
+ _locatorInfo = null;
+
+ objectAdapterFactory = _objectAdapterFactory;
+ _objectAdapterFactory = null;
+ }
+
+ if(objectAdapterFactory != null)
+ {
+ objectAdapterFactory.removeObjectAdapter(_name);
+ }
}
public ObjectPrx
@@ -394,9 +394,9 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized ObjectPrx
addFacet(Ice.Object object, Identity ident, String facet)
{
- checkForDeactivation();
- checkIdentity(ident);
-
+ checkForDeactivation();
+ checkIdentity(ident);
+
//
// Create a copy of the Identity argument, in case the caller
// reuses it.
@@ -405,7 +405,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
id.category = ident.category;
id.name = ident.name;
- _servantManager.addServant(object, id, facet);
+ _servantManager.addServant(object, id, facet);
return newProxy(id, facet);
}
@@ -435,19 +435,19 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized Ice.Object
removeFacet(Identity ident, String facet)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
- return _servantManager.removeServant(ident, facet);
+ return _servantManager.removeServant(ident, facet);
}
public synchronized java.util.Map
removeAllFacets(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
- return _servantManager.removeAllFacets(ident);
+ return _servantManager.removeAllFacets(ident);
}
public Ice.Object
@@ -459,7 +459,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized Ice.Object
findFacet(Identity ident, String facet)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
return _servantManager.findServant(ident, facet);
@@ -468,7 +468,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized java.util.Map
findAllFacets(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
return _servantManager.findAllFacets(ident);
@@ -477,7 +477,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized Ice.Object
findByProxy(ObjectPrx proxy)
{
- checkForDeactivation();
+ checkForDeactivation();
IceInternal.Reference ref = ((ObjectPrxHelperBase)proxy).__reference();
return findFacet(ref.getIdentity(), ref.getFacet());
@@ -486,23 +486,23 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized void
addServantLocator(ServantLocator locator, String prefix)
{
- checkForDeactivation();
+ checkForDeactivation();
- _servantManager.addServantLocator(locator, prefix);
+ _servantManager.addServantLocator(locator, prefix);
}
public synchronized ServantLocator
findServantLocator(String prefix)
{
- checkForDeactivation();
+ checkForDeactivation();
- return _servantManager.findServantLocator(prefix);
+ return _servantManager.findServantLocator(prefix);
}
public synchronized ObjectPrx
createProxy(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
return newProxy(ident, "");
@@ -511,7 +511,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized ObjectPrx
createDirectProxy(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
return newDirectProxy(ident, "");
@@ -520,7 +520,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized ObjectPrx
createIndirectProxy(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
return newIndirectProxy(ident, "", _id);
@@ -529,7 +529,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized ObjectPrx
createReverseProxy(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
//
@@ -556,7 +556,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
ConnectionI[] arr = new ConnectionI[connections.size()];
connections.toArray(arr);
IceInternal.Reference ref =
- _instance.referenceFactory().create(ident, _instance.getDefaultContext(), "",
+ _instance.referenceFactory().create(ident, _instance.getDefaultContext(), "",
IceInternal.Reference.ModeTwoway, arr);
return _instance.proxyFactory().referenceToProxy(ref);
}
@@ -564,9 +564,9 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
public synchronized void
setLocator(LocatorPrx locator)
{
- checkForDeactivation();
+ checkForDeactivation();
- _locatorInfo = _instance.locatorManager().get(locator);
+ _locatorInfo = _instance.locatorManager().get(locator);
}
public boolean
@@ -575,148 +575,148 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
IceInternal.Reference ref = ((ObjectPrxHelperBase)proxy).__reference();
IceInternal.EndpointI[] endpoints;
- try
- {
- IceInternal.IndirectReference ir = (IceInternal.IndirectReference)ref;
- if(ir.getAdapterId().length() != 0)
- {
- //
- // Proxy is local if the reference adapter id matches this
- // adapter name.
- //
- return ir.getAdapterId().equals(_id);
- }
- IceInternal.LocatorInfo info = ir.getLocatorInfo();
- if(info != null)
- {
- endpoints = info.getEndpoints(ir, ir.getLocatorCacheTimeout(), new Ice.BooleanHolder());
- }
- else
- {
- return false;
- }
- }
- catch(ClassCastException e)
- {
- endpoints = ref.getEndpoints();
- }
-
-
- synchronized(this)
- {
- checkForDeactivation();
-
- //
- // Proxies which have at least one endpoint in common with the
- // endpoints used by this object adapter's incoming connection
- // factories are considered local.
- //
- for(int i = 0; i < endpoints.length; ++i)
- {
- final int sz = _incomingConnectionFactories.size();
- for(int j = 0; j < sz; j++)
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(j);
- if(factory.equivalent(endpoints[i]))
- {
- return true;
- }
- }
- }
-
- //
- // Proxies which have at least one endpoint in common with the
- // router's server proxy endpoints (if any), are also considered
- // local.
- //
- if(_routerInfo != null && _routerInfo.getRouter().equals(proxy.ice_getRouter()))
- {
- for(int i = 0; i < endpoints.length; ++i)
- {
- // _routerEndpoints is sorted.
- if(java.util.Collections.binarySearch(_routerEndpoints, endpoints[i]) >= 0)
- {
- return true;
- }
- }
- }
-
- return false;
- }
+ try
+ {
+ IceInternal.IndirectReference ir = (IceInternal.IndirectReference)ref;
+ if(ir.getAdapterId().length() != 0)
+ {
+ //
+ // Proxy is local if the reference adapter id matches this
+ // adapter name.
+ //
+ return ir.getAdapterId().equals(_id);
+ }
+ IceInternal.LocatorInfo info = ir.getLocatorInfo();
+ if(info != null)
+ {
+ endpoints = info.getEndpoints(ir, ir.getLocatorCacheTimeout(), new Ice.BooleanHolder());
+ }
+ else
+ {
+ return false;
+ }
+ }
+ catch(ClassCastException e)
+ {
+ endpoints = ref.getEndpoints();
+ }
+
+
+ synchronized(this)
+ {
+ checkForDeactivation();
+
+ //
+ // Proxies which have at least one endpoint in common with the
+ // endpoints used by this object adapter's incoming connection
+ // factories are considered local.
+ //
+ for(int i = 0; i < endpoints.length; ++i)
+ {
+ final int sz = _incomingConnectionFactories.size();
+ for(int j = 0; j < sz; j++)
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(j);
+ if(factory.equivalent(endpoints[i]))
+ {
+ return true;
+ }
+ }
+ }
+
+ //
+ // Proxies which have at least one endpoint in common with the
+ // router's server proxy endpoints (if any), are also considered
+ // local.
+ //
+ if(_routerInfo != null && _routerInfo.getRouter().equals(proxy.ice_getRouter()))
+ {
+ for(int i = 0; i < endpoints.length; ++i)
+ {
+ // _routerEndpoints is sorted.
+ if(java.util.Collections.binarySearch(_routerEndpoints, endpoints[i]) >= 0)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
}
public void
flushBatchRequests()
{
- java.util.ArrayList f;
- synchronized(this)
- {
- f = new java.util.ArrayList(_incomingConnectionFactories);
- }
- java.util.Iterator i = f.iterator();
- while(i.hasNext())
- {
- ((IceInternal.IncomingConnectionFactory)i.next()).flushBatchRequests();
- }
+ java.util.ArrayList f;
+ synchronized(this)
+ {
+ f = new java.util.ArrayList(_incomingConnectionFactories);
+ }
+ java.util.Iterator i = f.iterator();
+ while(i.hasNext())
+ {
+ ((IceInternal.IncomingConnectionFactory)i.next()).flushBatchRequests();
+ }
}
public synchronized void
incDirectCount()
{
- checkForDeactivation();
+ checkForDeactivation();
- assert(_directCount >= 0);
- ++_directCount;
+ assert(_directCount >= 0);
+ ++_directCount;
}
public synchronized void
decDirectCount()
{
- // Not check for deactivation here!
-
- assert(_instance != null); // Must not be called after destroy().
-
- assert(_directCount > 0);
- if(--_directCount == 0)
- {
- notifyAll();
- }
+ // Not check for deactivation here!
+
+ assert(_instance != null); // Must not be called after destroy().
+
+ assert(_directCount > 0);
+ if(--_directCount == 0)
+ {
+ notifyAll();
+ }
}
public IceInternal.ThreadPool
getThreadPool()
{
- // No mutex lock necessary, _threadPool and _instance are
- // immutable after creation until they are removed in
- // destroy().
-
- // Not check for deactivation here!
-
- assert(_instance != null); // Must not be called after destroy().
-
- if(_threadPool != null)
- {
- return _threadPool;
- }
- else
- {
- return _instance.serverThreadPool();
- }
+ // No mutex lock necessary, _threadPool and _instance are
+ // immutable after creation until they are removed in
+ // destroy().
+
+ // Not check for deactivation here!
+
+ assert(_instance != null); // Must not be called after destroy().
+
+ if(_threadPool != null)
+ {
+ return _threadPool;
+ }
+ else
+ {
+ return _instance.serverThreadPool();
+ }
}
public IceInternal.ServantManager
getServantManager()
- {
- //
- // No mutex lock necessary, _servantManager is immutable.
- //
- return _servantManager;
+ {
+ //
+ // No mutex lock necessary, _servantManager is immutable.
+ //
+ return _servantManager;
}
public boolean
getThreadPerConnection()
- {
+ {
//
// No mutex lock necessary, _threadPerConnection is immutable.
//
@@ -728,73 +728,73 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
//
public
ObjectAdapterI(IceInternal.Instance instance, Communicator communicator,
- IceInternal.ObjectAdapterFactory objectAdapterFactory, String name, String endpointInfo,
- RouterPrx router, boolean noConfig)
+ IceInternal.ObjectAdapterFactory objectAdapterFactory, String name, String endpointInfo,
+ RouterPrx router, boolean noConfig)
{
- _deactivated = false;
+ _deactivated = false;
_instance = instance;
- _communicator = communicator;
- _objectAdapterFactory = objectAdapterFactory;
- _servantManager = new IceInternal.ServantManager(instance, name);
- _activateOneOffDone = false;
+ _communicator = communicator;
+ _objectAdapterFactory = objectAdapterFactory;
+ _servantManager = new IceInternal.ServantManager(instance, name);
+ _activateOneOffDone = false;
_name = name;
- _directCount = 0;
- _waitForActivate = false;
- _destroying = false;
- _destroyed = false;
- _noConfig = noConfig;
-
- if(_noConfig)
- {
- _id = "";
- _replicaGroupId = "";
- return;
- }
-
- //
- // DEPRECATED PROPERTIES: Remove extra code in future release.
- //
-
- //
- // Make sure named adapter has some configuration.
- //
- final Properties properties = _instance.initializationData().properties;
- String[] oldProps = filterProperties(_name + ".");
- if(endpointInfo.length() == 0 && router == null)
- {
- String[] props = filterProperties(_propertyPrefix + _name + ".");
- if(props.length == 0 && oldProps.length == 0)
- {
- //
- // These need to be set to prevent finalizer from complaining.
- //
- _deactivated = true;
- _destroyed = true;
- _instance = null;
- _communicator = null;
- _incomingConnectionFactories = null;
-
- InitializationException ex = new InitializationException();
- ex.reason = "object adapter \"" + _name + "\" requires configuration.";
- throw ex;
- }
- }
-
- if(oldProps.length != 0)
- {
- String message = "The following properties have been deprecated, please prepend \"Ice.OA.\":";
- for(int i = 0; i < oldProps.length; ++i)
- {
- message += "\n " + oldProps[i];
- }
- _instance.initializationData().logger.warning(message);
- }
-
- _id = properties.getPropertyWithDefault(_propertyPrefix + _name + ".AdapterId",
- properties.getProperty(_name + ".AdapterId"));
- _replicaGroupId = properties.getPropertyWithDefault(_propertyPrefix + _name + ".ReplicaGroupId",
- properties.getProperty(_name + ".ReplicaGroupId"));
-
+ _directCount = 0;
+ _waitForActivate = false;
+ _destroying = false;
+ _destroyed = false;
+ _noConfig = noConfig;
+
+ if(_noConfig)
+ {
+ _id = "";
+ _replicaGroupId = "";
+ return;
+ }
+
+ //
+ // DEPRECATED PROPERTIES: Remove extra code in future release.
+ //
+
+ //
+ // Make sure named adapter has some configuration.
+ //
+ final Properties properties = _instance.initializationData().properties;
+ String[] oldProps = filterProperties(_name + ".");
+ if(endpointInfo.length() == 0 && router == null)
+ {
+ String[] props = filterProperties(_propertyPrefix + _name + ".");
+ if(props.length == 0 && oldProps.length == 0)
+ {
+ //
+ // These need to be set to prevent finalizer from complaining.
+ //
+ _deactivated = true;
+ _destroyed = true;
+ _instance = null;
+ _communicator = null;
+ _incomingConnectionFactories = null;
+
+ InitializationException ex = new InitializationException();
+ ex.reason = "object adapter \"" + _name + "\" requires configuration.";
+ throw ex;
+ }
+ }
+
+ if(oldProps.length != 0)
+ {
+ String message = "The following properties have been deprecated, please prepend \"Ice.OA.\":";
+ for(int i = 0; i < oldProps.length; ++i)
+ {
+ message += "\n " + oldProps[i];
+ }
+ _instance.initializationData().logger.warning(message);
+ }
+
+ _id = properties.getPropertyWithDefault(_propertyPrefix + _name + ".AdapterId",
+ properties.getProperty(_name + ".AdapterId"));
+ _replicaGroupId = properties.getPropertyWithDefault(_propertyPrefix + _name + ".ReplicaGroupId",
+ properties.getProperty(_name + ".ReplicaGroupId"));
+
try
{
_threadPerConnection = properties.getPropertyAsInt(_propertyPrefix + _name + ".ThreadPerConnection") > 0;
@@ -836,29 +836,29 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
}
}
- if(router == null)
- {
- router = RouterPrxHelper.uncheckedCast(
- _instance.proxyFactory().propertyToProxy(_propertyPrefix + name + ".Router"));
- if(router == null)
- {
- router = RouterPrxHelper.uncheckedCast(
- _instance.proxyFactory().propertyToProxy(name + ".Router"));
- }
- }
- if(router != null)
- {
+ if(router == null)
+ {
+ router = RouterPrxHelper.uncheckedCast(
+ _instance.proxyFactory().propertyToProxy(_propertyPrefix + name + ".Router"));
+ if(router == null)
+ {
+ router = RouterPrxHelper.uncheckedCast(
+ _instance.proxyFactory().propertyToProxy(name + ".Router"));
+ }
+ }
+ if(router != null)
+ {
_routerInfo = _instance.routerManager().get(router);
if(_routerInfo != null)
{
- //
- // Make sure this router is not already registered with another adapter.
- //
- if(_routerInfo.getAdapter() != null)
- {
- throw new AlreadyRegisteredException("object adapter with router",
- _instance.identityToString(router.ice_getIdentity()));
- }
+ //
+ // Make sure this router is not already registered with another adapter.
+ //
+ if(_routerInfo.getAdapter() != null)
+ {
+ throw new AlreadyRegisteredException("object adapter with router",
+ _instance.identityToString(router.ice_getIdentity()));
+ }
//
// Add the router's server proxy endpoints to this object
@@ -871,23 +871,23 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
}
java.util.Collections.sort(_routerEndpoints); // Must be sorted.
- //
- // Remove duplicate endpoints, so we have a list of unique
- // endpoints.
- //
- for(int i = 0; i < _routerEndpoints.size()-1;)
- {
+ //
+ // Remove duplicate endpoints, so we have a list of unique
+ // endpoints.
+ //
+ for(int i = 0; i < _routerEndpoints.size()-1;)
+ {
java.lang.Object o1 = _routerEndpoints.get(i);
java.lang.Object o2 = _routerEndpoints.get(i + 1);
if(o1.equals(o2))
{
_routerEndpoints.remove(i);
}
- else
- {
- ++i;
- }
- }
+ else
+ {
+ ++i;
+ }
+ }
//
// Associate this object adapter with the router. This way,
@@ -903,27 +903,27 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
//
_instance.outgoingConnectionFactory().setRouterInfo(_routerInfo);
}
- }
- else
- {
- //
- // Parse the endpoints, but don't store them in the adapter.
- // The connection factory might change it, for example, to
- // fill in the real port number.
- //
- java.util.ArrayList endpoints;
- if(endpointInfo.length() == 0)
- {
- endpoints = parseEndpoints(properties.getPropertyWithDefault(_propertyPrefix + _name + ".Endpoints",
- properties.getProperty(_name + ".Endpoints")));
- }
- else
- {
- endpoints = parseEndpoints(endpointInfo);
- }
- for(int i = 0; i < endpoints.size(); ++i)
- {
- IceInternal.EndpointI endp = (IceInternal.EndpointI)endpoints.get(i);
+ }
+ else
+ {
+ //
+ // Parse the endpoints, but don't store them in the adapter.
+ // The connection factory might change it, for example, to
+ // fill in the real port number.
+ //
+ java.util.ArrayList endpoints;
+ if(endpointInfo.length() == 0)
+ {
+ endpoints = parseEndpoints(properties.getPropertyWithDefault(_propertyPrefix + _name + ".Endpoints",
+ properties.getProperty(_name + ".Endpoints")));
+ }
+ else
+ {
+ endpoints = parseEndpoints(endpointInfo);
+ }
+ for(int i = 0; i < endpoints.size(); ++i)
+ {
+ IceInternal.EndpointI endp = (IceInternal.EndpointI)endpoints.get(i);
//
// TODO: Remove when we no longer support SSL for JDK 1.4.
//
@@ -936,65 +936,65 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
_incomingConnectionFactories.add(
new IceInternal.IncomingConnectionFactory(instance, endp, this, _name));
}
- if(endpoints.size() == 0)
- {
- IceInternal.TraceLevels tl = _instance.traceLevels();
- if(tl.network >= 2)
- {
- _instance.initializationData().logger.trace(tl.networkCat,
- "created adapter `" + name + "' without endpoints");
- }
- }
-
- //
- // Parse published endpoints. If set, these are used in proxies
- // instead of the connection factory Endpoints.
- //
- String endpts = properties.getPropertyWithDefault(_propertyPrefix + _name + ".PublishedEndpoints",
- properties.getProperty(_name + ".PublishedEndpoints"));
- _publishedEndpoints = parseEndpoints(endpts);
- if(_publishedEndpoints.size() == 0)
- {
- for(int i = 0; i < _incomingConnectionFactories.size(); ++i)
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
- _publishedEndpoints.add(factory.endpoint());
- }
- }
-
- //
- // Filter out any endpoints that are not meant to be published.
- //
- java.util.Iterator p = _publishedEndpoints.iterator();
- while(p.hasNext())
- {
- IceInternal.EndpointI endpoint = (IceInternal.EndpointI)p.next();
- if(!endpoint.publish())
- {
- p.remove();
- }
- }
- }
-
- String locatorProperty = _propertyPrefix + _name + ".Locator";
- if(properties.getProperty(locatorProperty).length() > 0)
- {
- setLocator(LocatorPrxHelper.uncheckedCast(_instance.proxyFactory().propertyToProxy(locatorProperty)));
- }
- else if(properties.getProperty(_name + ".Locator").length() > 0)
- {
- setLocator(LocatorPrxHelper.uncheckedCast(
- _instance.proxyFactory().propertyToProxy(_name + ".Locator")));
- }
- else
- {
- setLocator(_instance.referenceFactory().getDefaultLocator());
- }
+ if(endpoints.size() == 0)
+ {
+ IceInternal.TraceLevels tl = _instance.traceLevels();
+ if(tl.network >= 2)
+ {
+ _instance.initializationData().logger.trace(tl.networkCat,
+ "created adapter `" + name + "' without endpoints");
+ }
+ }
+
+ //
+ // Parse published endpoints. If set, these are used in proxies
+ // instead of the connection factory Endpoints.
+ //
+ String endpts = properties.getPropertyWithDefault(_propertyPrefix + _name + ".PublishedEndpoints",
+ properties.getProperty(_name + ".PublishedEndpoints"));
+ _publishedEndpoints = parseEndpoints(endpts);
+ if(_publishedEndpoints.size() == 0)
+ {
+ for(int i = 0; i < _incomingConnectionFactories.size(); ++i)
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
+ _publishedEndpoints.add(factory.endpoint());
+ }
+ }
+
+ //
+ // Filter out any endpoints that are not meant to be published.
+ //
+ java.util.Iterator p = _publishedEndpoints.iterator();
+ while(p.hasNext())
+ {
+ IceInternal.EndpointI endpoint = (IceInternal.EndpointI)p.next();
+ if(!endpoint.publish())
+ {
+ p.remove();
+ }
+ }
+ }
+
+ String locatorProperty = _propertyPrefix + _name + ".Locator";
+ if(properties.getProperty(locatorProperty).length() > 0)
+ {
+ setLocator(LocatorPrxHelper.uncheckedCast(_instance.proxyFactory().propertyToProxy(locatorProperty)));
+ }
+ else if(properties.getProperty(_name + ".Locator").length() > 0)
+ {
+ setLocator(LocatorPrxHelper.uncheckedCast(
+ _instance.proxyFactory().propertyToProxy(_name + ".Locator")));
+ }
+ else
+ {
+ setLocator(_instance.referenceFactory().getDefaultLocator());
+ }
}
catch(LocalException ex)
{
- destroy();
+ destroy();
throw ex;
}
}
@@ -1006,21 +1006,21 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
if(!_deactivated)
{
_instance.initializationData().logger.warning("object adapter `" + getName() +
- "' has not been deactivated");
+ "' has not been deactivated");
}
else if(!_destroyed)
{
_instance.initializationData().logger.warning("object adapter `" + getName() + "' has not been destroyed");
}
- else
- {
- IceUtil.Assert.FinalizerAssert(_threadPool == null);
- //IceUtil.Assert.FinalizerAssert(_servantManager == null); // Not cleared, it needs to be immutable.
- IceUtil.Assert.FinalizerAssert(_communicator == null);
- IceUtil.Assert.FinalizerAssert(_incomingConnectionFactories == null);
- IceUtil.Assert.FinalizerAssert(_directCount == 0);
- IceUtil.Assert.FinalizerAssert(!_waitForActivate);
- }
+ else
+ {
+ IceUtil.Assert.FinalizerAssert(_threadPool == null);
+ //IceUtil.Assert.FinalizerAssert(_servantManager == null); // Not cleared, it needs to be immutable.
+ IceUtil.Assert.FinalizerAssert(_communicator == null);
+ IceUtil.Assert.FinalizerAssert(_incomingConnectionFactories == null);
+ IceUtil.Assert.FinalizerAssert(_directCount == 0);
+ IceUtil.Assert.FinalizerAssert(!_waitForActivate);
+ }
super.finalize();
}
@@ -1028,18 +1028,18 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
private ObjectPrx
newProxy(Identity ident, String facet)
{
- if(_id.length() == 0)
- {
- return newDirectProxy(ident, facet);
- }
- else if(_replicaGroupId.length() == 0)
- {
- return newIndirectProxy(ident, facet, _id);
- }
- else
- {
- return newIndirectProxy(ident, facet, _replicaGroupId);
- }
+ if(_id.length() == 0)
+ {
+ return newDirectProxy(ident, facet);
+ }
+ else if(_replicaGroupId.length() == 0)
+ {
+ return newIndirectProxy(ident, facet, _id);
+ }
+ else
+ {
+ return newIndirectProxy(ident, facet, _replicaGroupId);
+ }
}
private ObjectPrx
@@ -1047,9 +1047,9 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
{
IceInternal.EndpointI[] endpoints;
- int sz = _publishedEndpoints.size();
- endpoints = new IceInternal.EndpointI[sz + _routerEndpoints.size()];
- _publishedEndpoints.toArray(endpoints);
+ int sz = _publishedEndpoints.size();
+ endpoints = new IceInternal.EndpointI[sz + _routerEndpoints.size()];
+ _publishedEndpoints.toArray(endpoints);
//
// Now we also add the endpoints of the router's server proxy, if
@@ -1058,7 +1058,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
//
for(int i = 0; i < _routerEndpoints.size(); ++i)
{
- endpoints[sz + i] = (IceInternal.EndpointI)_routerEndpoints.get(i);
+ endpoints[sz + i] = (IceInternal.EndpointI)_routerEndpoints.get(i);
}
//
@@ -1066,11 +1066,11 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
//
ConnectionI[] connections = new ConnectionI[0];
IceInternal.Reference reference =
- _instance.referenceFactory().create(ident, new java.util.HashMap(), facet,
- IceInternal.Reference.ModeTwoway, false,
- _instance.defaultsAndOverrides().defaultPreferSecure, endpoints, null,
- _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
- _instance.defaultsAndOverrides().defaultEndpointSelection,
+ _instance.referenceFactory().create(ident, new java.util.HashMap(), facet,
+ IceInternal.Reference.ModeTwoway, false,
+ _instance.defaultsAndOverrides().defaultPreferSecure, endpoints, null,
+ _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
+ _instance.defaultsAndOverrides().defaultEndpointSelection,
_instance.threadPerConnection());
return _instance.proxyFactory().referenceToProxy(reference);
}
@@ -1078,33 +1078,33 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
private ObjectPrx
newIndirectProxy(Identity ident, String facet, String id)
{
- //
- // Create a reference with the adapter id and return a proxy
- // for the reference.
- //
- IceInternal.EndpointI[] endpoints = new IceInternal.EndpointI[0];
- ConnectionI[] connections = new ConnectionI[0];
- IceInternal.Reference reference =
- _instance.referenceFactory().create(ident, new java.util.HashMap(), facet,
- IceInternal.Reference.ModeTwoway, false,
- _instance.defaultsAndOverrides().defaultPreferSecure, id, null,
- _locatorInfo,
- _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
- _instance.defaultsAndOverrides().defaultEndpointSelection,
+ //
+ // Create a reference with the adapter id and return a proxy
+ // for the reference.
+ //
+ IceInternal.EndpointI[] endpoints = new IceInternal.EndpointI[0];
+ ConnectionI[] connections = new ConnectionI[0];
+ IceInternal.Reference reference =
+ _instance.referenceFactory().create(ident, new java.util.HashMap(), facet,
+ IceInternal.Reference.ModeTwoway, false,
+ _instance.defaultsAndOverrides().defaultPreferSecure, id, null,
+ _locatorInfo,
+ _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
+ _instance.defaultsAndOverrides().defaultEndpointSelection,
_instance.threadPerConnection(),
- _instance.defaultsAndOverrides().defaultLocatorCacheTimeout);
- return _instance.proxyFactory().referenceToProxy(reference);
+ _instance.defaultsAndOverrides().defaultLocatorCacheTimeout);
+ return _instance.proxyFactory().referenceToProxy(reference);
}
private void
checkForDeactivation()
{
- if(_deactivated)
- {
+ if(_deactivated)
+ {
ObjectAdapterDeactivatedException ex = new ObjectAdapterDeactivatedException();
- ex.name = getName();
- throw ex;
- }
+ ex.name = getName();
+ throw ex;
+ }
}
private static void
@@ -1113,7 +1113,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
if(ident.name == null || ident.name.length() == 0)
{
IllegalIdentityException e = new IllegalIdentityException();
- e.id = (Identity)ident.clone();
+ e.id = (Identity)ident.clone();
throw e;
}
@@ -1128,144 +1128,144 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
{
endpts = endpts.toLowerCase();
- int beg;
- int end = 0;
-
- final String delim = " \t\n\r";
-
- java.util.ArrayList endpoints = new java.util.ArrayList();
- while(end < endpts.length())
- {
- beg = IceUtil.StringUtil.findFirstNotOf(endpts, delim, end);
- if(beg == -1)
- {
- break;
- }
-
- end = endpts.indexOf(':', beg);
- if(end == -1)
- {
- end = endpts.length();
- }
-
- if(end == beg)
- {
- ++end;
- continue;
- }
-
- String s = endpts.substring(beg, end);
- IceInternal.EndpointI endp = _instance.endpointFactoryManager().create(s);
- if(endp == null)
- {
- Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = s;
- throw e;
- }
- java.util.ArrayList endps = endp.expand(true);
- endpoints.addAll(endps);
-
- ++end;
- }
-
- return endpoints;
+ int beg;
+ int end = 0;
+
+ final String delim = " \t\n\r";
+
+ java.util.ArrayList endpoints = new java.util.ArrayList();
+ while(end < endpts.length())
+ {
+ beg = IceUtil.StringUtil.findFirstNotOf(endpts, delim, end);
+ if(beg == -1)
+ {
+ break;
+ }
+
+ end = endpts.indexOf(':', beg);
+ if(end == -1)
+ {
+ end = endpts.length();
+ }
+
+ if(end == beg)
+ {
+ ++end;
+ continue;
+ }
+
+ String s = endpts.substring(beg, end);
+ IceInternal.EndpointI endp = _instance.endpointFactoryManager().create(s);
+ if(endp == null)
+ {
+ Ice.EndpointParseException e = new Ice.EndpointParseException();
+ e.str = s;
+ throw e;
+ }
+ java.util.ArrayList endps = endp.expand(true);
+ endpoints.addAll(endps);
+
+ ++end;
+ }
+
+ return endpoints;
}
private void
updateLocatorRegistry(IceInternal.LocatorInfo locatorInfo, Ice.ObjectPrx proxy, boolean registerProcess)
{
- if(!registerProcess && _id.length() == 0)
- {
- return; // Nothing to update.
- }
-
- //
- // We must get and call on the locator registry outside the
- // thread synchronization to avoid deadlocks. (we can't make
- // remote calls within the OA synchronization because the
- // remote call will indirectly call isLocal() on this OA with
- // the OA factory locked).
- //
- // TODO: This might throw if we can't connect to the
- // locator. Shall we raise a special exception for the
- // activate operation instead of a non obvious network
- // exception?
- //
- LocatorRegistryPrx locatorRegistry = locatorInfo != null ? locatorInfo.getLocatorRegistry() : null;
- String serverId = "";
- if(registerProcess)
- {
- assert(_instance != null);
- serverId = _instance.initializationData().properties.getProperty("Ice.ServerId");
-
- if(locatorRegistry == null)
- {
- _instance.initializationData().logger.warning(
- "object adapter `" + getName() + "' cannot register the process without a locator registry");
- }
- else if(serverId.length() == 0)
- {
- _instance.initializationData().logger.warning(
- "object adapter `" + getName() + "' cannot register the process without a value for Ice.ServerId");
- }
- }
-
- if(locatorRegistry == null)
- {
- return;
- }
-
- if(_id.length() > 0)
- {
- try
- {
- if(_replicaGroupId.length() == 0)
- {
- locatorRegistry.setAdapterDirectProxy(_id, proxy);
- }
- else
- {
- locatorRegistry.setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
- }
- }
- catch(AdapterNotFoundException ex)
- {
- NotRegisteredException ex1 = new NotRegisteredException();
- ex1.kindOfObject = "object adapter";
- ex1.id = _id;
- throw ex1;
- }
- catch(InvalidReplicaGroupIdException ex)
- {
- NotRegisteredException ex1 = new NotRegisteredException();
- ex1.kindOfObject = "replica group";
- ex1.id = _replicaGroupId;
- throw ex1;
- }
- catch(AdapterAlreadyActiveException ex)
- {
- ObjectAdapterIdInUseException ex1 = new ObjectAdapterIdInUseException();
- ex1.id = _id;
- throw ex1;
- }
- }
-
- if(registerProcess && serverId.length() > 0)
- {
- try
- {
- Process servant = new ProcessI(_communicator);
- Ice.ObjectPrx process = createDirectProxy(addWithUUID(servant).ice_getIdentity());
- locatorRegistry.setServerProcessProxy(serverId, ProcessPrxHelper.uncheckedCast(process));
- }
- catch(ServerNotFoundException ex)
- {
- NotRegisteredException ex1 = new NotRegisteredException();
- ex1.id = serverId;
- ex1.kindOfObject = "server";
- throw ex1;
- }
- }
+ if(!registerProcess && _id.length() == 0)
+ {
+ return; // Nothing to update.
+ }
+
+ //
+ // We must get and call on the locator registry outside the
+ // thread synchronization to avoid deadlocks. (we can't make
+ // remote calls within the OA synchronization because the
+ // remote call will indirectly call isLocal() on this OA with
+ // the OA factory locked).
+ //
+ // TODO: This might throw if we can't connect to the
+ // locator. Shall we raise a special exception for the
+ // activate operation instead of a non obvious network
+ // exception?
+ //
+ LocatorRegistryPrx locatorRegistry = locatorInfo != null ? locatorInfo.getLocatorRegistry() : null;
+ String serverId = "";
+ if(registerProcess)
+ {
+ assert(_instance != null);
+ serverId = _instance.initializationData().properties.getProperty("Ice.ServerId");
+
+ if(locatorRegistry == null)
+ {
+ _instance.initializationData().logger.warning(
+ "object adapter `" + getName() + "' cannot register the process without a locator registry");
+ }
+ else if(serverId.length() == 0)
+ {
+ _instance.initializationData().logger.warning(
+ "object adapter `" + getName() + "' cannot register the process without a value for Ice.ServerId");
+ }
+ }
+
+ if(locatorRegistry == null)
+ {
+ return;
+ }
+
+ if(_id.length() > 0)
+ {
+ try
+ {
+ if(_replicaGroupId.length() == 0)
+ {
+ locatorRegistry.setAdapterDirectProxy(_id, proxy);
+ }
+ else
+ {
+ locatorRegistry.setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
+ }
+ }
+ catch(AdapterNotFoundException ex)
+ {
+ NotRegisteredException ex1 = new NotRegisteredException();
+ ex1.kindOfObject = "object adapter";
+ ex1.id = _id;
+ throw ex1;
+ }
+ catch(InvalidReplicaGroupIdException ex)
+ {
+ NotRegisteredException ex1 = new NotRegisteredException();
+ ex1.kindOfObject = "replica group";
+ ex1.id = _replicaGroupId;
+ throw ex1;
+ }
+ catch(AdapterAlreadyActiveException ex)
+ {
+ ObjectAdapterIdInUseException ex1 = new ObjectAdapterIdInUseException();
+ ex1.id = _id;
+ throw ex1;
+ }
+ }
+
+ if(registerProcess && serverId.length() > 0)
+ {
+ try
+ {
+ Process servant = new ProcessI(_communicator);
+ Ice.ObjectPrx process = createDirectProxy(addWithUUID(servant).ice_getIdentity());
+ locatorRegistry.setServerProcessProxy(serverId, ProcessPrxHelper.uncheckedCast(process));
+ }
+ catch(ServerNotFoundException ex)
+ {
+ NotRegisteredException ex1 = new NotRegisteredException();
+ ex1.id = serverId;
+ ex1.kindOfObject = "server";
+ throw ex1;
+ }
+ }
}
static private String[] _suffixes =
@@ -1287,16 +1287,16 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
filterProperties(String prefix)
{
java.util.ArrayList propertySet = new java.util.ArrayList();
- java.util.Map props = _instance.initializationData().properties.getPropertiesForPrefix(prefix);
- for(int i = 0; i < _suffixes.length; ++i)
- {
- if(props.containsKey(prefix + _suffixes[i]))
- {
- propertySet.add(prefix + _suffixes[i]);
- }
- }
-
- return (String[])propertySet.toArray(new String[0]);
+ java.util.Map props = _instance.initializationData().properties.getPropertiesForPrefix(prefix);
+ for(int i = 0; i < _suffixes.length; ++i)
+ {
+ if(props.containsKey(prefix + _suffixes[i]))
+ {
+ propertySet.add(prefix + _suffixes[i]);
+ }
+ }
+
+ return (String[])propertySet.toArray(new String[0]);
}
private static class ProcessI extends _ProcessDisp
@@ -1312,23 +1312,23 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
_communicator.shutdown();
}
- public void
- writeMessage(String message, int fd, Ice.Current current)
- {
- switch(fd)
- {
- case 1:
- {
- System.out.println(message);
- break;
- }
- case 2:
- {
- System.err.println(message);
- break;
- }
- }
- }
+ public void
+ writeMessage(String message, int fd, Ice.Current current)
+ {
+ switch(fd)
+ {
+ case 1:
+ {
+ System.out.println(message);
+ break;
+ }
+ case 2:
+ {
+ System.err.println(message);
+ break;
+ }
+ }
+ }
private Communicator _communicator;
}
diff --git a/java/src/Ice/ObjectHolder.java b/java/src/Ice/ObjectHolder.java
index 2adb0d1241b..a513feb1b41 100644
--- a/java/src/Ice/ObjectHolder.java
+++ b/java/src/Ice/ObjectHolder.java
@@ -24,23 +24,23 @@ public final class ObjectHolder
public class Patcher implements IceInternal.Patcher
{
- public void
- patch(Ice.Object v)
- {
- value = v;
- }
+ public void
+ patch(Ice.Object v)
+ {
+ value = v;
+ }
- public String
- type()
- {
- return Ice.ObjectImpl.ice_staticId();
- }
+ public String
+ type()
+ {
+ return Ice.ObjectImpl.ice_staticId();
+ }
}
public Patcher
getPatcher()
{
- return new Patcher();
+ return new Patcher();
}
public Ice.Object value;
diff --git a/java/src/Ice/ObjectImpl.java b/java/src/Ice/ObjectImpl.java
index 1aa56011977..a7db871c016 100644
--- a/java/src/Ice/ObjectImpl.java
+++ b/java/src/Ice/ObjectImpl.java
@@ -20,15 +20,15 @@ public abstract class ObjectImpl implements Object, java.lang.Cloneable
clone()
{
java.lang.Object o = null;
- try
- {
- o = super.clone();
- }
- catch(java.lang.CloneNotSupportedException ex)
- {
- assert false; // Impossible
- }
- return o;
+ try
+ {
+ o = super.clone();
+ }
+ catch(java.lang.CloneNotSupportedException ex)
+ {
+ assert false; // Impossible
+ }
+ return o;
}
public int
@@ -134,7 +134,7 @@ public abstract class ObjectImpl implements Object, java.lang.Cloneable
public int ice_operationAttributes(String operation)
{
- return 0;
+ return 0;
}
public void
@@ -249,44 +249,44 @@ public abstract class ObjectImpl implements Object, java.lang.Cloneable
private static String
operationModeToString(OperationMode mode)
{
- if(mode == Ice.OperationMode.Normal)
- {
- return "::Ice::Normal";
- }
- if(mode == Ice.OperationMode.Nonmutating)
- {
- return "::Ice::Nonmutating";
- }
-
- if(mode == Ice.OperationMode.Idempotent)
- {
- return "::Ice::Idempotent";
- }
-
- return "???";
+ if(mode == Ice.OperationMode.Normal)
+ {
+ return "::Ice::Normal";
+ }
+ if(mode == Ice.OperationMode.Nonmutating)
+ {
+ return "::Ice::Nonmutating";
+ }
+
+ if(mode == Ice.OperationMode.Idempotent)
+ {
+ return "::Ice::Idempotent";
+ }
+
+ return "???";
}
protected static void
__checkMode(OperationMode expected, OperationMode received)
{
- if(expected != received)
- {
- if(expected == Ice.OperationMode.Idempotent
- && received == Ice.OperationMode.Nonmutating)
- {
- //
- // Fine: typically an old client still using the
+ if(expected != received)
+ {
+ if(expected == Ice.OperationMode.Idempotent
+ && received == Ice.OperationMode.Nonmutating)
+ {
+ //
+ // Fine: typically an old client still using the
// deprecated nonmutating keyword
- //
- }
- else
- {
- Ice.MarshalException ex = new Ice.MarshalException();
- ex.reason = "unexpected operation mode. expected = "
- + operationModeToString(expected) + " received = "
- + operationModeToString(received);
- throw ex;
- }
- }
+ //
+ }
+ else
+ {
+ Ice.MarshalException ex = new Ice.MarshalException();
+ ex.reason = "unexpected operation mode. expected = "
+ + operationModeToString(expected) + " received = "
+ + operationModeToString(received);
+ throw ex;
+ }
+ }
}
}
diff --git a/java/src/Ice/ObjectPrxHelper.java b/java/src/Ice/ObjectPrxHelper.java
index 6c22fba697f..92b77a8f095 100644
--- a/java/src/Ice/ObjectPrxHelper.java
+++ b/java/src/Ice/ObjectPrxHelper.java
@@ -14,76 +14,76 @@ public class ObjectPrxHelper extends ObjectPrxHelperBase
public static ObjectPrx
checkedCast(Ice.ObjectPrx b)
{
- return b;
+ return b;
}
public static ObjectPrx
checkedCast(Ice.ObjectPrx b, java.util.Map ctx)
{
- return b;
+ return b;
}
public static ObjectPrx
checkedCast(Ice.ObjectPrx b, String f)
{
- ObjectPrx d = null;
- if(b != null)
- {
- Ice.ObjectPrx bb = b.ice_facet(f);
- try
- {
- boolean ok = bb.ice_isA("::Object");
- assert(ok);
- ObjectPrxHelper h = new ObjectPrxHelper();
- h.__copyFrom(bb);
- d = h;
- }
- catch(Ice.FacetNotExistException ex)
- {
- }
- }
- return d;
+ ObjectPrx d = null;
+ if(b != null)
+ {
+ Ice.ObjectPrx bb = b.ice_facet(f);
+ try
+ {
+ boolean ok = bb.ice_isA("::Object");
+ assert(ok);
+ ObjectPrxHelper h = new ObjectPrxHelper();
+ h.__copyFrom(bb);
+ d = h;
+ }
+ catch(Ice.FacetNotExistException ex)
+ {
+ }
+ }
+ return d;
}
public static ObjectPrx
checkedCast(Ice.ObjectPrx b, String f, java.util.Map ctx)
{
- ObjectPrx d = null;
- if(b != null)
- {
- Ice.ObjectPrx bb = b.ice_facet(f);
- try
- {
- boolean ok = bb.ice_isA("::Object", ctx);
- assert(ok);
- ObjectPrxHelper h = new ObjectPrxHelper();
- h.__copyFrom(bb);
- d = h;
- }
- catch(Ice.FacetNotExistException ex)
- {
- }
- }
- return d;
+ ObjectPrx d = null;
+ if(b != null)
+ {
+ Ice.ObjectPrx bb = b.ice_facet(f);
+ try
+ {
+ boolean ok = bb.ice_isA("::Object", ctx);
+ assert(ok);
+ ObjectPrxHelper h = new ObjectPrxHelper();
+ h.__copyFrom(bb);
+ d = h;
+ }
+ catch(Ice.FacetNotExistException ex)
+ {
+ }
+ }
+ return d;
}
public static ObjectPrx
uncheckedCast(Ice.ObjectPrx b)
{
- return b;
+ return b;
}
public static ObjectPrx
uncheckedCast(Ice.ObjectPrx b, String f)
{
- ObjectPrx d = null;
- if(b != null)
- {
- Ice.ObjectPrx bb = b.ice_facet(f);
- ObjectPrxHelper h = new ObjectPrxHelper();
- h.__copyFrom(bb);
- d = h;
- }
- return d;
+ ObjectPrx d = null;
+ if(b != null)
+ {
+ Ice.ObjectPrx bb = b.ice_facet(f);
+ ObjectPrxHelper h = new ObjectPrxHelper();
+ h.__copyFrom(bb);
+ d = h;
+ }
+ return d;
}
}
diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java
index 313dbb3bc71..ce4d0a65ac8 100644
--- a/java/src/Ice/ObjectPrxHelperBase.java
+++ b/java/src/Ice/ObjectPrxHelperBase.java
@@ -64,24 +64,24 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isA(String __id, java.util.Map __context)
{
- return ice_isA(__id, __context, true);
+ return ice_isA(__id, __context, true);
}
private boolean
ice_isA(String __id, java.util.Map __context, boolean __explicitCtx)
{
- if(__explicitCtx && __context == null)
- {
- __context = _emptyContext;
- }
-
+ if(__explicitCtx && __context == null)
+ {
+ __context = _emptyContext;
+ }
+
int __cnt = 0;
while(true)
{
- _ObjectDel __del = null;
+ _ObjectDel __del = null;
try
{
- __checkTwowayOnly("ice_isA");
+ __checkTwowayOnly("ice_isA");
__del = __getDelegate();
return __del.ice_isA(__id, __context);
}
@@ -105,24 +105,24 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final void
ice_ping(java.util.Map __context)
{
- ice_ping(__context, true);
+ ice_ping(__context, true);
}
private void
ice_ping(java.util.Map __context, boolean __explicitCtx)
{
- if(__explicitCtx && __context == null)
- {
- __context = _emptyContext;
- }
+ if(__explicitCtx && __context == null)
+ {
+ __context = _emptyContext;
+ }
int __cnt = 0;
while(true)
{
- _ObjectDel __del = null;
+ _ObjectDel __del = null;
try
{
- __checkTwowayOnly("ice_ping");
+ __checkTwowayOnly("ice_ping");
__del = __getDelegate();
__del.ice_ping(__context);
return;
@@ -147,24 +147,24 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final String[]
ice_ids(java.util.Map __context)
{
- return ice_ids(__context, true);
+ return ice_ids(__context, true);
}
private String[]
ice_ids(java.util.Map __context, boolean __explicitCtx)
{
- if(__explicitCtx && __context == null)
- {
- __context = _emptyContext;
- }
+ if(__explicitCtx && __context == null)
+ {
+ __context = _emptyContext;
+ }
int __cnt = 0;
while(true)
{
- _ObjectDel __del = null;
+ _ObjectDel __del = null;
try
{
- __checkTwowayOnly("ice_ids");
+ __checkTwowayOnly("ice_ids");
__del = __getDelegate();
return __del.ice_ids(__context);
}
@@ -188,24 +188,24 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final String
ice_id(java.util.Map __context)
{
- return ice_id(__context, true);
+ return ice_id(__context, true);
}
private String
ice_id(java.util.Map __context, boolean __explicitCtx)
{
- if(__explicitCtx && __context == null)
- {
- __context = _emptyContext;
- }
+ if(__explicitCtx && __context == null)
+ {
+ __context = _emptyContext;
+ }
int __cnt = 0;
while(true)
{
- _ObjectDel __del = null;
+ _ObjectDel __del = null;
try
{
- __checkTwowayOnly("ice_id");
+ __checkTwowayOnly("ice_id");
__del = __getDelegate();
return __del.ice_id(__context);
}
@@ -230,22 +230,22 @@ public class ObjectPrxHelperBase implements ObjectPrx
ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams,
java.util.Map context)
{
- return ice_invoke(operation, mode, inParams, outParams, context, true);
+ return ice_invoke(operation, mode, inParams, outParams, context, true);
}
private boolean
ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams,
java.util.Map context, boolean explicitCtx)
{
- if(explicitCtx && context == null)
- {
- context = _emptyContext;
- }
+ if(explicitCtx && context == null)
+ {
+ context = _emptyContext;
+ }
int __cnt = 0;
while(true)
{
- _ObjectDel __del = null;
+ _ObjectDel __del = null;
try
{
__del = __getDelegate();
@@ -272,20 +272,20 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final void
ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams)
{
- __checkTwowayOnly("ice_invoke_async");
- cb.__invoke(this, operation, mode, inParams, null);
+ __checkTwowayOnly("ice_invoke_async");
+ cb.__invoke(this, operation, mode, inParams, null);
}
public final void
ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams,
- java.util.Map context)
+ java.util.Map context)
{
- if(context == null)
- {
- context = _emptyContext;
- }
- __checkTwowayOnly("ice_invoke_async");
- cb.__invoke(this, operation, mode, inParams, context);
+ if(context == null)
+ {
+ context = _emptyContext;
+ }
+ __checkTwowayOnly("ice_invoke_async");
+ cb.__invoke(this, operation, mode, inParams, context);
}
public final Identity
@@ -298,9 +298,9 @@ public class ObjectPrxHelperBase implements ObjectPrx
ice_identity(Identity newIdentity)
{
if(newIdentity.name.equals(""))
- {
- throw new IllegalIdentityException();
- }
+ {
+ throw new IllegalIdentityException();
+ }
if(newIdentity.equals(_reference.getIdentity()))
{
return this;
@@ -319,7 +319,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_newIdentity(Identity newIdentity)
{
- return ice_identity(newIdentity);
+ return ice_identity(newIdentity);
}
public final java.util.Map
@@ -331,9 +331,9 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_context(java.util.Map newContext)
{
- ObjectPrxHelperBase proxy = new ObjectPrxHelperBase();
- proxy.setup(_reference.changeContext(newContext));
- return proxy;
+ ObjectPrxHelperBase proxy = new ObjectPrxHelperBase();
+ proxy.setup(_reference.changeContext(newContext));
+ return proxy;
}
/**
@@ -342,15 +342,15 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_newContext(java.util.Map newContext)
{
- return ice_context(newContext);
+ return ice_context(newContext);
}
public final ObjectPrx
ice_defaultContext()
{
- ObjectPrxHelperBase proxy = new ObjectPrxHelperBase();
- proxy.setup(_reference.defaultContext());
- return proxy;
+ ObjectPrxHelperBase proxy = new ObjectPrxHelperBase();
+ proxy.setup(_reference.defaultContext());
+ return proxy;
}
public final String
@@ -385,7 +385,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_newFacet(String newFacet)
{
- return ice_facet(newFacet);
+ return ice_facet(newFacet);
}
public final String
@@ -415,7 +415,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_newAdapterId(String newAdapterId)
{
- return ice_adapterId(newAdapterId);
+ return ice_adapterId(newAdapterId);
}
public final Endpoint[]
@@ -433,8 +433,8 @@ public class ObjectPrxHelperBase implements ObjectPrx
}
else
{
- IceInternal.EndpointI[] edpts = new IceInternal.EndpointI[newEndpoints.length];
- edpts = (IceInternal.EndpointI[])java.util.Arrays.asList(newEndpoints).toArray(edpts);
+ IceInternal.EndpointI[] edpts = new IceInternal.EndpointI[newEndpoints.length];
+ edpts = (IceInternal.EndpointI[])java.util.Arrays.asList(newEndpoints).toArray(edpts);
ObjectPrxHelperBase proxy = new ObjectPrxHelperBase();
proxy.setup(_reference.changeEndpoints(edpts));
return proxy;
@@ -447,13 +447,13 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_newEndpoints(Endpoint[] newEndpoints)
{
- return ice_endpoints(newEndpoints);
+ return ice_endpoints(newEndpoints);
}
public final int
ice_getLocatorCacheTimeout()
{
- return _reference.getLocatorCacheTimeout();
+ return _reference.getLocatorCacheTimeout();
}
public final ObjectPrx
@@ -474,7 +474,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isConnectionCached()
{
- return _reference.getCacheConnection();
+ return _reference.getCacheConnection();
}
public final ObjectPrx
@@ -495,7 +495,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final Ice.EndpointSelectionType
ice_getEndpointSelection()
{
- return _reference.getEndpointSelection();
+ return _reference.getEndpointSelection();
}
public final ObjectPrx
@@ -516,7 +516,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isSecure()
{
- return _reference.getSecure();
+ return _reference.getSecure();
}
public final ObjectPrx
@@ -537,7 +537,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isPreferSecure()
{
- return _reference.getPreferSecure();
+ return _reference.getPreferSecure();
}
public final ObjectPrx
@@ -558,8 +558,8 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final Ice.RouterPrx
ice_getRouter()
{
- IceInternal.RouterInfo ri = _reference.getRouterInfo();
- return ri != null ? ri.getRouter() : null;
+ IceInternal.RouterInfo ri = _reference.getRouterInfo();
+ return ri != null ? ri.getRouter() : null;
}
public final ObjectPrx
@@ -581,8 +581,8 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final Ice.LocatorPrx
ice_getLocator()
{
- IceInternal.LocatorInfo ri = _reference.getLocatorInfo();
- return ri != null ? ri.getLocator() : null;
+ IceInternal.LocatorInfo ri = _reference.getLocatorInfo();
+ return ri != null ? ri.getLocator() : null;
}
public final ObjectPrx
@@ -604,7 +604,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isCollocationOptimized()
{
- return _reference.getCollocationOptimization();
+ return _reference.getCollocationOptimization();
}
/**
@@ -649,7 +649,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isTwoway()
{
- return _reference.getMode() == IceInternal.Reference.ModeTwoway;
+ return _reference.getMode() == IceInternal.Reference.ModeTwoway;
}
public final ObjectPrx
@@ -670,7 +670,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isOneway()
{
- return _reference.getMode() == IceInternal.Reference.ModeOneway;
+ return _reference.getMode() == IceInternal.Reference.ModeOneway;
}
public final ObjectPrx
@@ -691,7 +691,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isBatchOneway()
{
- return _reference.getMode() == IceInternal.Reference.ModeBatchOneway;
+ return _reference.getMode() == IceInternal.Reference.ModeBatchOneway;
}
public final ObjectPrx
@@ -712,7 +712,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isDatagram()
{
- return _reference.getMode() == IceInternal.Reference.ModeDatagram;
+ return _reference.getMode() == IceInternal.Reference.ModeDatagram;
}
public final ObjectPrx
@@ -733,7 +733,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isBatchDatagram()
{
- return _reference.getMode() == IceInternal.Reference.ModeBatchDatagram;
+ return _reference.getMode() == IceInternal.Reference.ModeBatchDatagram;
}
public final ObjectPrx
@@ -821,7 +821,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
int __cnt = 0;
while(true)
{
- _ObjectDel __del = null;
+ _ObjectDel __del = null;
try
{
__del = __getDelegate();
@@ -837,11 +837,11 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final Connection
ice_getCachedConnection()
{
- _ObjectDel __del = null;
+ _ObjectDel __del = null;
synchronized(this)
- {
- __del = _delegate;
- }
+ {
+ __del = _delegate;
+ }
if(__del != null)
{
@@ -853,23 +853,23 @@ public class ObjectPrxHelperBase implements ObjectPrx
{
}
}
- return null;
+ return null;
}
public final boolean
equals(java.lang.Object r)
{
- if(this == r)
- {
- return true;
- }
+ if(this == r)
+ {
+ return true;
+ }
- if(r instanceof ObjectPrxHelperBase)
- {
- return _reference.equals(((ObjectPrxHelperBase)r)._reference);
- }
+ if(r instanceof ObjectPrxHelperBase)
+ {
+ return _reference.equals(((ObjectPrxHelperBase)r)._reference);
+ }
- return false;
+ return false;
}
public final IceInternal.Reference
@@ -910,63 +910,63 @@ public class ObjectPrxHelperBase implements ObjectPrx
// called upon initialization.
//
- assert(_reference == null);
- assert(_delegate == null);
+ 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 invocations.
- //
-
- if(delegateD != null)
- {
- _ObjectDelD delegate = __createDelegateD();
- delegate.__copyFrom(delegateD);
- _delegate = delegate;
- }
- else if(delegateM != null)
- {
- _ObjectDelM delegate = __createDelegateM();
- delegate.__copyFrom(delegateM);
- _delegate = delegate;
- }
- }
+ 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 invocations.
+ //
+
+ if(delegateD != null)
+ {
+ _ObjectDelD delegate = __createDelegateD();
+ delegate.__copyFrom(delegateD);
+ _delegate = delegate;
+ }
+ else if(delegateM != null)
+ {
+ _ObjectDelM delegate = __createDelegateM();
+ delegate.__copyFrom(delegateM);
+ _delegate = delegate;
+ }
+ }
}
public final int
__handleException(_ObjectDel delegate, LocalException ex, int cnt)
{
- //
- // Only _delegate needs to be mutex protected here.
- //
- synchronized(this)
- {
- if(delegate == _delegate)
- {
- _delegate = null;
- }
- }
-
- IceInternal.ProxyFactory proxyFactory;
- try
- {
- proxyFactory = _reference.getInstance().proxyFactory();
- }
- catch(CommunicatorDestroyedException e)
- {
- //
+ //
+ // Only _delegate needs to be mutex protected here.
+ //
+ synchronized(this)
+ {
+ if(delegate == _delegate)
+ {
+ _delegate = null;
+ }
+ }
+
+ IceInternal.ProxyFactory proxyFactory;
+ try
+ {
+ proxyFactory = _reference.getInstance().proxyFactory();
+ }
+ catch(CommunicatorDestroyedException e)
+ {
+ //
// The communicator is already destroyed, so we cannot
// retry.
- //
- throw ex;
- }
+ //
+ throw ex;
+ }
- return proxyFactory.checkRetryAfterException(ex, _reference, cnt);
+ return proxyFactory.checkRetryAfterException(ex, _reference, cnt);
}
public final void
@@ -974,10 +974,10 @@ public class ObjectPrxHelperBase implements ObjectPrx
{
synchronized(this)
{
- if(delegate == _delegate)
- {
- _delegate = null;
- }
+ if(delegate == _delegate)
+ {
+ _delegate = null;
+ }
}
if(!ex.retry())
@@ -997,10 +997,10 @@ public class ObjectPrxHelperBase implements ObjectPrx
{
synchronized(this)
{
- if(delegate == _delegate)
- {
- _delegate = null;
- }
+ if(delegate == _delegate)
+ {
+ _delegate = null;
+ }
}
return cnt;
}
@@ -1009,17 +1009,17 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final void
__checkTwowayOnly(String name)
{
- //
- // No mutex lock necessary, there is nothing mutable in this
- // operation.
- //
+ //
+ // No mutex lock necessary, there is nothing mutable in this
+ // operation.
+ //
if(!ice_isTwoway())
- {
- TwowayOnlyException ex = new TwowayOnlyException();
- ex.operation = name;
- throw ex;
- }
+ {
+ TwowayOnlyException ex = new TwowayOnlyException();
+ ex.operation = name;
+ throw ex;
+ }
}
public final synchronized _ObjectDel
@@ -1027,50 +1027,50 @@ public class ObjectPrxHelperBase implements ObjectPrx
{
if(_delegate != null)
{
- return _delegate;
- }
-
- _ObjectDel delegate = null;
- if(_reference.getCollocationOptimization())
- {
- ObjectAdapter adapter = _reference.getInstance().objectAdapterFactory().findObjectAdapter(this);
- if(adapter != null)
- {
- _ObjectDelD d = __createDelegateD();
- d.setup(_reference, adapter);
- delegate = d;
- }
- }
-
- if(delegate == null)
- {
- _ObjectDelM d = __createDelegateM();
- d.setup(_reference);
- delegate = d;
-
- //
- // If this proxy is for a non-local object, and we are
- // using a router, then add this proxy to the router info
- // object.
- //
- IceInternal.RouterInfo ri = _reference.getRouterInfo();
- if(ri != null)
- {
- ri.addProxy(this);
- }
- }
-
- 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 invocations.
- //
- _delegate = delegate;
- }
-
- return delegate;
+ return _delegate;
+ }
+
+ _ObjectDel delegate = null;
+ if(_reference.getCollocationOptimization())
+ {
+ ObjectAdapter adapter = _reference.getInstance().objectAdapterFactory().findObjectAdapter(this);
+ if(adapter != null)
+ {
+ _ObjectDelD d = __createDelegateD();
+ d.setup(_reference, adapter);
+ delegate = d;
+ }
+ }
+
+ if(delegate == null)
+ {
+ _ObjectDelM d = __createDelegateM();
+ d.setup(_reference);
+ delegate = d;
+
+ //
+ // If this proxy is for a non-local object, and we are
+ // using a router, then add this proxy to the router info
+ // object.
+ //
+ IceInternal.RouterInfo ri = _reference.getRouterInfo();
+ if(ri != null)
+ {
+ ri.addProxy(this);
+ }
+ }
+
+ 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 invocations.
+ //
+ _delegate = delegate;
+ }
+
+ return delegate;
}
protected _ObjectDelM
@@ -1096,8 +1096,8 @@ public class ObjectPrxHelperBase implements ObjectPrx
// upon initial initialization.
//
- assert(_reference == null);
- assert(_delegate == null);
+ assert(_reference == null);
+ assert(_delegate == null);
_reference = ref;
}
diff --git a/java/src/Ice/PluginManagerI.java b/java/src/Ice/PluginManagerI.java
index 5a29965c3a9..e88bb3cc129 100644
--- a/java/src/Ice/PluginManagerI.java
+++ b/java/src/Ice/PluginManagerI.java
@@ -16,84 +16,84 @@ public final class PluginManagerI extends LocalObjectImpl implements PluginManag
public synchronized void
initializePlugins()
{
- if(_initialized)
- {
- InitializationException ex = new InitializationException();
- ex.reason = "plugins already initialized";
- throw ex;
- }
+ if(_initialized)
+ {
+ InitializationException ex = new InitializationException();
+ ex.reason = "plugins already initialized";
+ throw ex;
+ }
- //
- // Invoke initialize() on the plugins, in the order they were loaded.
- //
- java.util.ArrayList initializedPlugins = new java.util.ArrayList();
- try
- {
- java.util.Iterator i = _initOrder.iterator();
- while(i.hasNext())
- {
- Plugin p = (Plugin)i.next();
- p.initialize();
- initializedPlugins.add(p);
- }
- }
- catch(RuntimeException ex)
- {
- //
- // Destroy the plugins that have been successfully initialized, in the
- // reverse order.
- //
- java.util.ListIterator i = initializedPlugins.listIterator(initializedPlugins.size());
- while(i.hasPrevious())
- {
- Plugin p = (Plugin)i.previous();
- try
- {
- p.destroy();
- }
- catch(RuntimeException e)
- {
- // Ignore.
- }
- }
- throw ex;
- }
+ //
+ // Invoke initialize() on the plugins, in the order they were loaded.
+ //
+ java.util.ArrayList initializedPlugins = new java.util.ArrayList();
+ try
+ {
+ java.util.Iterator i = _initOrder.iterator();
+ while(i.hasNext())
+ {
+ Plugin p = (Plugin)i.next();
+ p.initialize();
+ initializedPlugins.add(p);
+ }
+ }
+ catch(RuntimeException ex)
+ {
+ //
+ // Destroy the plugins that have been successfully initialized, in the
+ // reverse order.
+ //
+ java.util.ListIterator i = initializedPlugins.listIterator(initializedPlugins.size());
+ while(i.hasPrevious())
+ {
+ Plugin p = (Plugin)i.previous();
+ try
+ {
+ p.destroy();
+ }
+ catch(RuntimeException e)
+ {
+ // Ignore.
+ }
+ }
+ throw ex;
+ }
- _initialized = true;
+ _initialized = true;
}
public synchronized Plugin
getPlugin(String name)
{
- if(_communicator == null)
- {
- throw new CommunicatorDestroyedException();
- }
+ if(_communicator == null)
+ {
+ throw new CommunicatorDestroyedException();
+ }
Plugin p = (Plugin)_plugins.get(name);
if(p != null)
{
return p;
}
- NotRegisteredException ex = new NotRegisteredException();
- ex.id = name;
- ex.kindOfObject = _kindOfObject;
+ NotRegisteredException ex = new NotRegisteredException();
+ ex.id = name;
+ ex.kindOfObject = _kindOfObject;
throw ex;
}
public synchronized void
addPlugin(String name, Plugin plugin)
{
- if(_communicator == null)
- {
- throw new CommunicatorDestroyedException();
- }
+ if(_communicator == null)
+ {
+ throw new CommunicatorDestroyedException();
+ }
if(_plugins.containsKey(name))
{
- AlreadyRegisteredException ex = new AlreadyRegisteredException();
- ex.id = name;
- ex.kindOfObject = _kindOfObject;
+ AlreadyRegisteredException ex = new AlreadyRegisteredException();
+ ex.id = name;
+ ex.kindOfObject = _kindOfObject;
throw ex;
}
_plugins.put(name, plugin);
@@ -102,31 +102,31 @@ public final class PluginManagerI extends LocalObjectImpl implements PluginManag
public synchronized void
destroy()
{
- if(_communicator != null)
- {
- java.util.Iterator i = _plugins.values().iterator();
- while(i.hasNext())
- {
- Plugin p = (Plugin)i.next();
- p.destroy();
- }
+ if(_communicator != null)
+ {
+ java.util.Iterator i = _plugins.values().iterator();
+ while(i.hasNext())
+ {
+ Plugin p = (Plugin)i.next();
+ p.destroy();
+ }
- _logger = null;
- _communicator = null;
- }
+ _logger = null;
+ _communicator = null;
+ }
}
public
PluginManagerI(Communicator communicator)
{
_communicator = communicator;
- _initialized = false;
+ _initialized = false;
}
public void
loadPlugins(StringSeqHolder cmdArgs)
{
- assert(_communicator != null);
+ assert(_communicator != null);
//
// Load and initialize the plug-ins defined in the property set
@@ -135,113 +135,113 @@ public final class PluginManagerI extends LocalObjectImpl implements PluginManag
//
// Ice.Plugin.name=entry_point [args]
//
- // If the Ice.PluginLoadOrder property is defined, load the
- // specified plugins in the specified order, then load any
- // remaining plugins.
- //
+ // If the Ice.PluginLoadOrder property is defined, load the
+ // specified plugins in the specified order, then load any
+ // remaining plugins.
+ //
final String prefix = "Ice.Plugin.";
- Properties properties = _communicator.getProperties();
+ Properties properties = _communicator.getProperties();
java.util.Map plugins = properties.getPropertiesForPrefix(prefix);
- final String loadOrder = properties.getProperty("Ice.PluginLoadOrder");
- if(loadOrder.length() > 0)
- {
- String[] names = loadOrder.split("[, \t\n]+");
- for(int i = 0; i < names.length; ++i)
- {
- if(_plugins.containsKey(names[i]))
- {
- PluginInitializationException ex = new PluginInitializationException();
- ex.reason = "plugin `" + names[i] + "' already loaded";
- throw ex;
- }
+ final String loadOrder = properties.getProperty("Ice.PluginLoadOrder");
+ if(loadOrder.length() > 0)
+ {
+ String[] names = loadOrder.split("[, \t\n]+");
+ for(int i = 0; i < names.length; ++i)
+ {
+ if(_plugins.containsKey(names[i]))
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "plugin `" + names[i] + "' already loaded";
+ throw ex;
+ }
- final String key = "Ice.Plugin." + names[i];
- if(plugins.containsKey(key))
- {
- final String value = (String)plugins.get(key);
- loadPlugin(names[i], value, cmdArgs, false);
- plugins.remove(key);
- }
- else
- {
- PluginInitializationException ex = new PluginInitializationException();
- ex.reason = "plugin `" + names[i] + "' not defined";
- throw ex;
- }
- }
- }
+ final String key = "Ice.Plugin." + names[i];
+ if(plugins.containsKey(key))
+ {
+ final String value = (String)plugins.get(key);
+ loadPlugin(names[i], value, cmdArgs, false);
+ plugins.remove(key);
+ }
+ else
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "plugin `" + names[i] + "' not defined";
+ throw ex;
+ }
+ }
+ }
- //
- // Load any remaining plugins that weren't specified in PluginLoadOrder.
- //
+ //
+ // Load any remaining plugins that weren't specified in PluginLoadOrder.
+ //
java.util.Iterator p = plugins.entrySet().iterator();
while(p.hasNext())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
+ java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
String name = ((String)entry.getKey()).substring(prefix.length());
String value = (String)entry.getValue();
loadPlugin(name, value, cmdArgs, false);
}
- //
- // Check for a Logger Plugin
- //
- String loggerStr = properties.getProperty("Ice.LoggerPlugin");
- if(loggerStr.length() != 0)
- {
- loadPlugin("Logger", loggerStr, cmdArgs, true);
- }
+ //
+ // Check for a Logger Plugin
+ //
+ String loggerStr = properties.getProperty("Ice.LoggerPlugin");
+ if(loggerStr.length() != 0)
+ {
+ loadPlugin("Logger", loggerStr, cmdArgs, true);
+ }
- //
- // An application can set Ice.InitPlugins=0 if it wants to postpone
- // initialization until after it has interacted directly with the
- // plugins.
- //
- if(properties.getPropertyAsIntWithDefault("Ice.InitPlugins", 1) > 0)
- {
- initializePlugins();
- }
+ //
+ // An application can set Ice.InitPlugins=0 if it wants to postpone
+ // initialization until after it has interacted directly with the
+ // plugins.
+ //
+ if(properties.getPropertyAsIntWithDefault("Ice.InitPlugins", 1) > 0)
+ {
+ initializePlugins();
+ }
}
private void
loadPlugin(String name, String pluginSpec, StringSeqHolder cmdArgs, boolean isLogger)
{
- assert(_communicator != null);
+ assert(_communicator != null);
- //
- // Separate the entry point from the arguments.
- //
- String className;
- String[] args;
- int pos = pluginSpec.indexOf(' ');
- if(pos == -1)
- {
- pos = pluginSpec.indexOf('\t');
- }
- if(pos == -1)
- {
- pos = pluginSpec.indexOf('\n');
- }
- if(pos == -1)
- {
- className = pluginSpec;
- args = new String[0];
- }
- else
- {
- className = pluginSpec.substring(0, pos);
- args = pluginSpec.substring(pos).trim().split("[ \t\n]+", pos);
- }
+ //
+ // Separate the entry point from the arguments.
+ //
+ String className;
+ String[] args;
+ int pos = pluginSpec.indexOf(' ');
+ if(pos == -1)
+ {
+ pos = pluginSpec.indexOf('\t');
+ }
+ if(pos == -1)
+ {
+ pos = pluginSpec.indexOf('\n');
+ }
+ if(pos == -1)
+ {
+ className = pluginSpec;
+ args = new String[0];
+ }
+ else
+ {
+ className = pluginSpec.substring(0, pos);
+ args = pluginSpec.substring(pos).trim().split("[ \t\n]+", pos);
+ }
- //
- // Convert command-line options into properties. First we
- // convert the options from the plug-in configuration, then
- // we convert the options from the application command-line.
- //
- Properties properties = _communicator.getProperties();
- args = properties.parseCommandLineOptions(name, args);
- cmdArgs.value = properties.parseCommandLineOptions(name, cmdArgs.value);
+ //
+ // Convert command-line options into properties. First we
+ // convert the options from the plug-in configuration, then
+ // we convert the options from the application command-line.
+ //
+ Properties properties = _communicator.getProperties();
+ args = properties.parseCommandLineOptions(name, args);
+ cmdArgs.value = properties.parseCommandLineOptions(name, cmdArgs.value);
//
// Instantiate the class.
@@ -254,20 +254,20 @@ public final class PluginManagerI extends LocalObjectImpl implements PluginManag
java.lang.Object obj = c.newInstance();
try
{
- if(isLogger)
- {
+ if(isLogger)
+ {
loggerFactory = (LoggerFactory)obj;
- }
- else
- {
+ }
+ else
+ {
pluginFactory = (PluginFactory)obj;
- }
+ }
}
catch(ClassCastException ex)
{
PluginInitializationException e = new PluginInitializationException();
e.reason = "class " + className + " does not implement " +
- (isLogger ? "Ice.LoggerFactory" : "Ice.PluginFactory");
+ (isLogger ? "Ice.LoggerFactory" : "Ice.PluginFactory");
e.initCause(ex);
throw e;
}
@@ -297,8 +297,8 @@ public final class PluginManagerI extends LocalObjectImpl implements PluginManag
//
// Invoke the factory.
//
- if(isLogger)
- {
+ if(isLogger)
+ {
try
{
_logger = loggerFactory.create(_communicator, args);
@@ -311,15 +311,15 @@ public final class PluginManagerI extends LocalObjectImpl implements PluginManag
throw e;
}
- if(_logger == null)
- {
+ if(_logger == null)
+ {
PluginInitializationException e = new PluginInitializationException();
e.reason = "failure in factory " + className;
throw e;
- }
- }
- else
- {
+ }
+ }
+ else
+ {
Plugin plugin = null;
try
{
@@ -337,16 +337,16 @@ public final class PluginManagerI extends LocalObjectImpl implements PluginManag
throw e;
}
- if(plugin == null)
- {
+ if(plugin == null)
+ {
PluginInitializationException e = new PluginInitializationException();
e.reason = "failure in factory " + className;
throw e;
- }
+ }
_plugins.put(name, plugin);
- _initOrder.add(plugin);
- }
+ _initOrder.add(plugin);
+ }
}
public Logger
diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java
index 833750254ba..c87df8295c2 100644
--- a/java/src/Ice/PropertiesI.java
+++ b/java/src/Ice/PropertiesI.java
@@ -44,7 +44,7 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
public int
getPropertyAsInt(String key)
{
- return getPropertyAsIntWithDefault(key, 0);
+ return getPropertyAsIntWithDefault(key, 0);
}
public synchronized int
@@ -60,20 +60,20 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
return value;
}
- try
- {
- return Integer.parseInt(result);
- }
- catch(NumberFormatException ex)
- {
- return 0;
- }
+ try
+ {
+ return Integer.parseInt(result);
+ }
+ catch(NumberFormatException ex)
+ {
+ return 0;
+ }
}
public synchronized java.util.Map
getPropertiesForPrefix(String prefix)
{
- java.util.HashMap result = new java.util.HashMap();
+ java.util.HashMap result = new java.util.HashMap();
java.util.Iterator p = _properties.entrySet().iterator();
while(p.hasNext())
{
@@ -82,68 +82,68 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
String value = (String)entry.getValue();
if(prefix.length() == 0 || key.startsWith(prefix))
{
- result.put(key, value);
+ result.put(key, value);
}
}
- return result;
+ return result;
}
public void
setProperty(String key, String value)
{
- //
- // Check if the property is legal.
- //
- Logger logger = Ice.Util.getProcessLogger();
- if(key == null || key.length() == 0)
- {
- return;
- }
+ //
+ // Check if the property is legal.
+ //
+ Logger logger = Ice.Util.getProcessLogger();
+ if(key == null || key.length() == 0)
+ {
+ return;
+ }
int dotPos = key.indexOf('.');
- if(dotPos != -1)
- {
- String prefix = key.substring(0, dotPos);
- for(int i = 0; IceInternal.PropertyNames.validProps[i] != null; ++i)
- {
- String pattern = IceInternal.PropertyNames.validProps[i][0];
- dotPos = pattern.indexOf('.');
- assert(dotPos != -1);
- String propPrefix = pattern.substring(1, dotPos - 1);
- if(!propPrefix.equals(prefix))
- {
- continue;
- }
-
- boolean found = false;
- for(int j = 0; IceInternal.PropertyNames.validProps[i][j] != null && !found; ++j)
- {
- pattern = IceInternal.PropertyNames.validProps[i][j];
- java.util.regex.Pattern pComp = java.util.regex.Pattern.compile(pattern);
- java.util.regex.Matcher m = pComp.matcher(key);
- found = m.matches();
- }
- if(!found)
- {
- logger.warning("unknown property: " + key);
- }
- }
- }
-
- synchronized(this)
- {
- //
- // Set or clear the property.
- //
- if(value != null && value.length() > 0)
- {
- _properties.put(key, value);
- }
- else
- {
- _properties.remove(key);
- }
- }
+ if(dotPos != -1)
+ {
+ String prefix = key.substring(0, dotPos);
+ for(int i = 0; IceInternal.PropertyNames.validProps[i] != null; ++i)
+ {
+ String pattern = IceInternal.PropertyNames.validProps[i][0];
+ dotPos = pattern.indexOf('.');
+ assert(dotPos != -1);
+ String propPrefix = pattern.substring(1, dotPos - 1);
+ if(!propPrefix.equals(prefix))
+ {
+ continue;
+ }
+
+ boolean found = false;
+ for(int j = 0; IceInternal.PropertyNames.validProps[i][j] != null && !found; ++j)
+ {
+ pattern = IceInternal.PropertyNames.validProps[i][j];
+ java.util.regex.Pattern pComp = java.util.regex.Pattern.compile(pattern);
+ java.util.regex.Matcher m = pComp.matcher(key);
+ found = m.matches();
+ }
+ if(!found)
+ {
+ logger.warning("unknown property: " + key);
+ }
+ }
+ }
+
+ synchronized(this)
+ {
+ //
+ // Set or clear the property.
+ //
+ if(value != null && value.length() > 0)
+ {
+ _properties.put(key, value);
+ }
+ else
+ {
+ _properties.remove(key);
+ }
+ }
}
public synchronized String[]
@@ -164,11 +164,11 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
public String[]
parseCommandLineOptions(String pfx, String[] options)
{
- if(pfx.length() > 0 && pfx.charAt(pfx.length() - 1) != '.')
- {
- pfx += '.';
- }
- pfx = "--" + pfx;
+ if(pfx.length() > 0 && pfx.charAt(pfx.length() - 1) != '.')
+ {
+ pfx += '.';
+ }
+ pfx = "--" + pfx;
java.util.ArrayList result = new java.util.ArrayList();
for(int i = 0; i < options.length; i++)
@@ -197,10 +197,10 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
parseIceCommandLineOptions(String[] options)
{
String[] args = options;
- for(int i = 0; IceInternal.PropertyNames.clPropNames[i] != null; ++i)
- {
- args = parseCommandLineOptions(IceInternal.PropertyNames.clPropNames[i], args);
- }
+ for(int i = 0; IceInternal.PropertyNames.clPropNames[i] != null; ++i)
+ {
+ args = parseCommandLineOptions(IceInternal.PropertyNames.clPropNames[i], args);
+ }
return args;
}
@@ -209,7 +209,7 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
{
try
{
- java.io.FileInputStream fis = new java.io.FileInputStream(file);
+ java.io.FileInputStream fis = new java.io.FileInputStream(file);
java.io.InputStreamReader isr = new java.io.InputStreamReader(fis, "UTF-8");
java.io.BufferedReader br = new java.io.BufferedReader(isr);
parse(br);
@@ -217,7 +217,7 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
catch(java.io.IOException ex)
{
FileException fe = new FileException();
- fe.path = file;
+ fe.path = file;
fe.initCause(ex); // Exception chaining
throw fe;
}
@@ -240,12 +240,12 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
PropertiesI(StringSeqHolder args, Properties defaults)
{
- if(defaults != null)
- {
- _properties.putAll(defaults.getPropertiesForPrefix(""));
- }
-
- boolean loadConfigFiles = false;
+ if(defaults != null)
+ {
+ _properties.putAll(defaults.getPropertiesForPrefix(""));
+ }
+
+ boolean loadConfigFiles = false;
for(int i = 0; i < args.value.length; i++)
{
@@ -257,7 +257,7 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
line += "=1";
}
parseLine(line.substring(2));
- loadConfigFiles = true;
+ loadConfigFiles = true;
String[] arr = new String[args.value.length - 1];
System.arraycopy(args.value, 0, arr, 0, i);
@@ -269,12 +269,12 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
}
}
- if(loadConfigFiles)
- {
- loadConfig();
- }
+ if(loadConfigFiles)
+ {
+ loadConfig();
+ }
- args.value = parseIceCommandLineOptions(args.value);
+ args.value = parseIceCommandLineOptions(args.value);
}
private void
diff --git a/java/src/Ice/ProxyIdentityFacetKey.java b/java/src/Ice/ProxyIdentityFacetKey.java
index 994a6f76d02..152a8b3a4a1 100644
--- a/java/src/Ice/ProxyIdentityFacetKey.java
+++ b/java/src/Ice/ProxyIdentityFacetKey.java
@@ -40,18 +40,18 @@ public class ProxyIdentityFacetKey
public boolean
equals(java.lang.Object obj)
{
- if(this == obj)
- {
- return true;
- }
+ if(this == obj)
+ {
+ return true;
+ }
- if(obj instanceof ProxyIdentityFacetKey)
- {
- ProxyIdentityFacetKey other = (ProxyIdentityFacetKey)obj;
- return (_hashCode == other._hashCode) && _identity.equals(other._identity) && _facet.equals(other._facet);
- }
+ if(obj instanceof ProxyIdentityFacetKey)
+ {
+ ProxyIdentityFacetKey other = (ProxyIdentityFacetKey)obj;
+ return (_hashCode == other._hashCode) && _identity.equals(other._identity) && _facet.equals(other._facet);
+ }
- return false;
+ return false;
}
public Ice.ObjectPrx
diff --git a/java/src/Ice/ProxyIdentityKey.java b/java/src/Ice/ProxyIdentityKey.java
index e53f9ef2cc9..dd947a3b320 100644
--- a/java/src/Ice/ProxyIdentityKey.java
+++ b/java/src/Ice/ProxyIdentityKey.java
@@ -37,18 +37,18 @@ public class ProxyIdentityKey
public boolean
equals(java.lang.Object obj)
{
- if(this == obj)
- {
- return true;
- }
-
- if(obj instanceof ProxyIdentityKey)
- {
- ProxyIdentityKey other = (ProxyIdentityKey)obj;
- return (_hashCode == other._hashCode) && _identity.equals(other._identity);
- }
-
- return false;
+ if(this == obj)
+ {
+ return true;
+ }
+
+ if(obj instanceof ProxyIdentityKey)
+ {
+ ProxyIdentityKey other = (ProxyIdentityKey)obj;
+ return (_hashCode == other._hashCode) && _identity.equals(other._identity);
+ }
+
+ return false;
}
public Ice.ObjectPrx
diff --git a/java/src/Ice/SysLoggerI.java b/java/src/Ice/SysLoggerI.java
index 14aa5ddaaf8..74e813f7ee2 100644
--- a/java/src/Ice/SysLoggerI.java
+++ b/java/src/Ice/SysLoggerI.java
@@ -19,77 +19,77 @@ public final class SysLoggerI extends LocalObjectImpl implements Logger
public
SysLoggerI(String ident)
{
- _ident = ident;
-
- //
- // Open a datagram socket to communicate with the localhost
- // syslog daemon.
- //
- try
- {
- _host = IceInternal.Network.getLocalAddress();
- _socket = new DatagramSocket();
- _socket.connect(_host, _port);
- }
- catch(java.io.IOException ex)
- {
+ _ident = ident;
+
+ //
+ // Open a datagram socket to communicate with the localhost
+ // syslog daemon.
+ //
+ try
+ {
+ _host = IceInternal.Network.getLocalAddress();
+ _socket = new DatagramSocket();
+ _socket.connect(_host, _port);
+ }
+ catch(java.io.IOException ex)
+ {
Ice.SocketException se = new Ice.SocketException();
se.initCause(ex);
throw se;
- }
+ }
}
public void
print(String message)
{
- log(LOG_INFO, message);
+ log(LOG_INFO, message);
}
public void
trace(String category, String message)
{
- log(LOG_INFO, category + ": " + message);
+ log(LOG_INFO, category + ": " + message);
}
public void
warning(String message)
{
- log(LOG_WARNING, message);
+ log(LOG_WARNING, message);
}
public void
error(String message)
{
- log(LOG_ERR, message);
+ log(LOG_ERR, message);
}
private void
log(int severity, String message)
{
- try
- {
- //
- // Create a syslog message as defined by the RFC 3164:
- // <PRI>HEADER MSG. PRI is the priority and is calculated
- // from the facility and the severity. We don't specify
- // the HEADER. MSG contains the identifier followed by a
- // colon character and the message.
- //
-
- int priority = (LOG_USER << 3) | severity;
-
- String msg = '<' + Integer.toString(priority) + '>' + _ident + ": " + message;
-
- byte buf[] = msg.getBytes();
- DatagramPacket p = new DatagramPacket(buf, buf.length, _host, _port);
- _socket.send(p);
- }
- catch(java.io.IOException ex)
- {
+ try
+ {
+ //
+ // Create a syslog message as defined by the RFC 3164:
+ // <PRI>HEADER MSG. PRI is the priority and is calculated
+ // from the facility and the severity. We don't specify
+ // the HEADER. MSG contains the identifier followed by a
+ // colon character and the message.
+ //
+
+ int priority = (LOG_USER << 3) | severity;
+
+ String msg = '<' + Integer.toString(priority) + '>' + _ident + ": " + message;
+
+ byte buf[] = msg.getBytes();
+ DatagramPacket p = new DatagramPacket(buf, buf.length, _host, _port);
+ _socket.send(p);
+ }
+ catch(java.io.IOException ex)
+ {
Ice.SocketException se = new Ice.SocketException();
se.initCause(ex);
throw se;
- }
+ }
}
private String _ident;
diff --git a/java/src/Ice/UserException.java b/java/src/Ice/UserException.java
index f6df228662e..8d11f40d4bd 100644
--- a/java/src/Ice/UserException.java
+++ b/java/src/Ice/UserException.java
@@ -14,15 +14,15 @@ public abstract class UserException extends Exception
public java.lang.Object clone()
{
java.lang.Object o = null;
- try
- {
- o = super.clone();
- }
- catch(CloneNotSupportedException ex)
- {
- assert false; // Impossible
- }
- return o;
+ try
+ {
+ o = super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert false; // Impossible
+ }
+ return o;
}
public abstract String
diff --git a/java/src/Ice/Util.java b/java/src/Ice/Util.java
index 09a4e69c440..bbe1df80580 100644
--- a/java/src/Ice/Util.java
+++ b/java/src/Ice/Util.java
@@ -32,42 +32,42 @@ public final class Util
public static Properties
createProperties(String[] args)
{
- StringSeqHolder argsH = new StringSeqHolder(args);
+ StringSeqHolder argsH = new StringSeqHolder(args);
return createProperties(argsH);
}
public static Properties
createProperties(String[] args, Properties defaults)
{
- StringSeqHolder argsH = new StringSeqHolder(args);
+ StringSeqHolder argsH = new StringSeqHolder(args);
return createProperties(argsH, defaults);
}
public static Communicator
initialize(StringSeqHolder args)
{
- return initialize(args, null);
+ return initialize(args, null);
}
public static Communicator
initialize(String[] args)
{
StringSeqHolder argsH = new StringSeqHolder(args);
- return initialize(argsH);
+ return initialize(argsH);
}
public static Communicator
initialize(StringSeqHolder args, InitializationData initData)
{
- if(initData == null)
- {
- initData = new InitializationData();
- }
- else
- {
- initData = (InitializationData)initData.clone();
- }
- initData.properties = createProperties(args, initData.properties);
+ if(initData == null)
+ {
+ initData = new InitializationData();
+ }
+ else
+ {
+ initData = (InitializationData)initData.clone();
+ }
+ initData.properties = createProperties(args, initData.properties);
CommunicatorI result = new CommunicatorI(initData);
result.finishSetup(args);
@@ -78,22 +78,22 @@ public final class Util
initialize(String[] args, InitializationData initData)
{
StringSeqHolder argsH = new StringSeqHolder(args);
- return initialize(argsH, initData);
+ return initialize(argsH, initData);
}
public static Communicator
initialize(InitializationData initData)
{
- if(initData == null)
- {
- initData = new InitializationData();
- }
- else
- {
- initData = (InitializationData)initData.clone();
- }
-
- CommunicatorI result = new CommunicatorI(initData);
+ if(initData == null)
+ {
+ initData = new InitializationData();
+ }
+ else
+ {
+ initData = (InitializationData)initData.clone();
+ }
+
+ CommunicatorI result = new CommunicatorI(initData);
result.finishSetup(new StringSeqHolder(new String[0]));
return result;
}
@@ -110,9 +110,9 @@ public final class Util
public static Communicator
initializeWithLogger(StringSeqHolder args, Logger logger)
{
- InitializationData initData = new InitializationData();
- initData.logger = logger;
- return initialize(args, initData);
+ InitializationData initData = new InitializationData();
+ initData.logger = logger;
+ return initialize(args, initData);
}
/**
@@ -121,9 +121,9 @@ public final class Util
public static Communicator
initializeWithLogger(String[] args, Logger logger)
{
- InitializationData initData = new InitializationData();
- initData.logger = logger;
- return initialize(args, initData);
+ InitializationData initData = new InitializationData();
+ initData.logger = logger;
+ return initialize(args, initData);
}
/**
@@ -132,9 +132,9 @@ public final class Util
public static Communicator
initializeWithProperties(StringSeqHolder args, Properties properties)
{
- InitializationData initData = new InitializationData();
- initData.properties = properties;
- return initialize(args, initData);
+ InitializationData initData = new InitializationData();
+ initData.properties = properties;
+ return initialize(args, initData);
}
/**
@@ -143,9 +143,9 @@ public final class Util
public static Communicator
initializeWithProperties(String[] args, Properties properties)
{
- InitializationData initData = new InitializationData();
- initData.properties = properties;
- return initialize(args, initData);
+ InitializationData initData = new InitializationData();
+ initData.properties = properties;
+ return initialize(args, initData);
}
/**
@@ -154,10 +154,10 @@ public final class Util
public static Communicator
initializeWithPropertiesAndLogger(StringSeqHolder args, Properties properties, Logger logger)
{
- InitializationData initData = new InitializationData();
- initData.properties = properties;
- initData.logger = logger;
- return initialize(args, initData);
+ InitializationData initData = new InitializationData();
+ initData.properties = properties;
+ initData.logger = logger;
+ return initialize(args, initData);
}
/**
@@ -166,10 +166,10 @@ public final class Util
public static Communicator
initializeWithPropertiesAndLogger(String[] args, Properties properties, Logger logger)
{
- InitializationData initData = new InitializationData();
- initData.properties = properties;
- initData.logger = logger;
- return initialize(args, initData);
+ InitializationData initData = new InitializationData();
+ initData.properties = properties;
+ initData.logger = logger;
+ return initialize(args, initData);
}
public static IceInternal.Instance
@@ -182,7 +182,7 @@ public final class Util
public static IceInternal.ProtocolPluginFacade
getProtocolPluginFacade(Communicator communicator)
{
- return new IceInternal.ProtocolPluginFacadeI(communicator);
+ return new IceInternal.ProtocolPluginFacadeI(communicator);
}
public static Identity
@@ -298,62 +298,62 @@ public final class Util
public static int
proxyIdentityCompare(ObjectPrx lhs, ObjectPrx rhs)
{
- if(lhs == null && rhs == null)
- {
- return 0;
- }
- else if(lhs == null && rhs != null)
- {
- return -1;
- }
- else if(lhs != null && rhs == null)
- {
- return 1;
- }
- else
- {
- Identity lhsIdentity = lhs.ice_getIdentity();
- Identity rhsIdentity = rhs.ice_getIdentity();
- int n;
- if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0)
- {
- return n;
- }
- return lhsIdentity.category.compareTo(rhsIdentity.category);
- }
+ if(lhs == null && rhs == null)
+ {
+ return 0;
+ }
+ else if(lhs == null && rhs != null)
+ {
+ return -1;
+ }
+ else if(lhs != null && rhs == null)
+ {
+ return 1;
+ }
+ else
+ {
+ Identity lhsIdentity = lhs.ice_getIdentity();
+ Identity rhsIdentity = rhs.ice_getIdentity();
+ int n;
+ if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0)
+ {
+ return n;
+ }
+ return lhsIdentity.category.compareTo(rhsIdentity.category);
+ }
}
public static int
proxyIdentityAndFacetCompare(ObjectPrx lhs, ObjectPrx rhs)
{
- if(lhs == null && rhs == null)
- {
- return 0;
- }
- else if(lhs == null && rhs != null)
- {
- return -1;
- }
- else if(lhs != null && rhs == null)
- {
- return 1;
- }
- else
- {
- Identity lhsIdentity = lhs.ice_getIdentity();
- Identity rhsIdentity = rhs.ice_getIdentity();
- int n;
- if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0)
- {
- return n;
- }
- if((n = lhsIdentity.category.compareTo(rhsIdentity.category)) != 0)
- {
- return n;
- }
-
- String lhsFacet = lhs.ice_getFacet();
- String rhsFacet = rhs.ice_getFacet();
+ if(lhs == null && rhs == null)
+ {
+ return 0;
+ }
+ else if(lhs == null && rhs != null)
+ {
+ return -1;
+ }
+ else if(lhs != null && rhs == null)
+ {
+ return 1;
+ }
+ else
+ {
+ Identity lhsIdentity = lhs.ice_getIdentity();
+ Identity rhsIdentity = rhs.ice_getIdentity();
+ int n;
+ if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0)
+ {
+ return n;
+ }
+ if((n = lhsIdentity.category.compareTo(rhsIdentity.category)) != 0)
+ {
+ return n;
+ }
+
+ String lhsFacet = lhs.ice_getFacet();
+ String rhsFacet = rhs.ice_getFacet();
if(lhsFacet == null && rhsFacet == null)
{
return 0;
@@ -367,7 +367,7 @@ public final class Util
return 1;
}
return lhsFacet.compareTo(rhsFacet);
- }
+ }
}
public static InputStream
@@ -386,26 +386,26 @@ public final class Util
getProcessLogger()
{
synchronized(_processLoggerMutex)
- {
- if(_processLogger == null)
- {
- //
- // TODO: Would be nice to be able to use process name as prefix by default.
- //
- _processLogger = new LoggerI("");
- }
-
- return _processLogger;
- }
+ {
+ if(_processLogger == null)
+ {
+ //
+ // TODO: Would be nice to be able to use process name as prefix by default.
+ //
+ _processLogger = new LoggerI("");
+ }
+
+ return _processLogger;
+ }
}
public static void
setProcessLogger(Logger logger)
{
synchronized(_processLoggerMutex)
- {
- _processLogger = logger;
- }
+ {
+ _processLogger = logger;
+ }
}
private static String _localAddress = null;
diff --git a/java/src/Ice/_AMD_Object_ice_invoke.java b/java/src/Ice/_AMD_Object_ice_invoke.java
index 57d6393ebd9..ee56a0db1f6 100644
--- a/java/src/Ice/_AMD_Object_ice_invoke.java
+++ b/java/src/Ice/_AMD_Object_ice_invoke.java
@@ -14,27 +14,27 @@ final class _AMD_Object_ice_invoke extends IceInternal.IncomingAsync implements
public
_AMD_Object_ice_invoke(IceInternal.Incoming in)
{
- super(in);
+ super(in);
}
public void
ice_response(boolean ok, byte[] outParams)
{
- try
- {
- __os().writeBlob(outParams);
- }
- catch(Ice.LocalException ex)
- {
- __exception(ex);
- return;
- }
- __response(ok);
+ try
+ {
+ __os().writeBlob(outParams);
+ }
+ catch(Ice.LocalException ex)
+ {
+ __exception(ex);
+ return;
+ }
+ __response(ok);
}
public void
ice_exception(java.lang.Exception ex)
{
- __exception(ex);
+ __exception(ex);
}
}
diff --git a/java/src/Ice/_ObjectDelD.java b/java/src/Ice/_ObjectDelD.java
index d0f70d69807..0d06e5b5851 100644
--- a/java/src/Ice/_ObjectDelD.java
+++ b/java/src/Ice/_ObjectDelD.java
@@ -22,7 +22,7 @@ public class _ObjectDelD implements _ObjectDel
IceInternal.Direct __direct = new IceInternal.Direct(__current);
try
{
- return __direct.servant().ice_isA(__id, __current);
+ return __direct.servant().ice_isA(__id, __current);
}
finally
{
@@ -42,8 +42,8 @@ public class _ObjectDelD implements _ObjectDel
IceInternal.Direct __direct = new IceInternal.Direct(__current);
try
{
- __direct.servant().ice_ping(__current);
- return;
+ __direct.servant().ice_ping(__current);
+ return;
}
finally
{
@@ -63,7 +63,7 @@ public class _ObjectDelD implements _ObjectDel
IceInternal.Direct __direct = new IceInternal.Direct(__current);
try
{
- return __direct.servant().ice_ids(__current);
+ return __direct.servant().ice_ids(__current);
}
finally
{
@@ -83,7 +83,7 @@ public class _ObjectDelD implements _ObjectDel
IceInternal.Direct __direct = new IceInternal.Direct(__current);
try
{
- return __direct.servant().ice_id(__current);
+ return __direct.servant().ice_id(__current);
}
finally
{
@@ -94,16 +94,16 @@ public class _ObjectDelD implements _ObjectDel
public boolean
ice_invoke(String operation, Ice.OperationMode mode, byte[] inParams, ByteSeqHolder outParams,
- java.util.Map context)
+ java.util.Map context)
throws IceInternal.LocalExceptionWrapper
{
- throw new CollocationOptimizationException();
+ throw new CollocationOptimizationException();
}
public ConnectionI
__getConnection(BooleanHolder compress)
{
- throw new CollocationOptimizationException();
+ throw new CollocationOptimizationException();
}
//
@@ -122,8 +122,8 @@ public class _ObjectDelD implements _ObjectDel
// upon initialization.
//
- assert(__reference == null);
- assert(__adapter == null);
+ assert(__reference == null);
+ assert(__adapter == null);
__reference = from.__reference;
__adapter = from.__adapter;
@@ -141,30 +141,30 @@ public class _ObjectDelD implements _ObjectDel
current.operation = op;
current.mode = mode;
- if(context != null)
- {
- current.ctx = context;
- }
- else
- {
- //
- // Implicit context
- //
- ImplicitContextI implicitContext =
- __reference.getInstance().getImplicitContext();
-
- java.util.Map prxContext = __reference.getContext();
-
- if(implicitContext == null)
- {
- current.ctx = new java.util.HashMap(prxContext);
- }
- else
- {
- current.ctx = implicitContext.combine(prxContext);
- }
- }
- current.requestId = -1;
+ if(context != null)
+ {
+ current.ctx = context;
+ }
+ else
+ {
+ //
+ // Implicit context
+ //
+ ImplicitContextI implicitContext =
+ __reference.getInstance().getImplicitContext();
+
+ java.util.Map prxContext = __reference.getContext();
+
+ if(implicitContext == null)
+ {
+ current.ctx = new java.util.HashMap(prxContext);
+ }
+ else
+ {
+ current.ctx = implicitContext.combine(prxContext);
+ }
+ }
+ current.requestId = -1;
}
public void
@@ -175,8 +175,8 @@ public class _ObjectDelD implements _ObjectDel
// upon initialization.
//
- assert(__reference == null);
- assert(__adapter == null);
+ assert(__reference == null);
+ assert(__adapter == null);
__reference = ref;
__adapter = adapter;
diff --git a/java/src/Ice/_ObjectDelM.java b/java/src/Ice/_ObjectDelM.java
index 094928e707f..b37bd91733e 100644
--- a/java/src/Ice/_ObjectDelM.java
+++ b/java/src/Ice/_ObjectDelM.java
@@ -15,44 +15,44 @@ public class _ObjectDelM implements _ObjectDel
ice_isA(String __id, java.util.Map __context)
throws IceInternal.LocalExceptionWrapper
{
- IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_isA", OperationMode.Nonmutating,
- __context, __compress);
+ IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_isA", OperationMode.Nonmutating,
+ __context, __compress);
try
{
- try
- {
- IceInternal.BasicStream __os = __og.os();
- __os.writeString(__id);
- }
- catch(LocalException __ex)
- {
- __og.abort(__ex);
- }
- boolean __ok = __og.invoke();
- try
- {
- IceInternal.BasicStream __is = __og.is();
- if(!__ok)
- {
- try
- {
- __is.throwException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name());
- }
- }
- return __is.readBool();
- }
- catch(LocalException __ex)
- {
- throw new IceInternal.LocalExceptionWrapper(__ex, false);
- }
+ try
+ {
+ IceInternal.BasicStream __os = __og.os();
+ __os.writeString(__id);
+ }
+ catch(LocalException __ex)
+ {
+ __og.abort(__ex);
+ }
+ boolean __ok = __og.invoke();
+ try
+ {
+ IceInternal.BasicStream __is = __og.is();
+ if(!__ok)
+ {
+ try
+ {
+ __is.throwException();
+ }
+ catch(UserException __ex)
+ {
+ throw new UnknownUserException(__ex.ice_name());
+ }
+ }
+ return __is.readBool();
+ }
+ catch(LocalException __ex)
+ {
+ throw new IceInternal.LocalExceptionWrapper(__ex, false);
+ }
}
finally
{
- __connection.reclaimOutgoing(__og);
+ __connection.reclaimOutgoing(__og);
}
}
@@ -60,34 +60,34 @@ public class _ObjectDelM implements _ObjectDel
ice_ping(java.util.Map __context)
throws IceInternal.LocalExceptionWrapper
{
- IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_ping", OperationMode.Nonmutating,
- __context, __compress);
+ IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_ping", OperationMode.Nonmutating,
+ __context, __compress);
try
{
- boolean __ok = __og.invoke();
- try
- {
- IceInternal.BasicStream __is = __og.is();
- if(!__ok)
- {
- try
- {
- __is.throwException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name());
- }
- }
- }
- catch(LocalException __ex)
- {
- throw new IceInternal.LocalExceptionWrapper(__ex, false);
- }
+ boolean __ok = __og.invoke();
+ try
+ {
+ IceInternal.BasicStream __is = __og.is();
+ if(!__ok)
+ {
+ try
+ {
+ __is.throwException();
+ }
+ catch(UserException __ex)
+ {
+ throw new UnknownUserException(__ex.ice_name());
+ }
+ }
+ }
+ catch(LocalException __ex)
+ {
+ throw new IceInternal.LocalExceptionWrapper(__ex, false);
+ }
}
finally
{
- __connection.reclaimOutgoing(__og);
+ __connection.reclaimOutgoing(__og);
}
}
@@ -95,35 +95,35 @@ public class _ObjectDelM implements _ObjectDel
ice_ids(java.util.Map __context)
throws IceInternal.LocalExceptionWrapper
{
- IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_ids", OperationMode.Nonmutating,
- __context, __compress);
+ IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_ids", OperationMode.Nonmutating,
+ __context, __compress);
try
{
- boolean __ok = __og.invoke();
- try
- {
- IceInternal.BasicStream __is = __og.is();
- if(!__ok)
- {
- try
- {
- __is.throwException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name());
- }
- }
- return __is.readStringSeq();
- }
- catch(LocalException __ex)
- {
- throw new IceInternal.LocalExceptionWrapper(__ex, false);
- }
+ boolean __ok = __og.invoke();
+ try
+ {
+ IceInternal.BasicStream __is = __og.is();
+ if(!__ok)
+ {
+ try
+ {
+ __is.throwException();
+ }
+ catch(UserException __ex)
+ {
+ throw new UnknownUserException(__ex.ice_name());
+ }
+ }
+ return __is.readStringSeq();
+ }
+ catch(LocalException __ex)
+ {
+ throw new IceInternal.LocalExceptionWrapper(__ex, false);
+ }
}
finally
{
- __connection.reclaimOutgoing(__og);
+ __connection.reclaimOutgoing(__og);
}
}
@@ -131,35 +131,35 @@ public class _ObjectDelM implements _ObjectDel
ice_id(java.util.Map __context)
throws IceInternal.LocalExceptionWrapper
{
- IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_id", OperationMode.Nonmutating,
- __context, __compress);
+ IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_id", OperationMode.Nonmutating,
+ __context, __compress);
try
{
- boolean __ok = __og.invoke();
- try
- {
- IceInternal.BasicStream __is = __og.is();
- if(!__ok)
- {
- try
- {
- __is.throwException();
- }
- catch(UserException __ex)
- {
- throw new UnknownUserException(__ex.ice_name());
- }
- }
- return __is.readString();
- }
- catch(LocalException __ex)
- {
- throw new IceInternal.LocalExceptionWrapper(__ex, false);
- }
+ boolean __ok = __og.invoke();
+ try
+ {
+ IceInternal.BasicStream __is = __og.is();
+ if(!__ok)
+ {
+ try
+ {
+ __is.throwException();
+ }
+ catch(UserException __ex)
+ {
+ throw new UnknownUserException(__ex.ice_name());
+ }
+ }
+ return __is.readString();
+ }
+ catch(LocalException __ex)
+ {
+ throw new IceInternal.LocalExceptionWrapper(__ex, false);
+ }
}
finally
{
- __connection.reclaimOutgoing(__og);
+ __connection.reclaimOutgoing(__og);
}
}
@@ -167,20 +167,20 @@ public class _ObjectDelM implements _ObjectDel
ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams, java.util.Map __context)
throws IceInternal.LocalExceptionWrapper
{
- IceInternal.Outgoing __og = __connection.getOutgoing(__reference, operation, mode, __context, __compress);
+ IceInternal.Outgoing __og = __connection.getOutgoing(__reference, operation, mode, __context, __compress);
try
{
if(inParams != null)
{
- try
- {
- IceInternal.BasicStream __os = __og.os();
- __os.writeBlob(inParams);
- }
- catch(LocalException __ex)
- {
- __og.abort(__ex);
- }
+ try
+ {
+ IceInternal.BasicStream __os = __og.os();
+ __os.writeBlob(inParams);
+ }
+ catch(LocalException __ex)
+ {
+ __og.abort(__ex);
+ }
}
boolean ok = __og.invoke();
if(__reference.getMode() == IceInternal.Reference.ModeTwoway)
@@ -203,15 +203,15 @@ public class _ObjectDelM implements _ObjectDel
}
finally
{
- __connection.reclaimOutgoing(__og);
+ __connection.reclaimOutgoing(__og);
}
}
public ConnectionI
__getConnection(BooleanHolder compress)
{
- compress.value = __compress;
- return __connection;
+ compress.value = __compress;
+ return __connection;
}
//
@@ -230,8 +230,8 @@ public class _ObjectDelM implements _ObjectDel
// upon initialization.
//
- assert(__reference == null);
- assert(__connection == null);
+ assert(__reference == null);
+ assert(__connection == null);
__reference = from.__reference;
__connection = from.__connection;
@@ -250,12 +250,12 @@ public class _ObjectDelM implements _ObjectDel
// upon initialization.
//
- assert(__reference == null);
- assert(__connection == null);
+ assert(__reference == null);
+ assert(__connection == null);
- __reference = ref;
- BooleanHolder compress = new BooleanHolder();
- __connection = __reference.getConnection(compress);
+ __reference = ref;
+ BooleanHolder compress = new BooleanHolder();
+ __connection = __reference.getConnection(compress);
__compress = compress.value;
}
}