summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/LocatorInfo.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2008-01-21 13:20:59 +0100
committerBenoit Foucher <benoit@zeroc.com>2008-01-21 13:20:59 +0100
commit52bd621c7d3fa7b144d8fad7941ac8d43e942be8 (patch)
treebdd7565282d503251d82205ce7fe3e57102a96d2 /java/src/IceInternal/LocatorInfo.java
parentasync I/O in C# (diff)
downloadice-52bd621c7d3fa7b144d8fad7941ac8d43e942be8.tar.bz2
ice-52bd621c7d3fa7b144d8fad7941ac8d43e942be8.tar.xz
ice-52bd621c7d3fa7b144d8fad7941ac8d43e942be8.zip
- Removed OA createReverseProxy method.
- Fixed bug 2141, 2645, 2632, 1547. - It's now possible to call ice_secure on a fixed proxy to require a secure connetion.
Diffstat (limited to 'java/src/IceInternal/LocatorInfo.java')
-rw-r--r--java/src/IceInternal/LocatorInfo.java129
1 files changed, 60 insertions, 69 deletions
diff --git a/java/src/IceInternal/LocatorInfo.java b/java/src/IceInternal/LocatorInfo.java
index c5b4b1d0060..d559c4ddee3 100644
--- a/java/src/IceInternal/LocatorInfo.java
+++ b/java/src/IceInternal/LocatorInfo.java
@@ -72,8 +72,10 @@ public final class LocatorInfo
}
public EndpointI[]
- getEndpoints(IndirectReference ref, int ttl, Ice.BooleanHolder cached)
+ getEndpoints(Reference ref, int ttl, Ice.BooleanHolder cached)
{
+ assert(ref.isIndirect());
+
EndpointI[] endpoints = null;
Ice.ObjectPrx object = null;
cached.value = true;
@@ -138,21 +140,16 @@ public final class LocatorInfo
if(object != null)
{
Reference r = ((Ice.ObjectPrxHelperBase)object).__reference();
- if(r instanceof DirectReference)
+ if(!r.isIndirect())
{
endpointsCached = false;
- DirectReference odr = (DirectReference)r;
- endpoints = odr.getEndpoints();
+ endpoints = r.getEndpoints();
}
- else
+ else if(!r.isWellKnown())
{
- IndirectReference oir = (IndirectReference)r;
- if(oir.getAdapterId().length() > 0)
- {
- Ice.BooleanHolder c = new Ice.BooleanHolder();
- endpoints = getEndpoints(oir, ttl, c);
- endpointsCached = c.value;
- }
+ Ice.BooleanHolder c = new Ice.BooleanHolder();
+ endpoints = getEndpoints(r, ttl, c);
+ endpointsCached = c.value;
}
}
@@ -178,7 +175,7 @@ public final class LocatorInfo
}
public void
- getEndpoints(final IndirectReference ref, final int ttl, final GetEndpointsCallback callback)
+ getEndpoints(final Reference ref, final int ttl, final GetEndpointsCallback callback)
{
final String adapterId = ref.getAdapterId();
final Ice.Identity identity = ref.getIdentity();
@@ -298,37 +295,36 @@ public final class LocatorInfo
}
public void
- clearObjectCache(IndirectReference ref)
+ clearObjectCache(Reference ref)
{
- if(ref.getAdapterId().length() == 0)
+ assert(ref.isIndirect());
+ if(ref.isWellKnown())
{
Ice.ObjectPrx object = _table.removeProxy(ref.getIdentity());
if(object != null)
{
- if(((Ice.ObjectPrxHelperBase)object).__reference() instanceof IndirectReference)
+ Reference r = ((Ice.ObjectPrxHelperBase)object).__reference();
+ if(!r.isIndirect())
{
- IndirectReference oir = (IndirectReference)((Ice.ObjectPrxHelperBase)object).__reference();
- if(oir.getAdapterId().length() > 0)
+ if(ref.getInstance().traceLevels().location >= 2)
{
- clearCache(oir);
+ trace("removed endpoints from locator table", ref, r.getEndpoints());
}
}
- else
+ else if(!r.isWellKnown())
{
- if(ref.getInstance().traceLevels().location >= 2)
- {
- trace("removed endpoints from locator table",
- ref, ((Ice.ObjectPrxHelperBase)object).__reference().getEndpoints());
- }
+ clearCache(r);
}
}
}
}
public void
- clearCache(IndirectReference ref)
+ clearCache(Reference ref)
{
- if(ref.getAdapterId().length() > 0)
+ assert(ref.isIndirect());
+
+ if(!ref.isWellKnown())
{
EndpointI[] endpoints = _table.removeAdapterEndpoints(ref.getAdapterId());
@@ -342,32 +338,30 @@ public final class LocatorInfo
Ice.ObjectPrx object = _table.removeProxy(ref.getIdentity());
if(object != null)
{
- if(((Ice.ObjectPrxHelperBase)object).__reference() instanceof IndirectReference)
+ Reference r = ((Ice.ObjectPrxHelperBase)object).__reference();
+ if(!r.isIndirect())
{
- IndirectReference oir = (IndirectReference)((Ice.ObjectPrxHelperBase)object).__reference();
- if(oir.getAdapterId().length() > 0)
+ if(ref.getInstance().traceLevels().location >= 2)
{
- clearCache(oir);
+ trace("removed endpoints from locator table", ref, r.getEndpoints());
}
}
- else
+ else if(!r.isWellKnown())
{
- if(ref.getInstance().traceLevels().location >= 2)
- {
- trace("removed endpoints from locator table",
- ref, ((Ice.ObjectPrxHelperBase)object).__reference().getEndpoints());
- }
+ clearCache(r);
}
}
}
}
private void
- trace(String msg, IndirectReference ref, EndpointI[] endpoints)
+ trace(String msg, Reference ref, EndpointI[] endpoints)
{
+ assert(ref.isIndirect());
+
StringBuffer s = new StringBuffer();
s.append(msg + "\n");
- if(ref.getAdapterId().length() > 0)
+ if(!ref.isWellKnown())
{
s.append("adapter = " + ref.getAdapterId() + "\n");
}
@@ -391,8 +385,10 @@ public final class LocatorInfo
}
private void
- getEndpointsException(IndirectReference ref, Exception exc)
+ getEndpointsException(Reference ref, Exception exc)
{
+ assert(ref.isIndirect());
+
try
{
throw exc;
@@ -460,7 +456,7 @@ public final class LocatorInfo
}
private void
- getEndpointsException(IndirectReference ref, Exception exc, GetEndpointsCallback callback)
+ getEndpointsException(Reference ref, Exception exc, GetEndpointsCallback callback)
{
try
{
@@ -477,7 +473,7 @@ public final class LocatorInfo
}
private void
- getWellKnownObjectEndpoints(final IndirectReference ref,
+ getWellKnownObjectEndpoints(final Reference ref,
final Ice.ObjectPrx object,
final int ttl,
final boolean objectCached,
@@ -487,42 +483,37 @@ public final class LocatorInfo
if(object != null)
{
Reference r = ((Ice.ObjectPrxHelperBase)object).__reference();
- if(r instanceof DirectReference)
+ if(!r.isIndirect())
{
- DirectReference odr = (DirectReference)r;
- endpoints = odr.getEndpoints();
+ endpoints = r.getEndpoints();
}
- else
+ else if(!r.isWellKnown())
{
- IndirectReference oir = (IndirectReference)r;
- if(oir.getAdapterId().length() > 0)
+ getEndpoints(r, ttl, new GetEndpointsCallback()
{
- getEndpoints(oir, ttl, new GetEndpointsCallback()
+ public void
+ setEndpoints(EndpointI[] endpoints, boolean endpointsCached)
+ {
+ if(!objectCached && endpoints != null && endpoints.length > 0)
{
- public void
- setEndpoints(EndpointI[] endpoints, boolean endpointsCached)
- {
- if(!objectCached && endpoints != null && endpoints.length > 0)
- {
- _table.addProxy(ref.getIdentity(), object);
- }
-
+ _table.addProxy(ref.getIdentity(), object);
+ }
+
if(ref.getInstance().traceLevels().location >= 1)
{
getEndpointsTrace(ref, endpoints, objectCached || endpointsCached);
}
-
+
callback.setEndpoints(endpoints, objectCached || endpointsCached);
- }
-
- public void
- setException(Ice.LocalException ex)
- {
- callback.setException(ex);
- }
- });
- return;
- }
+ }
+
+ public void
+ setException(Ice.LocalException ex)
+ {
+ callback.setException(ex);
+ }
+ });
+ return;
}
}
@@ -547,7 +538,7 @@ public final class LocatorInfo
}
private void
- getEndpointsTrace(IndirectReference ref, EndpointI[] endpoints, boolean cached)
+ getEndpointsTrace(Reference ref, EndpointI[] endpoints, boolean cached)
{
if(endpoints != null && endpoints.length > 0)
{