summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/RoutableReference.java
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2014-08-07 14:36:07 -0230
committerMatthew Newhook <matthew@zeroc.com>2014-08-07 14:36:07 -0230
commitb36ae21c88735cbd2c39c5ccde2572a8fcc4e928 (patch)
treedfd5eee6e7d61a9c6efcbaabe916639009aaa9af /java/src/IceInternal/RoutableReference.java
parentAdd @Override where possible, and remove trailing white space. (diff)
downloadice-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/RoutableReference.java')
-rw-r--r--java/src/IceInternal/RoutableReference.java141
1 files changed, 2 insertions, 139 deletions
diff --git a/java/src/IceInternal/RoutableReference.java b/java/src/IceInternal/RoutableReference.java
index 705aebc6475..8e89f69cd15 100644
--- a/java/src/IceInternal/RoutableReference.java
+++ b/java/src/IceInternal/RoutableReference.java
@@ -496,72 +496,6 @@ public class RoutableReference extends Reference
}
@Override
- public Ice.ConnectionI
- getConnection(Ice.BooleanHolder comp)
- {
- if(_routerInfo != null)
- {
- //
- // If we route, we send everything to the router's client
- // proxy endpoints.
- //
- EndpointI[] endpts = _routerInfo.getClientEndpoints();
- if(endpts.length > 0)
- {
- applyOverrides(endpts);
- return createConnection(endpts, comp);
- }
- }
-
- if(_endpoints.length > 0)
- {
- return createConnection(_endpoints, comp);
- }
-
- while(true)
- {
- Ice.BooleanHolder cached = new Ice.BooleanHolder(false);
- EndpointI[] endpts = null;
- if(_locatorInfo != null)
- {
- endpts = _locatorInfo.getEndpoints(this, _locatorCacheTimeout, cached);
- applyOverrides(endpts);
- }
-
- if(endpts == null || endpts.length == 0)
- {
- throw new Ice.NoEndpointException(toString());
- }
-
- try
- {
- return createConnection(endpts, comp);
- }
- catch(Ice.NoEndpointException ex)
- {
- throw ex; // No need to retry if there's no endpoints.
- }
- catch(Ice.LocalException ex)
- {
- assert(_locatorInfo != null);
- _locatorInfo.clearCache(this);
- if(cached.value)
- {
- TraceLevels traceLevels = getInstance().traceLevels();
- if(traceLevels.retry >= 2)
- {
- String s = "connection to cached endpoints failed\n" +
- "removing endpoints from cache and trying one more time\n" + ex;
- getInstance().initializationData().logger.trace(traceLevels.retryCat, s);
- }
- continue; // Try again if the endpoints were cached.
- }
- throw ex;
- }
- }
- }
-
- @Override
public void
getConnection(final GetConnectionCallback callback)
{
@@ -861,77 +795,6 @@ public class RoutableReference extends Reference
return endpoints.toArray(new EndpointI[endpoints.size()]);
}
- protected Ice.ConnectionI
- createConnection(EndpointI[] allEndpoints, Ice.BooleanHolder compress)
- {
- EndpointI[] endpoints = filterEndpoints(allEndpoints);
- if(endpoints.length == 0)
- {
- throw new Ice.NoEndpointException(toString());
- }
-
- //
- // Finally, create the connection.
- //
- OutgoingConnectionFactory factory = getInstance().outgoingConnectionFactory();
- Ice.ConnectionI connection = null;
- if(getCacheConnection() || endpoints.length == 1)
- {
- //
- // Get an existing connection or create one if there's no
- // existing connection to one of the given endpoints.
- //
- connection = factory.create(endpoints, false, getEndpointSelection(), compress);
- }
- else
- {
- //
- // Go through the list of endpoints and try to create the
- // connection until it succeeds. This is different from just
- // calling create() with the given endpoints since this might
- // create a new connection even if there's an existing
- // connection for one of the endpoints.
- //
-
- Ice.LocalException exception = null;
- EndpointI[] endpoint = new EndpointI[1];
- for(int i = 0; i < endpoints.length; ++i)
- {
- try
- {
- endpoint[0] = endpoints[i];
- final boolean more = i != endpoints.length - 1;
- connection = factory.create(endpoint, more, getEndpointSelection(), compress);
- break;
- }
- catch(Ice.LocalException ex)
- {
- exception = ex;
- }
- }
-
- if(connection == null)
- {
- assert(exception != null);
- throw exception;
- }
- }
-
- assert(connection != null);
-
- //
- // If we have a router, set the object adapter for this router
- // (if any) to the new connection, so that callbacks from the
- // router can be received over this new connection.
- //
- if(_routerInfo != null && _routerInfo.getAdapter() != null)
- {
- connection.setAdapter(_routerInfo.getAdapter());
- }
-
- return connection;
- }
-
protected void
createConnection(EndpointI[] allEndpoints, final GetConnectionCallback callback)
{
@@ -993,7 +856,7 @@ public class RoutableReference extends Reference
new OutgoingConnectionFactory.CreateConnectionCallback()
{
@Override
- public void
+ public void
setConnection(Ice.ConnectionI connection, boolean compress)
{
//
@@ -1009,7 +872,7 @@ public class RoutableReference extends Reference
}
@Override
- public void
+ public void
setException(final Ice.LocalException ex)
{
if(_exception == null)