public class DynamicSmartStub extends Object implements ProxyInvocationHandler, InvocationHandler, Serializable, Remote, Externalizable, ILRMIProxy
Proxy
this class serves as Interceptor of invoked methods. The invoked method injected by
dynamic-proxy delegates to the direct reference reflection call of exported object, only in case
this DynamicSmartStub still handles a direct reference of exported object getLocalObjImpl()
. If DynamicSmartStub is serializing, as part writeExternal(java.io.ObjectOutput)
method the getLocalObjImpl()
will be exported to
the underlying transport protocol. The serialization process is an indication for
DynamicSmartStub about exiting out side from local JVM.
On deserialization the
DynamicSmartStub will try to aquire the direct localObject reference from the underlying
transport protocol. If direct reference wasn't acquired, it means the stub instance is not in
local JVM. Every future injected method will be called remotely.
LRMIRuntime
,
Serialized FormINTERNAL_NAME
Constructor and Description |
---|
DynamicSmartStub() |
Modifier and Type | Method and Description |
---|---|
void |
closeProxy()
Close the underline proxy connection and resources, this proxy will no longer be usable.
|
void |
disable()
Force this stub to be disabled (disconnected from its target)
|
void |
enable()
Removes state of any previously called
ILRMIProxy.disable() |
boolean |
equals(Object obj)
Equals the DynamicSmartStub instances by direct obj reference if the stubs in local VM,
otherwise equals by remoteObjId
|
static DynamicSmartStub |
extractDynamicSmartStubFrom(Object obj) |
protected void |
finalize() |
String |
getConnectionUrl()
Returns the connectionURL of exported remote object.
|
long |
getGeneratedTraffic() |
protected MethodCachedInvocationHandler |
getInvocationHandler()
returns the initialized remote InvocationHandler
|
Object |
getLocalObjImpl() |
static LRMIOutboundMonitoringDetailsImpl |
getMonitoringDetails() |
long |
getReceivedTraffic() |
String |
getRemoteHostAddress() |
String |
getRemoteHostName() |
InetSocketAddress |
getRemoteNetworkAddress() |
long |
getRemoteObjID() |
long |
getRemoteProcessId() |
PlatformLogicalVersion |
getServicePlatformLogicalVersion() |
StubId |
getStubId() |
int |
hashCode() |
Object |
invoke(Object proxy,
IMethod method,
Object[] args)
Processes a method invocation on a proxy instance and returns the result.
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
Needed for standard java dynamic proxy.
|
protected Object |
invokeRemote(Object proxy,
IMethod method,
Object[] args)
performs remote invocation method
|
boolean |
isClosed() |
boolean |
isCollocated() |
boolean |
isRemote() |
boolean |
isUnexported() |
void |
overrideMethodsMetadata(Map<String,LRMIMethodMetadata> methodsMetadata)
Overrides the LRMI methods metadata.
|
void |
readExternal(ObjectInput in) |
static void |
simulatedDisconnectionByPID(int pid) |
static void |
simulatedReconnectionByPID(int pid) |
static void |
throwProxyClosedExeption(String connectionUrl) |
String |
toString() |
void |
writeExternal(ObjectOutput out) |
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
Throwable
public Object invoke(Object proxy, IMethod method, Object[] args) throws Throwable
invoke
in interface ProxyInvocationHandler
proxy
- the proxy instance that the method was invoked onmethod
- the IMethod
instance corresponding to the interface method invoked
on the proxy instance. The declaring class of the IMethod
object
will be the interface that the method was declared in, which may be a
superinterface of the proxy interface that the proxy class inherits the method
through.args
- an array of objects containing the values of the arguments passed in the method
invocation on the proxy instance, or null
if interface method
takes no arguments. Arguments of primitive types are wrapped in instances of
the appropriate primitive wrapper class, such as java.lang.Integer
or java.lang.Boolean
.null
and the interface method's return type is primitive, then a
NullPointerException
will be thrown by the method invocation on the proxy
instance. If the value returned by this method is otherwise not compatible with the
interface method's declared return type as described above, a ClassCastException
will be thrown by the method invocation on the proxy instance.Throwable
- the exception to throw from the method invocation on the proxy instance.
The exception's type must be assignable either to any of the exception
types declared in the throws
clause of the interface method or
to the unchecked exception types java.lang.RuntimeException
or
java.lang.Error
. If a checked exception is thrown by this
method that is not assignable to any of the exception types declared in the
throws
clause of the interface method, then an UndeclaredThrowableException
containing the exception that was thrown by
this method will be thrown by the method invocation on the proxy instance.UndeclaredThrowableException
protected Object invokeRemote(Object proxy, IMethod method, Object[] args) throws Throwable
Throwable
protected MethodCachedInvocationHandler getInvocationHandler() throws RemoteException
RemoteException
public long getRemoteObjID()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public Object getLocalObjImpl()
null
if this Stub doesn't exist in
local exported VMpublic static DynamicSmartStub extractDynamicSmartStubFrom(Object obj)
obj
- the object to extract DynamicSmartStub instance.null
supplied object is not
DynamicSmartStub invocation handler and not Proxy
.public boolean isCollocated()
true
if this instance of DynamicSmartStub is collocated with
exported endpoint object, otherwise false
if this stub is remote.public int hashCode()
public boolean equals(Object obj)
public boolean isUnexported()
true
if DynamicSmartStub was closedpublic void closeProxy()
ILRMIProxy
closeProxy
in interface ILRMIProxy
public boolean isClosed()
isClosed
in interface ILRMIProxy
public boolean isRemote()
isRemote
in interface ILRMIProxy
public PlatformLogicalVersion getServicePlatformLogicalVersion()
getServicePlatformLogicalVersion
in interface ILRMIProxy
public long getGeneratedTraffic()
getGeneratedTraffic
in interface ILRMIProxy
public long getReceivedTraffic()
getReceivedTraffic
in interface ILRMIProxy
public String getConnectionUrl()
getConnectionUrl
in interface ILRMIProxy
public long getRemoteProcessId()
getRemoteProcessId
in interface ILRMIProxy
public String getRemoteHostName()
getRemoteHostName
in interface ILRMIProxy
public String getRemoteHostAddress()
getRemoteHostAddress
in interface ILRMIProxy
public InetSocketAddress getRemoteNetworkAddress()
getRemoteNetworkAddress
in interface ILRMIProxy
public StubId getStubId()
getStubId
in interface ILRMIProxy
public void disable() throws RemoteException
ILRMIProxy
disable
in interface ILRMIProxy
RemoteException
public void enable() throws RemoteException
ILRMIProxy
ILRMIProxy.disable()
enable
in interface ILRMIProxy
RemoteException
public void overrideMethodsMetadata(Map<String,LRMIMethodMetadata> methodsMetadata)
ILRMIProxy
overrideMethodsMetadata
in interface ILRMIProxy
public static void throwProxyClosedExeption(String connectionUrl) throws ProxyClosedException
ProxyClosedException
public static LRMIOutboundMonitoringDetailsImpl getMonitoringDetails()
protected void finalize() throws Throwable
public static void simulatedDisconnectionByPID(int pid)
public static void simulatedReconnectionByPID(int pid)
Copyright © GigaSpaces.