1
1
// **********************************************************************
3
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
3
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
5
5
// This copy of Ice is licensed to you under the terms described in the
6
6
// ICE_LICENSE file included in this distribution.
259
265
if(_endpoints.length > 0)
261
267
assert(_adapterId.length() == 0);
262
for(int i = 0; i < _endpoints.length; i++)
268
for(EndpointI endpoint : _endpoints)
264
_endpoints[i].streamWrite(s);
270
endpoint.streamWrite(s);
284
290
s.append(super.toString());
285
291
if(_endpoints.length > 0)
287
for(int i = 0; i < _endpoints.length; i++)
293
for(EndpointI endpoint : _endpoints)
289
String endp = _endpoints[i].toString();
295
String endp = endpoint.toString();
290
296
if(endp != null && endp.length() > 0)
304
310
// the adapter id string in quotes.
306
312
String a = IceUtilInternal.StringUtil.escapeString(_adapterId, null);
307
if(IceUtilInternal.StringUtil.findFirstOf(a, " \t\n\r") != -1)
313
if(IceUtilInternal.StringUtil.findFirstOf(a, " :@") != -1)
318
324
return s.toString();
327
public java.util.Map<String, String> toProperty(String prefix)
329
java.util.Map<String, String> properties = new java.util.HashMap<String, String>();
331
properties.put(prefix, toString());
332
properties.put(prefix + ".CollocationOptimized", _collocationOptimized ? "1" : "0");
333
properties.put(prefix + ".ConnectionCached", _cacheConnection ? "1" : "0");
334
properties.put(prefix + ".PreferSecure", _preferSecure ? "1" : "0");
335
properties.put(prefix + ".EndpointSelection",
336
_endpointSelection == Ice.EndpointSelectionType.Random ? "Random" : "Ordered");
338
StringBuffer s = new StringBuffer();
339
s.append(_locatorCacheTimeout);
340
properties.put(prefix + ".LocatorCacheTimeout", s.toString());
342
if(_routerInfo != null)
344
Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)_routerInfo.getRouter();
345
java.util.Map<String, String> routerProperties = h.__reference().toProperty(prefix + ".Router");
346
for(java.util.Map.Entry<String, String> p : routerProperties.entrySet())
348
properties.put(p.getKey(), p.getValue());
352
if(_locatorInfo != null)
354
Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)_locatorInfo.getLocator();
355
java.util.Map<String, String> locatorProperties = h.__reference().toProperty(prefix + ".Locator");
356
for(java.util.Map.Entry<String, String> p : locatorProperties.entrySet())
358
properties.put(p.getKey(), p.getValue());
321
365
public synchronized int
584
628
RoutableReference(Instance instance,
585
629
Ice.Communicator communicator,
586
630
Ice.Identity identity,
587
java.util.Map<String, String> context,
598
641
Ice.EndpointSelectionType endpointSelection,
599
642
int locatorCacheTimeout)
601
super(instance, communicator, identity, context, facet, mode, secure);
644
super(instance, communicator, identity, facet, mode, secure);
602
645
_endpoints = endpoints;
603
646
_adapterId = adapterId;
604
647
_locatorInfo = locatorInfo;
648
691
java.util.List<EndpointI> endpoints = new java.util.ArrayList<EndpointI>();
651
// Filter out unknown endpoints.
694
// Filter out opaque endpoints.
653
for(int i = 0; i < allEndpoints.length; i++)
696
for(EndpointI endpoint : allEndpoints)
655
if(!allEndpoints[i].unknown())
698
if(!(endpoint instanceof IceInternal.OpaqueEndpointI))
657
endpoints.add(allEndpoints[i]);
700
endpoints.add(endpoint);
705
748
// Sort the endpoints according to the endpoint selection type.
707
switch(getEndpointSelection().value())
750
switch(getEndpointSelection())
709
case Ice.EndpointSelectionType._Random:
711
754
java.util.Collections.shuffle(endpoints);
714
case Ice.EndpointSelectionType._Ordered:
716
759
// Nothing to do.