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

public class RemoteStub<T> extends Object implements Remote, SmartExternalizable, ILRMIProxy
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 Details

    • RemoteStub

      public RemoteStub()
    • RemoteStub

      public RemoteStub(T directObjRef, T dynamicProxy)
      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 is null.
  • Method Details

    • getProxy

      public T getProxy()
      Returns:
      the direct object reference or dynamic proxy if this stub was serialized.
    • getDynamicProxy

      public T getDynamicProxy()
    • isDirect

      public boolean isDirect()
    • init

      protected static void init(Callable initCall)
      Initialize the abstract logic of extended stub. The best practice to call this method from static initializer of extended stub-class. This method call initCall.call()
      Parameters:
      initCall - the Callable interface with abstract init logic within call() method.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isStub

      public static boolean isStub(Object obj)
      Returns true if supplied object is RemoteStub.
      Parameters:
      obj - the object to check.
      Returns:
      true if supplied object is RemoteStub.
    • isCollocated

      public boolean isCollocated()
      Returns:
      true if RemoteStub instance is collocated with exported endpoint object and communication performs via direct endpoint object reference(No network/socket), otherwise false if communication performs via socket.
    • isCollocatedStub

      public static boolean isCollocatedStub(Object obj)
      Returns true if supplied object instance is RemoteStub and collocate with RemoteStub endpoint.
      Parameters:
      obj - the object instance to check.
      Returns:
      true if object embedded stub, otherwise false.
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException
    • getServicePlatformLogicalVersion

      public PlatformLogicalVersion getServicePlatformLogicalVersion()
      Specified by:
      getServicePlatformLogicalVersion in interface ILRMIProxy
      Returns:
      returns the logical version of the service
    • isRemote

      public boolean isRemote()
      Specified by:
      isRemote in interface ILRMIProxy
      Returns:
      whether this proxy is connected to a remote stub
    • getStubId

      public StubId getStubId()
      Specified by:
      getStubId in interface ILRMIProxy
      Returns:
      the stub id
    • getGeneratedTraffic

      public long getGeneratedTraffic()
      Specified by:
      getGeneratedTraffic in interface ILRMIProxy
      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:
      getReceivedTraffic in interface ILRMIProxy
      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

      public String getConnectionUrl()
      Specified by:
      getConnectionUrl in interface ILRMIProxy
      Returns:
      the connection url of the stub
    • getRemoteProcessId

      public long getRemoteProcessId()
      Specified by:
      getRemoteProcessId in interface ILRMIProxy
      Returns:
      the process id of the stub
    • getRemoteHostName

      public String getRemoteHostName()
      Specified by:
      getRemoteHostName in interface ILRMIProxy
      Returns:
      return the host name of the stub
    • getRemoteHostAddress

      public String getRemoteHostAddress()
      Specified by:
      getRemoteHostAddress in interface ILRMIProxy
      Returns:
      return the host address of the stub
    • getRemoteNetworkAddress

      public InetSocketAddress getRemoteNetworkAddress()
      Specified by:
      getRemoteNetworkAddress in interface ILRMIProxy
      Returns:
      the ip address + port of the stub
    • disable

      public void disable() throws RemoteException
      Description copied from interface: ILRMIProxy
      Force this stub to be disabled (disconnected from its target)
      Specified by:
      disable in interface ILRMIProxy
      Throws:
      RemoteException
    • enable

      public void enable() throws RemoteException
      Description copied from interface: ILRMIProxy
      Removes state of any previously called ILRMIProxy.disable()
      Specified by:
      enable in interface ILRMIProxy
      Throws:
      RemoteException
    • overrideMethodsMetadata

      public void overrideMethodsMetadata(Map<String,LRMIMethodMetadata> methodsMetadata)
      Description copied from interface: ILRMIProxy
      Overrides the LRMI methods metadata. Can only be used before first invocation.
      Specified by:
      overrideMethodsMetadata in interface ILRMIProxy
    • closeProxy

      public void closeProxy()
      Description copied from interface: ILRMIProxy
      Close the underline proxy connection and resources, this proxy will no longer be usable.
      Specified by:
      closeProxy in interface ILRMIProxy
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface ILRMIProxy
      Returns:
      true if this proxy is closed.