diff options
author | Benoit Foucher <benoit@zeroc.com> | 2015-06-04 11:31:20 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2015-06-04 11:31:20 +0200 |
commit | c559a3a1133ada1a30c655789189cec79ca7665e (patch) | |
tree | 982dabcc449dd332d9f166677f056e33f9ebd03b /java/src | |
parent | Fix ICE-6152 - Document wss on mobile devices (diff) | |
download | ice-c559a3a1133ada1a30c655789189cec79ca7665e.tar.bz2 ice-c559a3a1133ada1a30c655789189cec79ca7665e.tar.xz ice-c559a3a1133ada1a30c655789189cec79ca7665e.zip |
Fixed ICE-6558 - Android deadlock with background IO thread
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/src/main/java/IceInternal/LocatorInfo.java | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/java/src/Ice/src/main/java/IceInternal/LocatorInfo.java b/java/src/Ice/src/main/java/IceInternal/LocatorInfo.java index b75df85f3c8..037771cde5d 100644 --- a/java/src/Ice/src/main/java/IceInternal/LocatorInfo.java +++ b/java/src/Ice/src/main/java/IceInternal/LocatorInfo.java @@ -90,30 +90,36 @@ public final class LocatorInfo private abstract class Request { - synchronized public void + public void addCallback(Reference ref, Reference wellKnownRef, int ttl, GetEndpointsCallback cb) { RequestCallback callback = new RequestCallback(ref, ttl, cb); - if(_response) + synchronized(this) { - callback.response(_locatorInfo, _proxy); + if(!_response && _exception == null) + { + _callbacks.add(callback); + if(wellKnownRef != null) // This request is to resolve the endpoints of a cached well-known object ref + { + _wellKnownRefs.add(wellKnownRef); + } + if(!_sent) + { + _sent = true; + send(); + } + return; + } } - else if(_exception != null) + + if(_response) { - callback.exception(_locatorInfo, _exception); + callback.response(_locatorInfo, _proxy); } else { - _callbacks.add(callback); - if(wellKnownRef != null) // This request is to resolve the endpoints of a cached well-known object ref - { - _wellKnownRefs.add(wellKnownRef); - } - if(!_sent) - { - _sent = true; - send(); - } + assert(_exception != null); + callback.exception(_locatorInfo, _exception); } } @@ -125,17 +131,20 @@ public final class LocatorInfo _response = false; } - synchronized protected void + protected void response(Ice.ObjectPrx proxy) { - _locatorInfo.finishRequest(_ref, _wellKnownRefs, proxy, false); - _response = true; - _proxy = proxy; + synchronized(this) + { + _locatorInfo.finishRequest(_ref, _wellKnownRefs, proxy, false); + _response = true; + _proxy = proxy; + notifyAll(); + } for(RequestCallback callback : _callbacks) { callback.response(_locatorInfo, proxy); } - notifyAll(); } protected void @@ -145,12 +154,12 @@ public final class LocatorInfo { _locatorInfo.finishRequest(_ref, _wellKnownRefs, null, ex instanceof Ice.UserException); _exception = ex; - for(RequestCallback callback : _callbacks) - { - callback.exception(_locatorInfo, ex); - } notifyAll(); } + for(RequestCallback callback : _callbacks) + { + callback.exception(_locatorInfo, ex); + } } protected abstract void send(); |