summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/ReferenceFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/IceInternal/ReferenceFactory.java')
-rw-r--r--java/src/IceInternal/ReferenceFactory.java492
1 files changed, 246 insertions, 246 deletions
diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java
index 56125ba4335..a2f1433cce3 100644
--- a/java/src/IceInternal/ReferenceFactory.java
+++ b/java/src/IceInternal/ReferenceFactory.java
@@ -20,7 +20,7 @@ public final class ReferenceFactory
boolean preferSecure,
EndpointI[] endpoints,
RouterInfo routerInfo,
- boolean collocationOptimization,
+ boolean collocationOptimization,
boolean cacheConnection,
Ice.EndpointSelectionType endpointSelection,
boolean threadPerConnection)
@@ -39,9 +39,9 @@ public final class ReferenceFactory
// Create new reference
//
DirectReference ref = new DirectReference(_instance, _communicator, ident, context, facet, mode, secure,
- preferSecure, endpoints, routerInfo, collocationOptimization,
+ preferSecure, endpoints, routerInfo, collocationOptimization,
cacheConnection, endpointSelection, threadPerConnection);
- return updateCache(ref);
+ return updateCache(ref);
}
public synchronized Reference
@@ -53,12 +53,12 @@ public final class ReferenceFactory
boolean preferSecure,
String adapterId,
RouterInfo routerInfo,
- LocatorInfo locatorInfo,
- boolean collocationOptimization,
+ LocatorInfo locatorInfo,
+ boolean collocationOptimization,
boolean cacheConnection,
Ice.EndpointSelectionType endpointSelection,
boolean threadPerConnection,
- int locatorCacheTimeout)
+ int locatorCacheTimeout)
{
if(_instance == null)
{
@@ -74,10 +74,10 @@ public final class ReferenceFactory
// Create new reference
//
IndirectReference ref = new IndirectReference(_instance, _communicator, ident, context, facet, mode, secure,
- preferSecure, adapterId, routerInfo, locatorInfo,
- collocationOptimization, cacheConnection, endpointSelection,
+ preferSecure, adapterId, routerInfo, locatorInfo,
+ collocationOptimization, cacheConnection, endpointSelection,
threadPerConnection, locatorCacheTimeout);
- return updateCache(ref);
+ return updateCache(ref);
}
public synchronized Reference
@@ -85,7 +85,7 @@ public final class ReferenceFactory
java.util.Map context,
String facet,
int mode,
- Ice.ConnectionI[] fixedConnections)
+ Ice.ConnectionI[] fixedConnections)
{
if(_instance == null)
{
@@ -101,24 +101,24 @@ public final class ReferenceFactory
// Create new reference
//
FixedReference ref = new FixedReference(_instance, _communicator, ident, context, facet, mode,
- fixedConnections);
- return updateCache(ref);
+ fixedConnections);
+ return updateCache(ref);
}
public synchronized Reference
copy(Reference r)
{
if(_instance == null)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- Ice.Identity ident = r.getIdentity();
- if(ident.name.length() == 0 && ident.category.length() == 0)
- {
- return null;
- }
- return (Reference)r.clone();
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
+
+ Ice.Identity ident = r.getIdentity();
+ if(ident.name.length() == 0 && ident.category.length() == 0)
+ {
+ return null;
+ }
+ return (Reference)r.clone();
}
public Reference
@@ -138,8 +138,8 @@ public final class ReferenceFactory
if(beg == -1)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
//
@@ -151,8 +151,8 @@ public final class ReferenceFactory
if(end == -1)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
else if(end == 0)
{
@@ -173,8 +173,8 @@ public final class ReferenceFactory
if(beg == end)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
//
@@ -215,7 +215,7 @@ public final class ReferenceFactory
String facet = "";
int mode = Reference.ModeTwoway;
boolean secure = false;
- String adapter = "";
+ String adapter = "";
while(true)
{
@@ -245,8 +245,8 @@ public final class ReferenceFactory
if(option.length() != 2 || option.charAt(0) != '-')
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
//
@@ -266,8 +266,8 @@ public final class ReferenceFactory
if(end == -1)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
else if(end == 0)
{
@@ -298,16 +298,16 @@ public final class ReferenceFactory
if(argument == null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
Ice.StringHolder facetH = new Ice.StringHolder();
if(!IceUtil.StringUtil.unescapeString(argument, 0, argument.length(), facetH))
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
facet = facetH.value;
@@ -319,8 +319,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
mode = Reference.ModeTwoway;
break;
@@ -331,8 +331,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
mode = Reference.ModeOneway;
break;
@@ -343,8 +343,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
mode = Reference.ModeBatchOneway;
break;
@@ -355,8 +355,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
mode = Reference.ModeDatagram;
break;
@@ -367,8 +367,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
mode = Reference.ModeBatchDatagram;
break;
@@ -379,8 +379,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
secure = true;
break;
@@ -389,126 +389,126 @@ public final class ReferenceFactory
default:
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
}
}
- RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter());
- LocatorInfo locatorInfo = _instance.locatorManager().get(getDefaultLocator());
+ RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter());
+ LocatorInfo locatorInfo = _instance.locatorManager().get(getDefaultLocator());
- if(beg == -1)
- {
- return create(ident, _instance.getDefaultContext(), facet, mode, secure,
- _instance.defaultsAndOverrides().defaultPreferSecure, "", routerInfo,
- locatorInfo, _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
+ if(beg == -1)
+ {
+ return create(ident, _instance.getDefaultContext(), facet, mode, secure,
+ _instance.defaultsAndOverrides().defaultPreferSecure, "", routerInfo,
+ locatorInfo, _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
_instance.defaultsAndOverrides().defaultEndpointSelection, _instance.threadPerConnection(),
- _instance.defaultsAndOverrides().defaultLocatorCacheTimeout);
- }
+ _instance.defaultsAndOverrides().defaultLocatorCacheTimeout);
+ }
java.util.ArrayList endpoints = new java.util.ArrayList();
- if(s.charAt(beg) == ':')
- {
- java.util.ArrayList unknownEndpoints = new java.util.ArrayList();
- end = beg;
-
- while(end < s.length() && s.charAt(end) == ':')
- {
- beg = end + 1;
-
- end = s.indexOf(':', beg);
- if(end == -1)
- {
- end = s.length();
- }
-
- String es = s.substring(beg, end);
- EndpointI endp = _instance.endpointFactoryManager().create(es);
- if(endp != null)
- {
- java.util.ArrayList endps = endp.expand(false);
- endpoints.addAll(endps);
- }
- else
- {
- unknownEndpoints.add(es);
- }
- }
- if(endpoints.size() == 0)
- {
- Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = (String)unknownEndpoints.get(0);
- throw e;
- }
- else if(unknownEndpoints.size() != 0 &&
- _instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Endpoints", 1) > 0)
- {
- String msg = "Proxy contains unknown endpoints:";
- java.util.Iterator iter = unknownEndpoints.iterator();
- while(iter.hasNext())
- {
- msg += " `" + (String)iter.next() + "'";
- }
- _instance.initializationData().logger.warning(msg);
- }
-
- EndpointI[] endp = new EndpointI[endpoints.size()];
- endpoints.toArray(endp);
- return create(ident, _instance.getDefaultContext(), facet, mode, secure,
- _instance.defaultsAndOverrides().defaultPreferSecure, endp, routerInfo,
- _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
+ if(s.charAt(beg) == ':')
+ {
+ java.util.ArrayList unknownEndpoints = new java.util.ArrayList();
+ end = beg;
+
+ while(end < s.length() && s.charAt(end) == ':')
+ {
+ beg = end + 1;
+
+ end = s.indexOf(':', beg);
+ if(end == -1)
+ {
+ end = s.length();
+ }
+
+ String es = s.substring(beg, end);
+ EndpointI endp = _instance.endpointFactoryManager().create(es);
+ if(endp != null)
+ {
+ java.util.ArrayList endps = endp.expand(false);
+ endpoints.addAll(endps);
+ }
+ else
+ {
+ unknownEndpoints.add(es);
+ }
+ }
+ if(endpoints.size() == 0)
+ {
+ Ice.EndpointParseException e = new Ice.EndpointParseException();
+ e.str = (String)unknownEndpoints.get(0);
+ throw e;
+ }
+ else if(unknownEndpoints.size() != 0 &&
+ _instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Endpoints", 1) > 0)
+ {
+ String msg = "Proxy contains unknown endpoints:";
+ java.util.Iterator iter = unknownEndpoints.iterator();
+ while(iter.hasNext())
+ {
+ msg += " `" + (String)iter.next() + "'";
+ }
+ _instance.initializationData().logger.warning(msg);
+ }
+
+ EndpointI[] endp = new EndpointI[endpoints.size()];
+ endpoints.toArray(endp);
+ return create(ident, _instance.getDefaultContext(), facet, mode, secure,
+ _instance.defaultsAndOverrides().defaultPreferSecure, endp, routerInfo,
+ _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
_instance.defaultsAndOverrides().defaultEndpointSelection, _instance.threadPerConnection());
- }
- else if(s.charAt(beg) == '@')
- {
- beg = IceUtil.StringUtil.findFirstNotOf(s, delim, beg + 1);
- if(beg == -1)
- {
- Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
- }
-
- end = IceUtil.StringUtil.checkQuote(s, beg);
- if(end == -1)
- {
- Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
- }
- else if(end == 0)
- {
- end = IceUtil.StringUtil.findFirstOf(s, delim, beg);
- if(end == -1)
- {
- end = s.length();
- }
- }
- else
- {
- beg++; // Skip leading quote
- }
-
- Ice.StringHolder token = new Ice.StringHolder();
- if(!IceUtil.StringUtil.unescapeString(s, beg, end, token) || token.value.length() == 0)
- {
- Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
- }
- adapter = token.value;
- return create(ident, _instance.getDefaultContext(), facet, mode, secure,
- _instance.defaultsAndOverrides().defaultPreferSecure, adapter,
- routerInfo, locatorInfo, _instance.defaultsAndOverrides().defaultCollocationOptimization,
+ }
+ else if(s.charAt(beg) == '@')
+ {
+ beg = IceUtil.StringUtil.findFirstNotOf(s, delim, beg + 1);
+ if(beg == -1)
+ {
+ Ice.ProxyParseException e = new Ice.ProxyParseException();
+ e.str = s;
+ throw e;
+ }
+
+ end = IceUtil.StringUtil.checkQuote(s, beg);
+ if(end == -1)
+ {
+ Ice.ProxyParseException e = new Ice.ProxyParseException();
+ e.str = s;
+ throw e;
+ }
+ else if(end == 0)
+ {
+ end = IceUtil.StringUtil.findFirstOf(s, delim, beg);
+ if(end == -1)
+ {
+ end = s.length();
+ }
+ }
+ else
+ {
+ beg++; // Skip leading quote
+ }
+
+ Ice.StringHolder token = new Ice.StringHolder();
+ if(!IceUtil.StringUtil.unescapeString(s, beg, end, token) || token.value.length() == 0)
+ {
+ Ice.ProxyParseException e = new Ice.ProxyParseException();
+ e.str = s;
+ throw e;
+ }
+ adapter = token.value;
+ return create(ident, _instance.getDefaultContext(), facet, mode, secure,
+ _instance.defaultsAndOverrides().defaultPreferSecure, adapter,
+ routerInfo, locatorInfo, _instance.defaultsAndOverrides().defaultCollocationOptimization,
true, _instance.defaultsAndOverrides().defaultEndpointSelection,
_instance.threadPerConnection(), _instance.defaultsAndOverrides().defaultLocatorCacheTimeout);
- }
+ }
- Ice.ProxyParseException ex = new Ice.ProxyParseException();
- ex.str = s;
- throw ex;
+ Ice.ProxyParseException ex = new Ice.ProxyParseException();
+ ex.str = s;
+ throw ex;
}
public Reference
@@ -516,67 +516,67 @@ public final class ReferenceFactory
{
Ice.Properties properties = _instance.initializationData().properties;
- Reference ref = create(properties.getProperty(propertyPrefix));
- if(ref == null)
- {
- return null;
- }
-
- String property = propertyPrefix + ".Locator";
- if(properties.getProperty(property).length() != 0)
- {
- ref = ref.changeLocator(Ice.LocatorPrxHelper.uncheckedCast(_communicator.propertyToProxy(property)));
- }
-
- property = propertyPrefix + ".LocatorCacheTimeout";
- if(properties.getProperty(property).length() != 0)
- {
- ref = ref.changeLocatorCacheTimeout(properties.getPropertyAsInt(property));
- }
-
- property = propertyPrefix + ".Router";
- if(properties.getProperty(property).length() != 0)
- {
- ref = ref.changeRouter(Ice.RouterPrxHelper.uncheckedCast(_communicator.propertyToProxy(property)));
- }
-
- property = propertyPrefix + ".PreferSecure";
- if(properties.getProperty(property).length() != 0)
- {
- ref = ref.changePreferSecure(properties.getPropertyAsInt(property) > 0);
- }
-
- property = propertyPrefix + ".ConnectionCached";
- if(properties.getProperty(property).length() != 0)
- {
- ref = ref.changeCacheConnection(properties.getPropertyAsInt(property) > 0);
- }
-
- property = propertyPrefix + ".EndpointSelection";
- if(properties.getProperty(property).length() != 0)
- {
- String type = properties.getProperty(property);
- if(type.equals("Random"))
- {
- ref = ref.changeEndpointSelection(Ice.EndpointSelectionType.Random);
- }
- else if(type.equals("Ordered"))
- {
- ref = ref.changeEndpointSelection(Ice.EndpointSelectionType.Ordered);
- }
- else
- {
- Ice.EndpointSelectionTypeParseException ex = new Ice.EndpointSelectionTypeParseException();
- ex.str = type;
- throw ex;
- }
- }
-
- property = propertyPrefix + ".CollocationOptimization";
- if(properties.getProperty(property).length() != 0)
- {
- ref = ref.changeCollocationOptimization(properties.getPropertyAsInt(property) > 0);
- }
+ Reference ref = create(properties.getProperty(propertyPrefix));
+ if(ref == null)
+ {
+ return null;
+ }
+
+ String property = propertyPrefix + ".Locator";
+ if(properties.getProperty(property).length() != 0)
+ {
+ ref = ref.changeLocator(Ice.LocatorPrxHelper.uncheckedCast(_communicator.propertyToProxy(property)));
+ }
+
+ property = propertyPrefix + ".LocatorCacheTimeout";
+ if(properties.getProperty(property).length() != 0)
+ {
+ ref = ref.changeLocatorCacheTimeout(properties.getPropertyAsInt(property));
+ }
+
+ property = propertyPrefix + ".Router";
+ if(properties.getProperty(property).length() != 0)
+ {
+ ref = ref.changeRouter(Ice.RouterPrxHelper.uncheckedCast(_communicator.propertyToProxy(property)));
+ }
+
+ property = propertyPrefix + ".PreferSecure";
+ if(properties.getProperty(property).length() != 0)
+ {
+ ref = ref.changePreferSecure(properties.getPropertyAsInt(property) > 0);
+ }
+
+ property = propertyPrefix + ".ConnectionCached";
+ if(properties.getProperty(property).length() != 0)
+ {
+ ref = ref.changeCacheConnection(properties.getPropertyAsInt(property) > 0);
+ }
+
+ property = propertyPrefix + ".EndpointSelection";
+ if(properties.getProperty(property).length() != 0)
+ {
+ String type = properties.getProperty(property);
+ if(type.equals("Random"))
+ {
+ ref = ref.changeEndpointSelection(Ice.EndpointSelectionType.Random);
+ }
+ else if(type.equals("Ordered"))
+ {
+ ref = ref.changeEndpointSelection(Ice.EndpointSelectionType.Ordered);
+ }
+ else
+ {
+ Ice.EndpointSelectionTypeParseException ex = new Ice.EndpointSelectionTypeParseException();
+ ex.str = type;
+ throw ex;
+ }
+ }
+
+ property = propertyPrefix + ".CollocationOptimization";
+ if(properties.getProperty(property).length() != 0)
+ {
+ ref = ref.changeCollocationOptimization(properties.getPropertyAsInt(property) > 0);
+ }
property = propertyPrefix + ".ThreadPerConnection";
if(properties.getProperty(property).length() != 0)
@@ -584,7 +584,7 @@ public final class ReferenceFactory
ref = ref.changeThreadPerConnection(properties.getPropertyAsInt(property) > 0);
}
- return ref;
+ return ref;
}
public Reference
@@ -607,16 +607,16 @@ public final class ReferenceFactory
String facet;
if(facetPath.length > 0)
{
- if(facetPath.length > 1)
- {
- throw new Ice.ProxyUnmarshalException();
- }
+ if(facetPath.length > 1)
+ {
+ throw new Ice.ProxyUnmarshalException();
+ }
facet = facetPath[0];
}
- else
+ else
{
- facet = "";
- }
+ facet = "";
+ }
int mode = (int)s.readByte();
if(mode < 0 || mode > Reference.ModeLast)
@@ -627,34 +627,34 @@ public final class ReferenceFactory
boolean secure = s.readBool();
EndpointI[] endpoints;
- String adapterId = "";
+ String adapterId = "";
RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter());
LocatorInfo locatorInfo = _instance.locatorManager().get(getDefaultLocator());
int sz = s.readSize();
- if(sz > 0)
- {
- endpoints = new EndpointI[sz];
- for(int i = 0; i < sz; i++)
- {
- endpoints[i] = _instance.endpointFactoryManager().read(s);
- }
- return create(ident, _instance.getDefaultContext(), facet, mode, secure,
- _instance.defaultsAndOverrides().defaultPreferSecure, endpoints,
- routerInfo, _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
+ if(sz > 0)
+ {
+ endpoints = new EndpointI[sz];
+ for(int i = 0; i < sz; i++)
+ {
+ endpoints[i] = _instance.endpointFactoryManager().read(s);
+ }
+ return create(ident, _instance.getDefaultContext(), facet, mode, secure,
+ _instance.defaultsAndOverrides().defaultPreferSecure, endpoints,
+ routerInfo, _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
_instance.defaultsAndOverrides().defaultEndpointSelection, _instance.threadPerConnection());
- }
- else
- {
- endpoints = new EndpointI[0];
- adapterId = s.readString();
- return create(ident, _instance.getDefaultContext(), facet, mode, secure,
- _instance.defaultsAndOverrides().defaultPreferSecure, adapterId, routerInfo, locatorInfo,
- _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
+ }
+ else
+ {
+ endpoints = new EndpointI[0];
+ adapterId = s.readString();
+ return create(ident, _instance.getDefaultContext(), facet, mode, secure,
+ _instance.defaultsAndOverrides().defaultPreferSecure, adapterId, routerInfo, locatorInfo,
+ _instance.defaultsAndOverrides().defaultCollocationOptimization, true,
_instance.defaultsAndOverrides().defaultEndpointSelection, _instance.threadPerConnection(),
- _instance.defaultsAndOverrides().defaultLocatorCacheTimeout);
- }
+ _instance.defaultsAndOverrides().defaultLocatorCacheTimeout);
+ }
}
public synchronized void