summaryrefslogtreecommitdiff
path: root/java/src/Ice/_ObjectDelM.java
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2004-02-20 17:44:41 +0000
committerMarc Laukien <marc@zeroc.com>2004-02-20 17:44:41 +0000
commitf86bb34ec33de67fcc569d1f8cf6df2a6b7af6ad (patch)
tree520786ae72c4376b505f21f8adf9f5ea522cf9bf /java/src/Ice/_ObjectDelM.java
parentWin32 fixes (diff)
downloadice-f86bb34ec33de67fcc569d1f8cf6df2a6b7af6ad.tar.bz2
ice-f86bb34ec33de67fcc569d1f8cf6df2a6b7af6ad.tar.xz
ice-f86bb34ec33de67fcc569d1f8cf6df2a6b7af6ad.zip
C++ -> Java
Diffstat (limited to 'java/src/Ice/_ObjectDelM.java')
-rw-r--r--java/src/Ice/_ObjectDelM.java268
1 files changed, 3 insertions, 265 deletions
diff --git a/java/src/Ice/_ObjectDelM.java b/java/src/Ice/_ObjectDelM.java
index cf3505fc3da..549859a7bbc 100644
--- a/java/src/Ice/_ObjectDelM.java
+++ b/java/src/Ice/_ObjectDelM.java
@@ -175,16 +175,6 @@ public class _ObjectDelM implements _ObjectDel
}
}
- public void
- ice_invoke_async(AMI_Object_ice_invoke cb, String operation, Ice.OperationMode mode, byte[] inParams,
- java.util.Map context)
- {
- cb.__setup(__connection, __reference, operation, mode, context);
- IceInternal.BasicStream __os = cb.__os();
- __os.writeBlob(inParams);
- cb.__invoke();
- }
-
//
// Only for use by ObjectPrx
//
@@ -204,19 +194,6 @@ public class _ObjectDelM implements _ObjectDel
assert(__reference == null);
assert(__connection == null);
- if(from.__connection != null)
- {
- from.__connection.incProxyCount();
- }
-
-// Can not happen, __connection must be null.
-/*
- if(__connection != null)
- {
- __connection.decProxyCount();
- }
-*/
-
__reference = from.__reference;
__connection = from.__connection;
}
@@ -235,244 +212,10 @@ public class _ObjectDelM implements _ObjectDel
assert(__reference == null);
assert(__connection == null);
- __reference = ref;
-
- if(__reference.reverseAdapter != null)
- {
- //
- // If we have a reverse object adapter, we use the incoming
- // connections from such object adapter.
- //
- ObjectAdapterI adapter = (ObjectAdapterI)__reference.reverseAdapter;
- IceInternal.Connection[] connections = adapter.getIncomingConnections();
-
- IceInternal.Endpoint[] endpoints = new IceInternal.Endpoint[connections.length];
- for(int i = 0; i < connections.length; i++)
- {
- endpoints[i] = connections[i].endpoint();
- }
- endpoints = filterEndpoints(endpoints);
-
- if(endpoints.length == 0)
- {
- NoEndpointException e = new NoEndpointException();
- e.proxy = __reference.toString();
- throw e;
- }
-
- int j;
- for(j = 0; j < connections.length; j++)
- {
- if(connections[j].endpoint().equals(endpoints[0]))
- {
- break;
- }
- }
- assert(j < connections.length);
- __connection = connections[j];
- __connection.incProxyCount();
- }
- else
- {
- while(true)
- {
- IceInternal.Endpoint[] endpoints = null;
- BooleanHolder cached = new BooleanHolder();
- cached.value = false;
-
- if(__reference.routerInfo != null)
- {
- //
- // If we route, we send everything to the router's client
- // proxy endpoints.
- //
- ObjectPrx proxy = __reference.routerInfo.getClientProxy();
- endpoints = ((ObjectPrxHelper)proxy).__reference().endpoints;
- }
- else if(__reference.endpoints.length > 0)
- {
- endpoints = __reference.endpoints;
- }
- else if(__reference.locatorInfo != null)
- {
- endpoints = __reference.locatorInfo.getEndpoints(__reference, cached);
- }
-
- IceInternal.Endpoint[] filteredEndpoints = null;
- if(endpoints != null)
- {
- filteredEndpoints = filterEndpoints(endpoints);
- }
- if(filteredEndpoints == null || filteredEndpoints.length == 0)
- {
- NoEndpointException e = new NoEndpointException();
- e.proxy = __reference.toString();
- throw e;
- }
-
- try
- {
- IceInternal.OutgoingConnectionFactory factory = __reference.instance.outgoingConnectionFactory();
- __connection = factory.create(filteredEndpoints);
- assert(__connection != null);
- __connection.incProxyCount();
- }
- catch(LocalException ex)
- {
- if(__reference.routerInfo == null && __reference.endpoints.length == 0)
- {
- assert(__reference.locatorInfo != null);
- __reference.locatorInfo.clearCache(__reference);
-
- if(cached.value)
- {
- IceInternal.TraceLevels traceLevels = __reference.instance.traceLevels();
- Logger logger = __reference.instance.logger();
-
- if(traceLevels.retry >= 2)
- {
- String s = "connection to cached endpoints failed\n" +
- "removing endpoints from cache and trying one more time\n" + ex;
- logger.trace(traceLevels.retryCat, s);
- }
-
- continue;
- }
- }
-
- throw ex;
- }
-
- break;
- }
-
- //
- // 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(__reference.routerInfo != null)
- {
- __connection.setAdapter(__reference.routerInfo.getAdapter());
- }
- }
+ __reference = ref;
+ __connection = __reference.getConnection();
}
-
- private IceInternal.Endpoint[]
- filterEndpoints(IceInternal.Endpoint[] allEndpoints)
- {
- java.util.ArrayList endpoints = new java.util.ArrayList();
-
- //
- // Filter out unknown endpoints.
- //
- for(int i = 0; i < allEndpoints.length; i++)
- {
- if(!allEndpoints[i].unknown())
- {
- endpoints.add(allEndpoints[i]);
- }
- }
-
- switch(__reference.mode)
- {
- case IceInternal.Reference.ModeTwoway:
- case IceInternal.Reference.ModeOneway:
- case IceInternal.Reference.ModeBatchOneway:
- {
- //
- // Filter out datagram endpoints.
- //
- java.util.Iterator i = endpoints.iterator();
- while(i.hasNext())
- {
- IceInternal.Endpoint endpoint = (IceInternal.Endpoint)i.next();
- if(endpoint.datagram())
- {
- i.remove();
- }
- }
- break;
- }
-
- case IceInternal.Reference.ModeDatagram:
- case IceInternal.Reference.ModeBatchDatagram:
- {
- //
- // Filter out non-datagram endpoints.
- //
- java.util.Iterator i = endpoints.iterator();
- while(i.hasNext())
- {
- IceInternal.Endpoint endpoint = (IceInternal.Endpoint)i.next();
- if(!endpoint.datagram())
- {
- i.remove();
- }
- }
- break;
- }
- }
-
- //
- // Randomize the order of endpoints.
- //
- java.util.Collections.shuffle(endpoints);
-
- //
- // If a secure connection is requested, remove all non-secure
- // endpoints. Otherwise make non-secure endpoints preferred over
- // secure endpoints by partitioning the endpoint vector, so that
- // non-secure endpoints come first.
- //
- if(__reference.secure)
- {
- java.util.Iterator i = endpoints.iterator();
- while(i.hasNext())
- {
- IceInternal.Endpoint endpoint = (IceInternal.Endpoint)i.next();
- if(!endpoint.secure())
- {
- i.remove();
- }
- }
- }
- else
- {
- java.util.Collections.sort(endpoints, __comparator);
- }
-
- IceInternal.Endpoint[] arr = new IceInternal.Endpoint[endpoints.size()];
- endpoints.toArray(arr);
- return arr;
- }
-
- private static class EndpointComparator implements java.util.Comparator
- {
- public int
- compare(java.lang.Object l, java.lang.Object r)
- {
- IceInternal.Endpoint le = (IceInternal.Endpoint)l;
- IceInternal.Endpoint re = (IceInternal.Endpoint)r;
- boolean ls = le.secure();
- boolean rs = re.secure();
- if((ls && rs) || (!ls && !rs))
- {
- return 0;
- }
- else if(!ls && rs)
- {
- return -1;
- }
- else
- {
- return 1;
- }
- }
- }
- private static EndpointComparator __comparator = new EndpointComparator();
-
+
protected IceInternal.Outgoing
getOutgoing(String operation, OperationMode mode, java.util.Map context)
{
@@ -515,11 +258,6 @@ public class _ObjectDelM implements _ObjectDel
finalize()
throws Throwable
{
- if(__connection != null)
- {
- __connection.decProxyCount();
- }
-
while(__outgoingCache != null)
{
IceInternal.Outgoing next = __outgoingCache.next;