diff options
Diffstat (limited to 'java/src/Ice/CommunicatorI.java')
-rw-r--r-- | java/src/Ice/CommunicatorI.java | 159 |
1 files changed, 18 insertions, 141 deletions
diff --git a/java/src/Ice/CommunicatorI.java b/java/src/Ice/CommunicatorI.java index 19ef3d103e0..d041bddd45e 100644 --- a/java/src/Ice/CommunicatorI.java +++ b/java/src/Ice/CommunicatorI.java @@ -14,96 +14,36 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator public void destroy() { - IceInternal.Instance instance = null; - - synchronized(this) - { - if(_destroyed) // Don't destroy twice. - { - return; - } - _destroyed = true; - instance = _instance; - } - - if(instance != null) - { - instance.destroy(); - } + _instance.destroy(); } public void shutdown() { - IceInternal.ObjectAdapterFactory objectAdapterFactory; - - synchronized(this) - { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } - objectAdapterFactory = _instance.objectAdapterFactory(); - } - - // - // We must call shutdown on the object adapter factory - // outside the synchronization, otherwise the communicator is - // blocked while we wait for shutdown. - // - objectAdapterFactory.shutdown(); + _instance.objectAdapterFactory().shutdown(); } public void waitForShutdown() { - IceInternal.ObjectAdapterFactory objectAdapterFactory; - - synchronized(this) - { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } - objectAdapterFactory = _instance.objectAdapterFactory(); - } - - // - // We must call waitForShutdown on the object adapter factory - // outside the synchronization, otherwise the communicator is - // blocked while we wait for shutdown. - // - objectAdapterFactory.waitForShutdown(); + _instance.objectAdapterFactory().waitForShutdown(); } - public synchronized Ice.ObjectPrx + public Ice.ObjectPrx stringToProxy(String s) { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } return _instance.proxyFactory().stringToProxy(s); } - public synchronized String + public String proxyToString(Ice.ObjectPrx proxy) { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } return _instance.proxyFactory().proxyToString(proxy); } - public synchronized ObjectAdapter + public ObjectAdapter createObjectAdapter(String name) { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } - return _instance.objectAdapterFactory().createObjectAdapter(name); } @@ -119,6 +59,7 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator } catch(AlreadyRegisteredException ex) { + // XXX: Why this? if(originalValue.length() != 0) { getProperties().setProperty(propertyKey, originalValue); @@ -127,144 +68,87 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator } } - public synchronized void + public void addObjectFactory(ObjectFactory factory, String id) { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } _instance.servantFactoryManager().add(factory, id); } - public synchronized void + public void removeObjectFactory(String id) { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } _instance.servantFactoryManager().remove(id); } - public synchronized ObjectFactory + public ObjectFactory findObjectFactory(String id) { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } return _instance.servantFactoryManager().find(id); } public Properties getProperties() { - // - // No check for destruction. It must be possible to access the - // properties after destruction. - // return _instance.properties(); } public Logger getLogger() { - // - // No check for destruction. It must be possible to access the - // logger after destruction. - // return _instance.logger(); } public void setLogger(Logger logger) { - // - // No check for destruction. It must be possible to set the - // logger after destruction (needed by logger plugins for - // example to unset the logger). - // _instance.logger(logger); } - public synchronized Stats + public Stats getStats() { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } return _instance.stats(); } - public synchronized void + public void setStats(Stats stats) { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } _instance.stats(stats); } - public synchronized RouterPrx + public RouterPrx getDefaultRouter() { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } return _instance.referenceFactory().getDefaultRouter(); } - public synchronized void + public void setDefaultRouter(RouterPrx router) { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } _instance.referenceFactory().setDefaultRouter(router); } - public synchronized LocatorPrx + public LocatorPrx getDefaultLocator() { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } return _instance.referenceFactory().getDefaultLocator(); } - public synchronized void + public void setDefaultLocator(LocatorPrx locator) { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } _instance.referenceFactory().setDefaultLocator(locator); } - public synchronized java.util.Map + public java.util.Map getDefaultContext() { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } return _instance.getDefaultContext(); } - public synchronized void + public void setDefaultContext(java.util.Map ctx) { - if(_destroyed) - { - throw new CommunicatorDestroyedException(); - } _instance.setDefaultContext(ctx); } @@ -282,7 +166,6 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator CommunicatorI(Properties properties) { - _destroyed = false; _instance = new IceInternal.Instance(this, properties); } @@ -317,11 +200,6 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator catch(RuntimeException ex) { _instance.destroy(); - _instance = null; - synchronized(this) - { - _destroyed = true; - } throw ex; } } @@ -335,6 +213,5 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator return _instance; } - private boolean _destroyed; private IceInternal.Instance _instance; } |