summaryrefslogtreecommitdiff
path: root/java/src/Ice/CommunicatorI.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/Ice/CommunicatorI.java')
-rw-r--r--java/src/Ice/CommunicatorI.java42
1 files changed, 23 insertions, 19 deletions
diff --git a/java/src/Ice/CommunicatorI.java b/java/src/Ice/CommunicatorI.java
index e9eaffc97d2..cdcce594075 100644
--- a/java/src/Ice/CommunicatorI.java
+++ b/java/src/Ice/CommunicatorI.java
@@ -15,12 +15,14 @@ class CommunicatorI implements Communicator
public synchronized void
destroy()
{
- if(_instance != null)
+ if(!_destroyed) // Don't destroy twice.
{
- _serverThreadPool = null;
+ _destroyed = true;
+
_instance.objectAdapterFactory().shutdown();
_instance.destroy();
- _instance = null;
+
+ _serverThreadPool = null;
}
}
@@ -52,7 +54,7 @@ class CommunicatorI implements Communicator
public synchronized Ice.ObjectPrx
stringToProxy(String s)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -62,7 +64,7 @@ class CommunicatorI implements Communicator
public synchronized String
proxyToString(Ice.ObjectPrx proxy)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -72,7 +74,7 @@ class CommunicatorI implements Communicator
public synchronized ObjectAdapter
createObjectAdapter(String name)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -97,7 +99,7 @@ class CommunicatorI implements Communicator
public synchronized ObjectAdapter
createObjectAdapterFromProperty(String name, String property)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -110,7 +112,7 @@ class CommunicatorI implements Communicator
public synchronized ObjectAdapter
createObjectAdapterWithEndpoints(String name, String endpts)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -133,7 +135,7 @@ class CommunicatorI implements Communicator
public synchronized void
addObjectFactory(ObjectFactory factory, String id)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -143,7 +145,7 @@ class CommunicatorI implements Communicator
public synchronized void
removeObjectFactory(String id)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -153,7 +155,7 @@ class CommunicatorI implements Communicator
public synchronized ObjectFactory
findObjectFactory(String id)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -163,7 +165,7 @@ class CommunicatorI implements Communicator
public synchronized void
addUserExceptionFactory(UserExceptionFactory factory, String id)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -173,7 +175,7 @@ class CommunicatorI implements Communicator
public synchronized void
removeUserExceptionFactory(String id)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -183,7 +185,7 @@ class CommunicatorI implements Communicator
public synchronized UserExceptionFactory
findUserExceptionFactory(String id)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -193,7 +195,7 @@ class CommunicatorI implements Communicator
public synchronized Properties
getProperties()
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -203,7 +205,7 @@ class CommunicatorI implements Communicator
public synchronized Logger
getLogger()
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -213,7 +215,7 @@ class CommunicatorI implements Communicator
public synchronized void
setLogger(Logger logger)
{
- if(_instance == null)
+ if(_destroyed)
{
throw new CommunicatorDestroyedException();
}
@@ -240,6 +242,7 @@ class CommunicatorI implements Communicator
CommunicatorI(StringSeqHolder args, Properties properties)
{
+ _destroyed = false;
_instance = new IceInternal.Instance(this, args, properties);
}
@@ -247,9 +250,9 @@ class CommunicatorI implements Communicator
finalize()
throws Throwable
{
- if(_instance != null)
+ if(!_destroyed)
{
- _instance.logger().warning("communicator has not been destroyed");
+ _instance.logger().warning("Ice::Communicator::destroy() has not been called");
}
super.finalize();
@@ -274,6 +277,7 @@ class CommunicatorI implements Communicator
return _instance;
}
+ private boolean _destroyed;
private IceInternal.Instance _instance;
//