1 // **********************************************************************
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
8 // **********************************************************************
12 public class FixedReference
extends Reference
15 FixedReference(Instance instance
,
16 Ice
.Communicator communicator
,
17 Ice
.Identity identity
,
21 Ice
.ConnectionI connection
)
23 super(instance
, communicator
, identity
, facet
, mode
, secure
);
24 _fixedConnection
= connection
;
30 return _emptyEndpoints
;
52 getCollocationOptimized()
69 public final Ice
.EndpointSelectionType
70 getEndpointSelection()
72 return Ice
.EndpointSelectionType
.Random
;
76 getLocatorCacheTimeout()
88 changeEndpoints(EndpointI
[] newEndpoints
)
90 throw new Ice
.FixedProxyException();
94 changeAdapterId(String newAdapterId
)
96 throw new Ice
.FixedProxyException();
100 changeLocator(Ice
.LocatorPrx newLocator
)
102 throw new Ice
.FixedProxyException();
106 changeRouter(Ice
.RouterPrx newRouter
)
108 throw new Ice
.FixedProxyException();
112 changeCollocationOptimized(boolean newCollocationOptimized
)
114 throw new Ice
.FixedProxyException();
117 public final Reference
118 changeCacheConnection(boolean newCache
)
120 throw new Ice
.FixedProxyException();
124 changePreferSecure(boolean prefSec
)
126 throw new Ice
.FixedProxyException();
129 public final Reference
130 changeEndpointSelection(Ice
.EndpointSelectionType newType
)
132 throw new Ice
.FixedProxyException();
136 changeLocatorCacheTimeout(int newTimeout
)
138 throw new Ice
.FixedProxyException();
142 changeTimeout(int newTimeout
)
144 throw new Ice
.FixedProxyException();
148 changeConnectionId(String connectionId
)
150 throw new Ice
.FixedProxyException();
166 streamWrite(BasicStream s
)
167 throws Ice
.MarshalException
169 throw new Ice
.FixedProxyException();
174 throws Ice
.MarshalException
176 throw new Ice
.FixedProxyException();
179 public java
.util
.Map
<String
, String
>
180 toProperty(String prefix
)
182 throw new Ice
.FixedProxyException();
185 public Ice
.ConnectionI
186 getConnection(Ice
.BooleanHolder compress
)
190 case Reference
.ModeTwoway
:
191 case Reference
.ModeOneway
:
192 case Reference
.ModeBatchOneway
:
194 if(_fixedConnection
.endpoint().datagram())
196 throw new Ice
.NoEndpointException("");
201 case Reference
.ModeDatagram
:
202 case Reference
.ModeBatchDatagram
:
204 if(!_fixedConnection
.endpoint().datagram())
206 throw new Ice
.NoEndpointException("");
213 // If a secure connection is requested or secure overrides is set,
214 // check if the connection is secure.
217 DefaultsAndOverrides defaultsAndOverrides
= getInstance().defaultsAndOverrides();
218 if(defaultsAndOverrides
.overrideSecure
)
220 secure
= defaultsAndOverrides
.overrideSecureValue
;
224 secure
= getSecure();
226 if(secure
&& !_fixedConnection
.endpoint().secure())
228 throw new Ice
.NoEndpointException("");
231 _fixedConnection
.throwException(); // Throw in case our connection is already destroyed.
233 if(defaultsAndOverrides
.overrideCompress
)
235 compress
.value
= defaultsAndOverrides
.overrideCompressValue
;
237 else if(_overrideCompress
)
239 compress
.value
= _compress
;
243 compress
.value
= _fixedConnection
.endpoint().compress();
245 return _fixedConnection
;
249 getConnection(GetConnectionCallback callback
)
253 Ice
.BooleanHolder compress
= new Ice
.BooleanHolder();
254 Ice
.ConnectionI connection
= getConnection(compress
);
255 callback
.setConnection(connection
, compress
.value
);
257 catch(Ice
.LocalException ex
)
259 callback
.setException(ex
);
264 equals(java
.lang
.Object obj
)
270 if(!(obj
instanceof FixedReference
))
274 FixedReference rhs
= (FixedReference
)obj
;
275 if(!super.equals(rhs
))
279 return _fixedConnection
.equals(rhs
._fixedConnection
);
285 return super.hashCode();
288 private Ice
.ConnectionI _fixedConnection
;
289 private static EndpointI
[] _emptyEndpoints
= new EndpointI
[0];