summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/ConnectRequestHandler.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-10-10 12:03:07 +0200
committerBenoit Foucher <benoit@zeroc.com>2014-10-10 12:03:07 +0200
commit570455a381e6620f8ddfcca448559d3fa545ba38 (patch)
treefe3fa45e6a643b473d9370babff6224b1a9d4dcb /java/src/IceInternal/ConnectRequestHandler.java
parentFixed ICE-5726: provide deprecated public StringConverterPlugin (diff)
downloadice-570455a381e6620f8ddfcca448559d3fa545ba38.tar.bz2
ice-570455a381e6620f8ddfcca448559d3fa545ba38.tar.xz
ice-570455a381e6620f8ddfcca448559d3fa545ba38.zip
Fixed invocation timeouts/interrupt issues, addded AsyncResult.cancel()
Diffstat (limited to 'java/src/IceInternal/ConnectRequestHandler.java')
-rw-r--r--java/src/IceInternal/ConnectRequestHandler.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/java/src/IceInternal/ConnectRequestHandler.java b/java/src/IceInternal/ConnectRequestHandler.java
index 91957af1a0c..e4c1e6b1727 100644
--- a/java/src/IceInternal/ConnectRequestHandler.java
+++ b/java/src/IceInternal/ConnectRequestHandler.java
@@ -22,12 +22,12 @@ public class ConnectRequestHandler
this.os.swap(os);
}
- Request(OutgoingAsyncMessageCallback out)
+ Request(OutgoingAsyncBase out)
{
this.outAsync = out;
}
- OutgoingAsyncMessageCallback outAsync = null;
+ OutgoingAsyncBase outAsync = null;
BasicStream os = null;
}
@@ -149,7 +149,7 @@ public class ConnectRequestHandler
@Override
public int
- sendAsyncRequest(OutgoingAsyncMessageCallback out)
+ sendAsyncRequest(OutgoingAsyncBase out)
throws RetryException
{
synchronized(this)
@@ -159,6 +159,7 @@ public class ConnectRequestHandler
if(!initialized())
{
_requests.add(new Request(out));
+ out.cancelable(this);
return AsyncStatus.Queued;
}
}
@@ -171,14 +172,14 @@ public class ConnectRequestHandler
}
@Override
- public boolean
- asyncRequestCanceled(OutgoingAsyncMessageCallback outAsync, Ice.LocalException ex)
+ public void
+ asyncRequestCanceled(OutgoingAsyncBase outAsync, Ice.LocalException ex)
{
synchronized(this)
{
if(_exception != null)
{
- return false; // The request has been notified of a failure already.
+ return; // The request has been notified of a failure already.
}
if(!initialized())
@@ -190,14 +191,17 @@ public class ConnectRequestHandler
if(request.outAsync == outAsync)
{
it.remove();
- outAsync.dispatchInvocationCancel(ex, _reference.getInstance().clientThreadPool(), null);
- return true; // We're done
+ if(outAsync.completed(ex))
+ {
+ outAsync.invokeCompletedAsync();
+ }
+ return;
}
}
assert(false); // The request has to be queued if it timed out and we're not initialized yet.
}
}
- return _connection.asyncRequestCanceled(outAsync, ex);
+ _connection.asyncRequestCanceled(outAsync, ex);
}
@Override
@@ -394,8 +398,7 @@ public class ConnectRequestHandler
_flushing = true;
}
- final java.util.List<OutgoingAsyncMessageCallback> sentCallbacks =
- new java.util.ArrayList<OutgoingAsyncMessageCallback>();
+ final java.util.List<OutgoingAsyncBase> sentCallbacks = new java.util.ArrayList<OutgoingAsyncBase>();
try
{
java.util.Iterator<Request> p = _requests.iterator(); // _requests is immutable when _flushing = true
@@ -476,7 +479,7 @@ public class ConnectRequestHandler
@Override
public void run()
{
- for(OutgoingAsyncMessageCallback callback : sentCallbacks)
+ for(OutgoingAsyncBase callback : sentCallbacks)
{
callback.invokeSent();
}
@@ -546,7 +549,10 @@ public class ConnectRequestHandler
{
if(request.outAsync != null)
{
- request.outAsync.finished(_exception);
+ if(request.outAsync.completed(_exception))
+ {
+ request.outAsync.invokeCompleted();
+ }
}
}
_requests.clear();