diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 6 | ||||
-rw-r--r-- | java/src/Ice/ObjectPrxHelper.java | 663 | ||||
-rw-r--r-- | java/src/Ice/ObjectPrxHelperBase.java | 677 | ||||
-rw-r--r-- | java/src/IceInternal/LocatorInfo.java | 14 | ||||
-rw-r--r-- | java/src/IceInternal/OutgoingConnectionFactory.java | 2 | ||||
-rw-r--r-- | java/src/IceInternal/ProxyFactory.java | 6 | ||||
-rw-r--r-- | java/src/IceInternal/Reference.java | 2 | ||||
-rw-r--r-- | java/src/IceInternal/ValueWriter.java | 4 |
8 files changed, 695 insertions, 679 deletions
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index 9330fa67b0c..994282140e8 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -365,7 +365,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt { checkForDeactivation(); - IceInternal.Reference ref = ((ObjectPrxHelper)proxy).__reference(); + IceInternal.Reference ref = ((ObjectPrxHelperBase)proxy).__reference(); return findFacet(ref.identity, ref.facet); } @@ -434,7 +434,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // Add the router's server proxy endpoints to this object // adapter. // - ObjectPrxHelper proxy = (ObjectPrxHelper)routerInfo.getServerProxy(); + ObjectPrxHelperBase proxy = (ObjectPrxHelperBase)routerInfo.getServerProxy(); IceInternal.Endpoint[] endpoints = proxy.__reference().endpoints; for(int i = 0; i < endpoints.length; ++i) { @@ -495,7 +495,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt { checkForDeactivation(); - IceInternal.Reference ref = ((ObjectPrxHelper)proxy).__reference(); + IceInternal.Reference ref = ((ObjectPrxHelperBase)proxy).__reference(); final IceInternal.Endpoint[] endpoints = ref.endpoints; if(!ref.adapterId.equals("")) diff --git a/java/src/Ice/ObjectPrxHelper.java b/java/src/Ice/ObjectPrxHelper.java index 6b02b63ca75..acc0594f104 100644 --- a/java/src/Ice/ObjectPrxHelper.java +++ b/java/src/Ice/ObjectPrxHelper.java @@ -14,473 +14,8 @@ package Ice; -public class ObjectPrxHelper implements ObjectPrx +public class ObjectPrxHelper extends ObjectPrxHelperBase { - public final int - hashCode() - { - return _reference.hashValue; - } - - public final int - ice_hash() - { - return _reference.hashValue; - } - - public final boolean - ice_isA(String __id) - { - return ice_isA(__id, null); - } - - public final boolean - ice_isA(String __id, java.util.Map __context) - { - int __cnt = 0; - while(true) - { - try - { - __checkTwowayOnly("ice_isA"); - _ObjectDel __del = __getDelegate(); - return __del.ice_isA(__id, __context); - } - catch(IceInternal.NonRepeatable __ex) - { - __cnt = __handleException(__ex.get(), __cnt); - } - catch(LocalException __ex) - { - __cnt = __handleException(__ex, __cnt); - } - } - } - - public final void - ice_ping() - { - ice_ping(null); - } - - public final void - ice_ping(java.util.Map __context) - { - int __cnt = 0; - while(true) - { - try - { - __checkTwowayOnly("ice_ping"); - _ObjectDel __del = __getDelegate(); - __del.ice_ping(__context); - return; - } - catch(IceInternal.NonRepeatable __ex) - { - __cnt = __handleException(__ex.get(), __cnt); - } - catch(LocalException __ex) - { - __cnt = __handleException(__ex, __cnt); - } - } - } - - public String[] - ice_ids() - { - return ice_ids(null); - } - - public String[] - ice_ids(java.util.Map __context) - { - int __cnt = 0; - while(true) - { - try - { - __checkTwowayOnly("ice_ids"); - _ObjectDel __del = __getDelegate(); - return __del.ice_ids(__context); - } - catch(IceInternal.NonRepeatable __ex) - { - __cnt = __handleException(__ex.get(), __cnt); - } - catch(LocalException __ex) - { - __cnt = __handleException(__ex, __cnt); - } - } - } - - public String - ice_id() - { - return ice_id(null); - } - - public String - ice_id(java.util.Map __context) - { - int __cnt = 0; - while(true) - { - try - { - __checkTwowayOnly("ice_id"); - _ObjectDel __del = __getDelegate(); - return __del.ice_id(__context); - } - catch(IceInternal.NonRepeatable __ex) - { - __cnt = __handleException(__ex.get(), __cnt); - } - catch(LocalException __ex) - { - __cnt = __handleException(__ex, __cnt); - } - } - } - - public final boolean - ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams) - { - return ice_invoke(operation, mode, inParams, outParams, null); - } - - public final boolean - ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams, - java.util.Map context) - { - int __cnt = 0; - while(true) - { - try - { - _ObjectDel __del = __getDelegate(); - return __del.ice_invoke(operation, mode, inParams, outParams, context); - } - catch(IceInternal.NonRepeatable __ex) - { - if(mode == OperationMode.Nonmutating || mode == OperationMode.Idempotent) - { - __cnt = __handleException(__ex.get(), __cnt); - } - else - { - __rethrowException(__ex.get()); - } - } - catch(LocalException __ex) - { - __cnt = __handleException(__ex, __cnt); - } - } - } - - public final void - ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams) - { - ice_invoke_async(cb, operation, mode, inParams, null); - } - - public final void - ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams, - java.util.Map context) - { - __checkTwowayOnly("ice_invoke_async"); - cb.__invoke(__reference(), operation, mode, inParams, context); - } - - public final Identity - ice_getIdentity() - { - return _reference.identity; - } - - public final ObjectPrx - ice_newIdentity(Identity newIdentity) - { - if(newIdentity.equals(_reference.identity)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(_reference.changeIdentity(newIdentity)); - return proxy; - } - } - - public final java.util.Map - ice_getContext() - { - return _reference.context; - } - - public final ObjectPrx - ice_newContext(java.util.Map newContext) - { - if(newContext.equals(_reference.context)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(_reference.changeContext(newContext)); - return proxy; - } - } - - public final String - ice_getFacet() - { - return _reference.facet; - } - - public final ObjectPrx - ice_newFacet(String newFacet) - { - if(newFacet.equals(_reference.facet)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(_reference.changeFacet(newFacet)); - return proxy; - } - } - - public final ObjectPrx - ice_twoway() - { - IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeTwoway); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final boolean - ice_isTwoway() - { - return _reference.mode == IceInternal.Reference.ModeTwoway; - } - - public final ObjectPrx - ice_oneway() - { - IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeOneway); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final boolean - ice_isOneway() - { - return _reference.mode == IceInternal.Reference.ModeOneway; - } - - public final ObjectPrx - ice_batchOneway() - { - IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeBatchOneway); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final boolean - ice_isBatchOneway() - { - return _reference.mode == IceInternal.Reference.ModeBatchOneway; - } - - public final ObjectPrx - ice_datagram() - { - IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeDatagram); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final boolean - ice_isDatagram() - { - return _reference.mode == IceInternal.Reference.ModeDatagram; - } - - public final ObjectPrx - ice_batchDatagram() - { - IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeBatchDatagram); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final boolean - ice_isBatchDatagram() - { - return _reference.mode == IceInternal.Reference.ModeBatchDatagram; - } - - public final ObjectPrx - ice_secure(boolean b) - { - IceInternal.Reference ref = _reference.changeSecure(b); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final ObjectPrx - ice_compress(boolean co) - { - IceInternal.Reference ref = _reference.changeCompress(co); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final ObjectPrx - ice_timeout(int t) - { - IceInternal.Reference ref = _reference.changeTimeout(t); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final ObjectPrx - ice_router(Ice.RouterPrx router) - { - IceInternal.Reference ref = _reference.changeRouter(router); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final ObjectPrx - ice_locator(Ice.LocatorPrx locator) - { - IceInternal.Reference ref = _reference.changeLocator(locator); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final ObjectPrx - ice_collocationOptimization(boolean b) - { - IceInternal.Reference ref = _reference.changeCollocationOptimization(b); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - public final ObjectPrx - ice_default() - { - IceInternal.Reference ref = _reference.changeDefault(); - if(ref.equals(_reference)) - { - return this; - } - else - { - ObjectPrxHelper proxy = new ObjectPrxHelper(); - proxy.setup(ref); - return proxy; - } - } - - /* public static ObjectPrx checkedCast(Ice.ObjectPrx b) { @@ -528,200 +63,4 @@ public class ObjectPrxHelper implements ObjectPrx } return d; } - */ - - public final boolean - equals(java.lang.Object r) - { - ObjectPrxHelper rhs = (ObjectPrxHelper)r; - return _reference.equals(rhs._reference); - } - - public final IceInternal.Reference - __reference() - { - return _reference; - } - - public final void - __copyFrom(ObjectPrx from) - { - ObjectPrxHelper h = (ObjectPrxHelper)from; - IceInternal.Reference ref = null; - _ObjectDelM delegateM = null; - _ObjectDelD delegateD = null; - - synchronized(from) - { - ref = h._reference; - try - { - delegateM = (_ObjectDelM)h._delegate; - } - catch(ClassCastException ex) - { - } - try - { - delegateD = (_ObjectDelD)h._delegate; - } - catch(ClassCastException ex) - { - } - } - - // - // No need to synchronize "*this", as this operation is only - // called upon initialization. - // - - assert(_reference == null); - assert(_delegate == null); - - _reference = ref; - - if(delegateD != null) - { - _ObjectDelD delegate = __createDelegateD(); - delegate.__copyFrom(delegateD); - _delegate = delegate; - } - else if(delegateM != null) - { - _ObjectDelM delegate = __createDelegateM(); - delegate.__copyFrom(delegateM); - _delegate = delegate; - } - } - - public final int - __handleException(LocalException ex, int cnt) - { - // - // Only _delegate needs to be mutex protected here. - // - synchronized(this) - { - _delegate = null; - } - - if(_reference.locatorInfo != null) - { - _reference.locatorInfo.clearObjectCache(_reference); - } - - IceInternal.ProxyFactory proxyFactory = _reference.instance.proxyFactory(); - if(proxyFactory != null) - { - return proxyFactory.checkRetryAfterException(ex, cnt); - } - else - { - throw ex; // The communicator is already destroyed, so we cannot retry. - } - } - - public final synchronized void - __rethrowException(LocalException ex) - { - _delegate = null; - - if(_reference.locatorInfo != null) - { - _reference.locatorInfo.clearObjectCache(_reference); - } - - throw ex; - } - - public final void - __checkTwowayOnly(String name) - { - // - // No mutex lock necessary, there is nothing mutable in this - // operation. - // - - if(!ice_isTwoway()) - { - TwowayOnlyException ex = new TwowayOnlyException(); - ex.operation = name; - throw ex; - } - } - - public final synchronized _ObjectDel - __getDelegate() - { - if(_delegate == null) - { - if(_reference.collocationOptimization) - { - ObjectAdapter adapter = _reference.instance.objectAdapterFactory().findObjectAdapter(this); - if(adapter != null) - { - _ObjectDelD delegate = __createDelegateD(); - delegate.setup(_reference, adapter); - _delegate = delegate; - } - } - - if(_delegate == null) - { - _ObjectDelM delegate = __createDelegateM(); - delegate.setup(_reference); - _delegate = delegate; - - // - // If this proxy is for a non-local object, and we are - // using a router, then add this proxy to the router info - // object. - // - if(_reference.routerInfo != null) - { - _reference.routerInfo.addProxy(this); - } - } - } - - return _delegate; - } - - protected _ObjectDelM - __createDelegateM() - { - return new _ObjectDelM(); - } - - protected _ObjectDelD - __createDelegateD() - { - return new _ObjectDelD(); - } - - protected java.util.Map - __defaultContext() - { - return _reference.context; - } - - // - // Only for use by IceInternal.ProxyFactory - // - public final void - setup(IceInternal.Reference ref) - { - // - // No need to synchronize, as this operation is only called - // upon initial initialization. - // - - assert(_reference == null); - assert(_delegate == null); - - _reference = ref; - } - - private IceInternal.Reference _reference; - private _ObjectDel _delegate; } diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java new file mode 100644 index 00000000000..aeebbe0c39d --- /dev/null +++ b/java/src/Ice/ObjectPrxHelperBase.java @@ -0,0 +1,677 @@ +// ********************************************************************** +// +// Copyright (c) 2003 +// ZeroC, Inc. +// Billerica, MA, USA +// +// All Rights Reserved. +// +// Ice is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License version 2 as published by +// the Free Software Foundation. +// +// ********************************************************************** + +package Ice; + +public class ObjectPrxHelperBase implements ObjectPrx +{ + public final int + hashCode() + { + return _reference.hashValue; + } + + public final int + ice_hash() + { + return _reference.hashValue; + } + + public final boolean + ice_isA(String __id) + { + return ice_isA(__id, null); + } + + public final boolean + ice_isA(String __id, java.util.Map __context) + { + int __cnt = 0; + while(true) + { + try + { + __checkTwowayOnly("ice_isA"); + _ObjectDel __del = __getDelegate(); + return __del.ice_isA(__id, __context); + } + catch(IceInternal.NonRepeatable __ex) + { + __cnt = __handleException(__ex.get(), __cnt); + } + catch(LocalException __ex) + { + __cnt = __handleException(__ex, __cnt); + } + } + } + + public final void + ice_ping() + { + ice_ping(null); + } + + public final void + ice_ping(java.util.Map __context) + { + int __cnt = 0; + while(true) + { + try + { + __checkTwowayOnly("ice_ping"); + _ObjectDel __del = __getDelegate(); + __del.ice_ping(__context); + return; + } + catch(IceInternal.NonRepeatable __ex) + { + __cnt = __handleException(__ex.get(), __cnt); + } + catch(LocalException __ex) + { + __cnt = __handleException(__ex, __cnt); + } + } + } + + public String[] + ice_ids() + { + return ice_ids(null); + } + + public String[] + ice_ids(java.util.Map __context) + { + int __cnt = 0; + while(true) + { + try + { + __checkTwowayOnly("ice_ids"); + _ObjectDel __del = __getDelegate(); + return __del.ice_ids(__context); + } + catch(IceInternal.NonRepeatable __ex) + { + __cnt = __handleException(__ex.get(), __cnt); + } + catch(LocalException __ex) + { + __cnt = __handleException(__ex, __cnt); + } + } + } + + public String + ice_id() + { + return ice_id(null); + } + + public String + ice_id(java.util.Map __context) + { + int __cnt = 0; + while(true) + { + try + { + __checkTwowayOnly("ice_id"); + _ObjectDel __del = __getDelegate(); + return __del.ice_id(__context); + } + catch(IceInternal.NonRepeatable __ex) + { + __cnt = __handleException(__ex.get(), __cnt); + } + catch(LocalException __ex) + { + __cnt = __handleException(__ex, __cnt); + } + } + } + + public final boolean + ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams) + { + return ice_invoke(operation, mode, inParams, outParams, null); + } + + public final boolean + ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams, + java.util.Map context) + { + int __cnt = 0; + while(true) + { + try + { + _ObjectDel __del = __getDelegate(); + return __del.ice_invoke(operation, mode, inParams, outParams, context); + } + catch(IceInternal.NonRepeatable __ex) + { + if(mode == OperationMode.Nonmutating || mode == OperationMode.Idempotent) + { + __cnt = __handleException(__ex.get(), __cnt); + } + else + { + __rethrowException(__ex.get()); + } + } + catch(LocalException __ex) + { + __cnt = __handleException(__ex, __cnt); + } + } + } + + public final void + ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams) + { + ice_invoke_async(cb, operation, mode, inParams, null); + } + + public final void + ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams, + java.util.Map context) + { + __checkTwowayOnly("ice_invoke_async"); + cb.__invoke(__reference(), operation, mode, inParams, context); + } + + public final Identity + ice_getIdentity() + { + return _reference.identity; + } + + public final ObjectPrx + ice_newIdentity(Identity newIdentity) + { + if(newIdentity.equals(_reference.identity)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(_reference.changeIdentity(newIdentity)); + return proxy; + } + } + + public final java.util.Map + ice_getContext() + { + return _reference.context; + } + + public final ObjectPrx + ice_newContext(java.util.Map newContext) + { + if(newContext.equals(_reference.context)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(_reference.changeContext(newContext)); + return proxy; + } + } + + public final String + ice_getFacet() + { + return _reference.facet; + } + + public final ObjectPrx + ice_newFacet(String newFacet) + { + if(newFacet.equals(_reference.facet)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(_reference.changeFacet(newFacet)); + return proxy; + } + } + + public final ObjectPrx + ice_twoway() + { + IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeTwoway); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final boolean + ice_isTwoway() + { + return _reference.mode == IceInternal.Reference.ModeTwoway; + } + + public final ObjectPrx + ice_oneway() + { + IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeOneway); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final boolean + ice_isOneway() + { + return _reference.mode == IceInternal.Reference.ModeOneway; + } + + public final ObjectPrx + ice_batchOneway() + { + IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeBatchOneway); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final boolean + ice_isBatchOneway() + { + return _reference.mode == IceInternal.Reference.ModeBatchOneway; + } + + public final ObjectPrx + ice_datagram() + { + IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeDatagram); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final boolean + ice_isDatagram() + { + return _reference.mode == IceInternal.Reference.ModeDatagram; + } + + public final ObjectPrx + ice_batchDatagram() + { + IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeBatchDatagram); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final boolean + ice_isBatchDatagram() + { + return _reference.mode == IceInternal.Reference.ModeBatchDatagram; + } + + public final ObjectPrx + ice_secure(boolean b) + { + IceInternal.Reference ref = _reference.changeSecure(b); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final ObjectPrx + ice_compress(boolean co) + { + IceInternal.Reference ref = _reference.changeCompress(co); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final ObjectPrx + ice_timeout(int t) + { + IceInternal.Reference ref = _reference.changeTimeout(t); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final ObjectPrx + ice_router(Ice.RouterPrx router) + { + IceInternal.Reference ref = _reference.changeRouter(router); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final ObjectPrx + ice_locator(Ice.LocatorPrx locator) + { + IceInternal.Reference ref = _reference.changeLocator(locator); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final ObjectPrx + ice_collocationOptimization(boolean b) + { + IceInternal.Reference ref = _reference.changeCollocationOptimization(b); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final ObjectPrx + ice_default() + { + IceInternal.Reference ref = _reference.changeDefault(); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(ref); + return proxy; + } + } + + public final boolean + equals(java.lang.Object r) + { + ObjectPrxHelperBase rhs = (ObjectPrxHelperBase)r; + return _reference.equals(rhs._reference); + } + + public final IceInternal.Reference + __reference() + { + return _reference; + } + + public final void + __copyFrom(ObjectPrx from) + { + ObjectPrxHelperBase h = (ObjectPrxHelperBase)from; + IceInternal.Reference ref = null; + _ObjectDelM delegateM = null; + _ObjectDelD delegateD = null; + + synchronized(from) + { + ref = h._reference; + try + { + delegateM = (_ObjectDelM)h._delegate; + } + catch(ClassCastException ex) + { + } + try + { + delegateD = (_ObjectDelD)h._delegate; + } + catch(ClassCastException ex) + { + } + } + + // + // No need to synchronize "*this", as this operation is only + // called upon initialization. + // + + assert(_reference == null); + assert(_delegate == null); + + _reference = ref; + + if(delegateD != null) + { + _ObjectDelD delegate = __createDelegateD(); + delegate.__copyFrom(delegateD); + _delegate = delegate; + } + else if(delegateM != null) + { + _ObjectDelM delegate = __createDelegateM(); + delegate.__copyFrom(delegateM); + _delegate = delegate; + } + } + + public final int + __handleException(LocalException ex, int cnt) + { + // + // Only _delegate needs to be mutex protected here. + // + synchronized(this) + { + _delegate = null; + } + + if(_reference.locatorInfo != null) + { + _reference.locatorInfo.clearObjectCache(_reference); + } + + IceInternal.ProxyFactory proxyFactory = _reference.instance.proxyFactory(); + if(proxyFactory != null) + { + return proxyFactory.checkRetryAfterException(ex, cnt); + } + else + { + throw ex; // The communicator is already destroyed, so we cannot retry. + } + } + + public final synchronized void + __rethrowException(LocalException ex) + { + _delegate = null; + + if(_reference.locatorInfo != null) + { + _reference.locatorInfo.clearObjectCache(_reference); + } + + throw ex; + } + + public final void + __checkTwowayOnly(String name) + { + // + // No mutex lock necessary, there is nothing mutable in this + // operation. + // + + if(!ice_isTwoway()) + { + TwowayOnlyException ex = new TwowayOnlyException(); + ex.operation = name; + throw ex; + } + } + + public final synchronized _ObjectDel + __getDelegate() + { + if(_delegate == null) + { + if(_reference.collocationOptimization) + { + ObjectAdapter adapter = _reference.instance.objectAdapterFactory().findObjectAdapter(this); + if(adapter != null) + { + _ObjectDelD delegate = __createDelegateD(); + delegate.setup(_reference, adapter); + _delegate = delegate; + } + } + + if(_delegate == null) + { + _ObjectDelM delegate = __createDelegateM(); + delegate.setup(_reference); + _delegate = delegate; + + // + // If this proxy is for a non-local object, and we are + // using a router, then add this proxy to the router info + // object. + // + if(_reference.routerInfo != null) + { + _reference.routerInfo.addProxy(this); + } + } + } + + return _delegate; + } + + protected _ObjectDelM + __createDelegateM() + { + return new _ObjectDelM(); + } + + protected _ObjectDelD + __createDelegateD() + { + return new _ObjectDelD(); + } + + protected java.util.Map + __defaultContext() + { + return _reference.context; + } + + // + // Only for use by IceInternal.ProxyFactory + // + public final void + setup(IceInternal.Reference ref) + { + // + // No need to synchronize, as this operation is only called + // upon initial initialization. + // + + assert(_reference == null); + assert(_delegate == null); + + _reference = ref; + } + + private IceInternal.Reference _reference; + private _ObjectDel _delegate; +} diff --git a/java/src/IceInternal/LocatorInfo.java b/java/src/IceInternal/LocatorInfo.java index f3406ff9fd4..79c35039393 100644 --- a/java/src/IceInternal/LocatorInfo.java +++ b/java/src/IceInternal/LocatorInfo.java @@ -95,7 +95,7 @@ public final class LocatorInfo object = _locator.findAdapterById(ref.adapterId); if(object != null) { - endpoints = ((Ice.ObjectPrxHelper)object).__reference().endpoints; + endpoints = ((Ice.ObjectPrxHelperBase)object).__reference().endpoints; if(endpoints != null && endpoints.length > 0) { @@ -116,13 +116,13 @@ public final class LocatorInfo if(object != null) { - if(((Ice.ObjectPrxHelper)object).__reference().endpoints.length > 0) + if(((Ice.ObjectPrxHelperBase)object).__reference().endpoints.length > 0) { - endpoints = ((Ice.ObjectPrxHelper)object).__reference().endpoints; + endpoints = ((Ice.ObjectPrxHelperBase)object).__reference().endpoints; } - else if(((Ice.ObjectPrxHelper)object).__reference().adapterId.length() > 0) + else if(((Ice.ObjectPrxHelperBase)object).__reference().adapterId.length() > 0) { - endpoints = getEndpoints(((Ice.ObjectPrxHelper)object).__reference(), cached); + endpoints = getEndpoints(((Ice.ObjectPrxHelperBase)object).__reference(), cached); } } @@ -192,7 +192,7 @@ public final class LocatorInfo Ice.ObjectPrx object = _table.removeProxy(ref.identity); if(object != null && ref.instance.traceLevels().location >= 2) { - Reference r = ((Ice.ObjectPrxHelper)object).__reference(); + Reference r = ((Ice.ObjectPrxHelperBase)object).__reference(); if(r.endpoints.length > 0) { trace("removed endpoints from locator table", ref, r.endpoints); @@ -218,7 +218,7 @@ public final class LocatorInfo Ice.ObjectPrx object = _table.removeProxy(ref.identity); if(object != null) { - Reference r = ((Ice.ObjectPrxHelper)object).__reference(); + Reference r = ((Ice.ObjectPrxHelperBase)object).__reference(); if(r.adapterId.length() > 0) { clearCache(r); diff --git a/java/src/IceInternal/OutgoingConnectionFactory.java b/java/src/IceInternal/OutgoingConnectionFactory.java index 8ed9c8fb6a4..3e0a5b49457 100644 --- a/java/src/IceInternal/OutgoingConnectionFactory.java +++ b/java/src/IceInternal/OutgoingConnectionFactory.java @@ -367,7 +367,7 @@ public class OutgoingConnectionFactory Ice.ObjectPrx proxy = routerInfo.getClientProxy(); Ice.ObjectAdapter adapter = routerInfo.getAdapter(); DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); - Endpoint[] endpoints = ((Ice.ObjectPrxHelper)proxy).__reference().endpoints; + Endpoint[] endpoints = ((Ice.ObjectPrxHelperBase)proxy).__reference().endpoints; for(int i = 0; i < endpoints.length; i++) { Endpoint endpoint = endpoints[i]; diff --git a/java/src/IceInternal/ProxyFactory.java b/java/src/IceInternal/ProxyFactory.java index 5a99e370ca2..d07d3114075 100644 --- a/java/src/IceInternal/ProxyFactory.java +++ b/java/src/IceInternal/ProxyFactory.java @@ -28,7 +28,7 @@ public final class ProxyFactory { if(proxy != null) { - Ice.ObjectPrxHelper h = (Ice.ObjectPrxHelper)proxy; + Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)proxy; return h.__reference().toString(); } else @@ -52,7 +52,7 @@ public final class ProxyFactory { if(ref != null) { - Ice.ObjectPrxHelper proxy = new Ice.ObjectPrxHelper(); + Ice.ObjectPrxHelperBase proxy = new Ice.ObjectPrxHelperBase(); proxy.setup(ref); return proxy; } @@ -67,7 +67,7 @@ public final class ProxyFactory { if(proxy != null) { - Ice.ObjectPrxHelper h = (Ice.ObjectPrxHelper)proxy; + Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)proxy; Reference ref = h.__reference(); ref.identity.__write(s); ref.streamWrite(s); diff --git a/java/src/IceInternal/Reference.java b/java/src/IceInternal/Reference.java index 134294b77aa..f4586f8400a 100644 --- a/java/src/IceInternal/Reference.java +++ b/java/src/IceInternal/Reference.java @@ -630,7 +630,7 @@ public final class Reference // proxy endpoints. // Ice.ObjectPrx proxy = routerInfo.getClientProxy(); - endpts = ((Ice.ObjectPrxHelper)proxy).__reference().endpoints; + endpts = ((Ice.ObjectPrxHelperBase)proxy).__reference().endpoints; } else if(endpoints.length > 0) { diff --git a/java/src/IceInternal/ValueWriter.java b/java/src/IceInternal/ValueWriter.java index 9bc2616e0a5..1a4fccd0b44 100644 --- a/java/src/IceInternal/ValueWriter.java +++ b/java/src/IceInternal/ValueWriter.java @@ -68,10 +68,10 @@ public final class ValueWriter writeValue(elem + "value", entry.getValue(), objectTable, out); } } - else if(value instanceof Ice.ObjectPrxHelper) + else if(value instanceof Ice.ObjectPrxHelperBase) { writeName(name, out); - Ice.ObjectPrxHelper proxy = (Ice.ObjectPrxHelper)value; + Ice.ObjectPrxHelperBase proxy = (Ice.ObjectPrxHelperBase)value; out.print(proxy.__reference().toString()); } else if(value instanceof Ice.Object) |