diff options
author | Matthew Newhook <matthew@zeroc.com> | 2014-08-07 14:36:07 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2014-08-07 14:36:07 -0230 |
commit | b36ae21c88735cbd2c39c5ccde2572a8fcc4e928 (patch) | |
tree | dfd5eee6e7d61a9c6efcbaabe916639009aaa9af /java/src/IceInternal/ConnectionRequestHandler.java | |
parent | Add @Override where possible, and remove trailing white space. (diff) | |
download | ice-b36ae21c88735cbd2c39c5ccde2572a8fcc4e928.tar.bz2 ice-b36ae21c88735cbd2c39c5ccde2572a8fcc4e928.tar.xz ice-b36ae21c88735cbd2c39c5ccde2572a8fcc4e928.zip |
ICE-1593 Handling thread interrupts in Java
- Added Ice.BackgroundIO property to perform all IO in a non-user
thread. This makes Ice for Java interrupt safe. This is implemented
by the QueueRequestHanbler.
- EndpointHostResolver now uses an executor instead of a thread.
- Added java/demo/Ice/interrupt and java/test/Ice/interrupt.
- Made several changes that must be ported to C++ & C#.
- InvocationTimeout exceptions can hang forever.
- Connection establishment is always asynchronous.
- RequestHandler.requestTimeout and asyncRequestTimeout have been
renamed to requestCancel and asyncRequestCancel.
Diffstat (limited to 'java/src/IceInternal/ConnectionRequestHandler.java')
-rw-r--r-- | java/src/IceInternal/ConnectionRequestHandler.java | 63 |
1 files changed, 23 insertions, 40 deletions
diff --git a/java/src/IceInternal/ConnectionRequestHandler.java b/java/src/IceInternal/ConnectionRequestHandler.java index 8d44be04e5b..4dcf9db63e8 100644 --- a/java/src/IceInternal/ConnectionRequestHandler.java +++ b/java/src/IceInternal/ConnectionRequestHandler.java @@ -13,54 +13,51 @@ public class ConnectionRequestHandler implements RequestHandler { @Override public void - prepareBatchRequest(BasicStream out) - throws RetryException - { + prepareBatchRequest(BasicStream out) throws RetryException { _connection.prepareBatchRequest(out); } @Override public void - finishBatchRequest(BasicStream out) - { + finishBatchRequest(BasicStream out) { _connection.finishBatchRequest(out, _compress); } @Override public void - abortBatchRequest() - { + abortBatchRequest() { _connection.abortBatchRequest(); } @Override public boolean sendRequest(OutgoingMessageCallback out) - throws RetryException - { - return out.send(_connection, _compress, _response) && !_response; // Finished if sent and no response + throws RetryException { + // + // Finished if sent and no response. + // + return out.send(_connection, _compress, _response) && !_response; } @Override public int sendAsyncRequest(OutgoingAsyncMessageCallback out) - throws RetryException - { + throws RetryException { return out.__send(_connection, _compress, _response); } @Override - public void - requestTimedOut(OutgoingMessageCallback out) + public boolean + requestCanceled(OutgoingMessageCallback out, Ice.LocalException ex) { - _connection.requestTimedOut(out); + return _connection.requestCanceled(out, ex); } @Override - public void - asyncRequestTimedOut(OutgoingAsyncMessageCallback outAsync) + public boolean + asyncRequestCanceled(OutgoingAsyncMessageCallback outgoingAsync, Ice.LocalException ex) { - _connection.asyncRequestTimedOut(outAsync); + return _connection.asyncRequestCanceled(outgoingAsync, ex); } @Override @@ -72,35 +69,20 @@ public class ConnectionRequestHandler implements RequestHandler @Override public Ice.ConnectionI - getConnection(boolean wait) + getConnection() { return _connection; } - public - ConnectionRequestHandler(Reference ref, Ice.ObjectPrx proxy) + @Override + public Ice.ConnectionI + waitForConnection() { - _reference = ref; - _response = _reference.getMode() == Reference.ModeTwoway; - - Ice.BooleanHolder compress = new Ice.BooleanHolder(); - _connection = _reference.getConnection(compress); - _compress = compress.value; - - // - // If this proxy is for a non-local object, and we are using a router, then - // add this proxy to the router info object. - // - IceInternal.RouterInfo ri = _reference.getRouterInfo(); - if(ri != null) - { - ri.addProxy(proxy); - } + return _connection; } - public - ConnectionRequestHandler(Reference ref, Ice.ConnectionI connection, boolean compress) - { + public ConnectionRequestHandler(Reference ref, Ice.ConnectionI connection, + boolean compress) { _reference = ref; _response = _reference.getMode() == Reference.ModeTwoway; _connection = connection; @@ -111,4 +93,5 @@ public class ConnectionRequestHandler implements RequestHandler private final boolean _response; private final Ice.ConnectionI _connection; private final boolean _compress; + } |