diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-12-12 10:03:29 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-12-12 10:03:29 +0100 |
commit | 15243f5d52cbcef1c2bcddbdfe1faa5fcf83c0a7 (patch) | |
tree | cfb55a8b546ac3abb6a0b5542bb1f7b5eb794815 /java/src | |
parent | Bump expect/expectall default timeouts (diff) | |
download | ice-15243f5d52cbcef1c2bcddbdfe1faa5fcf83c0a7.tar.bz2 ice-15243f5d52cbcef1c2bcddbdfe1faa5fcf83c0a7.tar.xz ice-15243f5d52cbcef1c2bcddbdfe1faa5fcf83c0a7.zip |
Fixed ICE-6142: oneway batch operations didn't throw
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java | 84 |
1 files changed, 36 insertions, 48 deletions
diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java b/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java index ab84fb56331..aee1688ac58 100644 --- a/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java +++ b/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java @@ -87,18 +87,12 @@ public class ConnectRequestHandler synchronized(this) { waitBatchRequestInProgress(); - try - { - if(!initialized()) - { - _batchRequestInProgress = true; - _batchStream.swap(os); - return; - } - } - catch(Ice.LocalException ex) + + if(!initialized()) { - throw new RetryException(ex); + _batchRequestInProgress = true; + _batchStream.swap(os); + return; } } @@ -410,43 +404,13 @@ public class ConnectRequestHandler final java.util.List<OutgoingAsyncBase> sentCallbacks = new java.util.ArrayList<OutgoingAsyncBase>(); java.util.Iterator<Request> p = _requests.iterator(); // _requests is immutable when _flushing = true + Ice.LocalException exception = null; while(p.hasNext()) { Request request = p.next(); - if(request.outAsync != null) - { - try - { - if((request.outAsync.send(_connection, _compress, _response) & - AsyncStatus.InvokeSentCallback) > 0) - { - request.outAsync.invokeSentAsync(); - } - } - catch(RetryException ex) - { - try - { - // Remove the request handler before retrying. - _reference.getInstance().requestHandlerFactory().removeRequestHandler(_reference, this); - } - catch(Ice.CommunicatorDestroyedException exc) - { - // Ignore - } - request.outAsync.retryException(ex.get()); - } - catch(Ice.Exception ex) - { - if(request.outAsync.completed(ex)) - { - request.outAsync.invokeCompletedAsync(); - } - } - } - else + try { - try + if(request.os != null) { BasicStream os = new BasicStream(request.os.instance(), Protocol.currentProtocolEncoding); _connection.prepareBatchRequest(os); @@ -462,11 +426,34 @@ public class ConnectRequestHandler } _connection.finishBatchRequest(os, _compress); } - catch(RetryException ex) + else if((request.outAsync.send(_connection, _compress, _response) & AsyncStatus.InvokeSentCallback) > 0) + { + request.outAsync.invokeSentAsync(); + } + } + catch(RetryException ex) + { + exception = ex.get(); + try + { + // Remove the request handler before retrying. + _reference.getInstance().requestHandlerFactory().removeRequestHandler(_reference, this); + } + catch(Ice.CommunicatorDestroyedException exc) + { + // Ignore + } + if(request.outAsync != null) { + request.outAsync.retryException(ex.get()); } - catch(Ice.Exception ex) + } + catch(Ice.LocalException ex) + { + exception = ex; + if(request.outAsync != null && request.outAsync.completed(ex)) { + request.outAsync.invokeCompletedAsync(); } } p.remove(); @@ -478,7 +465,7 @@ public class ConnectRequestHandler // request handler to use the more efficient connection request // handler. // - if(_reference.getCacheConnection()) + if(_reference.getCacheConnection() && exception == null) { _connectionRequestHandler = new ConnectionRequestHandler(_reference, _connection, _compress); for(Ice.ObjectPrxHelperBase proxy : _proxies) @@ -490,7 +477,8 @@ public class ConnectRequestHandler synchronized(this) { assert(!_initialized); - _initialized = true; + _exception = exception; + _initialized = _exception == null; _flushing = false; try { |