diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/AsyncResult.java | 16 | ||||
-rw-r--r-- | java/src/IceInternal/BatchOutgoingAsync.java | 1 | ||||
-rw-r--r-- | java/src/IceInternal/ConnectRequestHandler.java | 8 | ||||
-rw-r--r-- | java/src/IceInternal/DispatchWorkItem.java | 13 | ||||
-rw-r--r-- | java/src/IceInternal/OutgoingAsync.java | 1 |
5 files changed, 31 insertions, 8 deletions
diff --git a/java/src/Ice/AsyncResult.java b/java/src/Ice/AsyncResult.java index 706616fe32f..d3146d1533f 100644 --- a/java/src/Ice/AsyncResult.java +++ b/java/src/Ice/AsyncResult.java @@ -252,7 +252,7 @@ public class AsyncResult // try { - _instance.clientThreadPool().execute(new IceInternal.DispatchWorkItem() + _instance.clientThreadPool().execute(new IceInternal.DispatchWorkItem(_cachedConnection) { public void run() @@ -370,7 +370,7 @@ public class AsyncResult // try { - _instance.clientThreadPool().execute(new IceInternal.DispatchWorkItem() + _instance.clientThreadPool().execute(new IceInternal.DispatchWorkItem(_cachedConnection) { public void run() @@ -489,8 +489,17 @@ public class AsyncResult if(handler != null) { final IceInternal.RequestHandler h = handler; + Ice.Connection connection = null; + try + { + connection = handler.getConnection(false); + } + catch(Ice.LocalException e) + { + // Ignore. + } _instance.clientThreadPool().execute( - new IceInternal.DispatchWorkItem() + new IceInternal.DispatchWorkItem(connection) { public void run() @@ -519,6 +528,7 @@ public class AsyncResult protected Communicator _communicator; protected IceInternal.Instance _instance; protected String _operation; + protected Ice.Connection _cachedConnection; protected java.lang.Object _monitor = new java.lang.Object(); protected IceInternal.BasicStream _is; diff --git a/java/src/IceInternal/BatchOutgoingAsync.java b/java/src/IceInternal/BatchOutgoingAsync.java index ad289e019fb..2b08cb9aa04 100644 --- a/java/src/IceInternal/BatchOutgoingAsync.java +++ b/java/src/IceInternal/BatchOutgoingAsync.java @@ -19,6 +19,7 @@ public class BatchOutgoingAsync extends Ice.AsyncResult implements OutgoingAsync public int __send(Ice.ConnectionI connection, boolean compress, boolean response) { + _cachedConnection = connection; return connection.flushAsyncBatchRequests(this); } diff --git a/java/src/IceInternal/ConnectRequestHandler.java b/java/src/IceInternal/ConnectRequestHandler.java index 8b2f346a997..0505688cdda 100644 --- a/java/src/IceInternal/ConnectRequestHandler.java +++ b/java/src/IceInternal/ConnectRequestHandler.java @@ -333,7 +333,7 @@ public class ConnectRequestHandler // if(!_requests.isEmpty()) { - _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem() + _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem(_connection) { public void run() @@ -487,7 +487,7 @@ public class ConnectRequestHandler { assert(_exception == null && !_requests.isEmpty()); _exception = ex.get(); - _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem() + _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem(_connection) { public void run() @@ -503,7 +503,7 @@ public class ConnectRequestHandler { assert(_exception == null && !_requests.isEmpty()); _exception = ex; - _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem() + _reference.getInstance().clientThreadPool().execute(new DispatchWorkItem(_connection) { public void run() @@ -517,7 +517,7 @@ public class ConnectRequestHandler if(!sentCallbacks.isEmpty()) { _reference.getInstance().clientThreadPool().execute( - new DispatchWorkItem() + new DispatchWorkItem(_connection) { public void run() diff --git a/java/src/IceInternal/DispatchWorkItem.java b/java/src/IceInternal/DispatchWorkItem.java index 84a9c438453..a7c5ef7fa57 100644 --- a/java/src/IceInternal/DispatchWorkItem.java +++ b/java/src/IceInternal/DispatchWorkItem.java @@ -17,6 +17,15 @@ package IceInternal; // abstract public class DispatchWorkItem implements ThreadPoolWorkItem, Runnable { + public DispatchWorkItem() + { + } + + public DispatchWorkItem(Ice.Connection connection) + { + _connection = connection; + } + final public void execute(ThreadPoolCurrent current) { Instance instance = current.stream.instance(); @@ -25,7 +34,7 @@ abstract public class DispatchWorkItem implements ThreadPoolWorkItem, Runnable { try { - dispatcher.dispatch(this, null); + dispatcher.dispatch(this, _connection); } catch(java.lang.Exception ex) { @@ -45,4 +54,6 @@ abstract public class DispatchWorkItem implements ThreadPoolWorkItem, Runnable this.run(); } } + + private Ice.Connection _connection; } diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java index 9d18c397d6a..38e2eea29d7 100644 --- a/java/src/IceInternal/OutgoingAsync.java +++ b/java/src/IceInternal/OutgoingAsync.java @@ -103,6 +103,7 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa __send(Ice.ConnectionI connection, boolean compress, boolean response) throws RetryException { + _cachedConnection = connection; return connection.sendAsyncRequest(this, compress, response); } |