summaryrefslogtreecommitdiff
path: root/java/src/Ice/ObjectAdapterI.java
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-08-24 05:37:28 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-08-24 05:37:28 +0000
commitedebcc852d28935a734e2e589fc43a9013f98944 (patch)
tree83a1333a883e8b0b8cfb8dd6b5cf5f8b43a639c3 /java/src/Ice/ObjectAdapterI.java
parentsynchronized java & C++ version of ObjectAdapter::deactivate. Use (diff)
downloadice-edebcc852d28935a734e2e589fc43a9013f98944.tar.bz2
ice-edebcc852d28935a734e2e589fc43a9013f98944.tar.xz
ice-edebcc852d28935a734e2e589fc43a9013f98944.zip
Synchronized java & C++ version of ObjectAdapter::deactivate
Diffstat (limited to 'java/src/Ice/ObjectAdapterI.java')
-rw-r--r--java/src/Ice/ObjectAdapterI.java50
1 files changed, 34 insertions, 16 deletions
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java
index 20274d2c554..227255d1def 100644
--- a/java/src/Ice/ObjectAdapterI.java
+++ b/java/src/Ice/ObjectAdapterI.java
@@ -178,31 +178,49 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt
}
}
- public synchronized void
+ public void
deactivate()
{
- //
- // Ignore deactivation requests if the object adapter has
- // already been deactivated.
- //
- if(_deactivated)
+ IceInternal.OutgoingConnectionFactory outgoingConnectionFactory;
+ java.util.ArrayList incomingConnectionFactories;
+ synchronized(this)
{
- return;
+ //
+ // Ignore deactivation requests if the object adapter has
+ // already been deactivated.
+ //
+ if(_deactivated)
+ {
+ return;
+ }
+
+ incomingConnectionFactories = new java.util.ArrayList(_incomingConnectionFactories);
+ outgoingConnectionFactory = _instance.outgoingConnectionFactory();
+
+ _deactivated = true;
+
+ notifyAll();
}
-
- final int sz = _incomingConnectionFactories.size();
+
+ //
+ // 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);
+ (IceInternal.IncomingConnectionFactory)incomingConnectionFactories.get(i);
factory.destroy();
}
-
- _instance.outgoingConnectionFactory().removeAdapter(this);
-
- _deactivated = true;
-
- notifyAll();
+
+ //
+ // 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