summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2003-01-15 17:54:24 +0000
committerMarc Laukien <marc@zeroc.com>2003-01-15 17:54:24 +0000
commit18c4fbd25a501d244f281ba0c760472229b3b250 (patch)
tree52c1e8ff33c2d05e48fbd6171ed092608d9ce82a /java/src
parentfixed inc/decProxyCount & async requests (diff)
downloadice-18c4fbd25a501d244f281ba0c760472229b3b250.tar.bz2
ice-18c4fbd25a501d244f281ba0c760472229b3b250.tar.xz
ice-18c4fbd25a501d244f281ba0c760472229b3b250.zip
fixed inc/decProxyCount & async requests
Diffstat (limited to 'java/src')
-rw-r--r--java/src/IceInternal/Connection.java22
-rw-r--r--java/src/IceInternal/OutgoingAsync.java3
2 files changed, 22 insertions, 3 deletions
diff --git a/java/src/IceInternal/Connection.java b/java/src/IceInternal/Connection.java
index e2835e9f8dd..9f0e91cebec 100644
--- a/java/src/IceInternal/Connection.java
+++ b/java/src/IceInternal/Connection.java
@@ -176,10 +176,16 @@ public final class Connection extends EventHandler
{
assert(_proxyCount > 0);
--_proxyCount;
- if(_proxyCount == 0 && _adapter == null)
+
+ //
+ // We close the connection if
+ // - no proxy uses this connection anymore; and
+ // - there are not outstanding asynchronous requests; and
+ // - this is an outgoing connection only.
+ //
+ if(_proxyCount == 0 && _asyncRequests.isEmpty() && _adapter == null)
{
assert(_requests.isEmpty());
- assert(_asyncRequests.isEmpty());
setState(StateClosing, new Ice.CloseConnectionException());
}
}
@@ -661,6 +667,18 @@ public final class Connection extends EventHandler
{
throw new Ice.UnknownRequestIdException();
}
+
+ //
+ // We close the connection if
+ // - no proxy uses this connection anymore; and
+ // - there are not outstanding asynchronous requests; and
+ // - this is an outgoing connection only.
+ //
+ if(_proxyCount == 0 && _asyncRequests.isEmpty() && _adapter == null)
+ {
+ assert(_requests.isEmpty());
+ setState(StateClosing, new Ice.CloseConnectionException());
+ }
}
break;
}
diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java
index 7eee5b266f4..5f10f877b4c 100644
--- a/java/src/IceInternal/OutgoingAsync.java
+++ b/java/src/IceInternal/OutgoingAsync.java
@@ -95,9 +95,10 @@ public abstract class OutgoingAsync
{
_connection.sendAsyncRequest(this);
}
- finally
+ catch(RuntimeException ex)
{
destroy();
+ throw ex;
}
}