diff options
author | Matthew Newhook <matthew@zeroc.com> | 2015-02-19 13:39:15 -0330 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2015-02-19 13:39:15 -0330 |
commit | 507ceb2aeb81cdbba7452bb142fe4fce71650b07 (patch) | |
tree | 233bb72b8ab5bf80b43e1149df47a23320e3051f /java/src | |
parent | All Ice clones are now covariant in Java (diff) | |
download | ice-507ceb2aeb81cdbba7452bb142fe4fce71650b07.tar.bz2 ice-507ceb2aeb81cdbba7452bb142fe4fce71650b07.tar.xz ice-507ceb2aeb81cdbba7452bb142fe4fce71650b07.zip |
ICE-6322 Network I/O on main thread
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java b/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java index 685ab0744ed..6b96a08707a 100644 --- a/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java +++ b/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java @@ -11,6 +11,8 @@ package IceInternal; import Ice.ConnectionI; +import java.util.concurrent.Callable; + public class ConnectRequestHandler implements RequestHandler, Reference.GetConnectionCallback, RouterInfo.AddProxyCallback { @@ -389,6 +391,27 @@ public class ConnectRequestHandler private void flushRequests() { + if(_reference.getInstance().queueRequests()) + { + _reference.getInstance().getQueueExecutor().executeNoThrow(new Callable<Void>() + { + @Override + public Void call() throws Exception + { + flushRequestsImpl(); + return null; + } + }); + } + else + { + flushRequestsImpl(); + } + } + + private void + flushRequestsImpl() + { synchronized(this) { assert(_connection != null && !_initialized); @@ -402,7 +425,6 @@ public class ConnectRequestHandler _flushing = true; } - 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()) |