Package com.gigaspaces.lrmi
Class RemoteStub<T>
java.lang.Object
com.gigaspaces.lrmi.RemoteStub<T>
- All Implemented Interfaces:
ILRMIProxy,SmartExternalizable,Externalizable,Serializable,Remote
- Direct Known Subclasses:
LRMIJSpaceContainer,LRMIJSpaceProxyListener,LRMIRemoteEventListener,LRMISpaceImpl,QueryProcessorStub
The
RemoteStub class is the common superclass to client stubs and provides the
framework to support a wide range of remote reference semantics. Stub objects are surrogates
that support exactly the same set of remote interfaces defined by the actual implementation of
the remote object.- Since:
- 5.2
- Author:
- Igor Goldenberg
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteStub(T directObjRef, T dynamicProxy) Constructor to initialize extended stub-class. -
Method Summary
Modifier and TypeMethodDescriptionvoidClose the underline proxy connection and resources, this proxy will no longer be usable.voiddisable()Force this stub to be disabled (disconnected from its target)voidenable()Removes state of any previously calledILRMIProxy.disable()booleanlonggetProxy()longlonginthashCode()protected static voidInitialize the abstract logic of extended stub.booleanisClosed()booleanstatic booleanisCollocatedStub(Object obj) Returnstrueif supplied object instance isRemoteStuband collocate with RemoteStub endpoint.booleanisDirect()booleanisRemote()static booleanReturnstrueif supplied object isRemoteStub.voidoverrideMethodsMetadata(Map<String, LRMIMethodMetadata> methodsMetadata) Overrides the LRMI methods metadata.voidtoString()voidMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.gigaspaces.serialization.SmartExternalizable
enabledSmartExternalizableWithReference
-
Constructor Details
-
RemoteStub
public RemoteStub() -
RemoteStub
Constructor to initialize extended stub-class.- Parameters:
directObjRef- the direct object reference. To save dynamic-proxy invocation call.dynamicProxy- the dynamic proxy of this stub.- Throws:
IllegalArgumentException- dynamicProxy isnull.
-
-
Method Details
-
getProxy
- Returns:
- the direct object reference or dynamic proxy if this stub was serialized.
-
getDynamicProxy
-
isDirect
public boolean isDirect() -
init
Initialize the abstract logic of extended stub. The best practice to call this method from static initializer of extended stub-class. This method callinitCall.call()- Parameters:
initCall- theCallableinterface with abstract init logic within call() method.
-
equals
-
hashCode
public int hashCode() -
toString
-
isStub
Returnstrueif supplied object isRemoteStub.- Parameters:
obj- the object to check.- Returns:
trueif supplied object isRemoteStub.
-
isCollocated
public boolean isCollocated()- Returns:
trueif RemoteStub instance is collocated with exported endpoint object and communication performs via direct endpoint object reference(No network/socket), otherwisefalseif communication performs via socket.
-
isCollocatedStub
Returnstrueif supplied object instance isRemoteStuband collocate with RemoteStub endpoint.- Parameters:
obj- the object instance to check.- Returns:
trueif object embedded stub, otherwisefalse.
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
getServicePlatformLogicalVersion
- Specified by:
getServicePlatformLogicalVersionin interfaceILRMIProxy- Returns:
- returns the logical version of the service
-
isRemote
public boolean isRemote()- Specified by:
isRemotein interfaceILRMIProxy- Returns:
- whether this proxy is connected to a remote stub
-
getStubId
- Specified by:
getStubIdin interfaceILRMIProxy- Returns:
- the stub id
-
getGeneratedTraffic
public long getGeneratedTraffic()- Specified by:
getGeneratedTrafficin interfaceILRMIProxy- Returns:
- entire traffic generated by this proxy in bytes, this number is not necessarily monotonic as each connection in the stub holds this data per connection, once this connection is disconnected/reconnected this data is reseted.
-
getReceivedTraffic
public long getReceivedTraffic()- Specified by:
getReceivedTrafficin interfaceILRMIProxy- Returns:
- entire traffic received by this proxy in bytes this number is not necessarily monotonic as each connection in the stub holds this data per connection, once this connection is disconnected/reconnected this data is reseted.
-
getConnectionUrl
- Specified by:
getConnectionUrlin interfaceILRMIProxy- Returns:
- the connection url of the stub
-
getRemoteProcessId
public long getRemoteProcessId()- Specified by:
getRemoteProcessIdin interfaceILRMIProxy- Returns:
- the process id of the stub
-
getRemoteHostName
- Specified by:
getRemoteHostNamein interfaceILRMIProxy- Returns:
- return the host name of the stub
-
getRemoteHostAddress
- Specified by:
getRemoteHostAddressin interfaceILRMIProxy- Returns:
- return the host address of the stub
-
getRemoteNetworkAddress
- Specified by:
getRemoteNetworkAddressin interfaceILRMIProxy- Returns:
- the ip address + port of the stub
-
disable
Description copied from interface:ILRMIProxyForce this stub to be disabled (disconnected from its target)- Specified by:
disablein interfaceILRMIProxy- Throws:
RemoteException
-
enable
Description copied from interface:ILRMIProxyRemoves state of any previously calledILRMIProxy.disable()- Specified by:
enablein interfaceILRMIProxy- Throws:
RemoteException
-
overrideMethodsMetadata
Description copied from interface:ILRMIProxyOverrides the LRMI methods metadata. Can only be used before first invocation.- Specified by:
overrideMethodsMetadatain interfaceILRMIProxy
-
closeProxy
public void closeProxy()Description copied from interface:ILRMIProxyClose the underline proxy connection and resources, this proxy will no longer be usable.- Specified by:
closeProxyin interfaceILRMIProxy
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceILRMIProxy- Returns:
- true if this proxy is closed.
-