Class RemoteObject<T>

java.lang.Object
septogeddon.pluginquery.library.remote.RemoteObject<T>
Type Parameters:
T - Anything

public class RemoteObject<T> extends Object
RemoteObject controller
Author:
Thito Yalasatria Sunarya
  • Field Details

    • executorService

      protected ExecutorService executorService
    • channel

      protected String channel
    • futureTimeout

      protected long futureTimeout
    • object

      protected T object
    • connection

      protected QueryConnection connection
    • queueQuery

      protected boolean queueQuery
    • lastQueueId

      protected AtomicLong lastQueueId
    • classRegistry

      protected ClassRegistry classRegistry
    • queuedInvocation

      protected Map<Long,RemoteFuture> queuedInvocation
    • context

      protected ReferenceContext context
    • listener

      protected RemoteObject<T>.septogeddon.pluginquery.library.remote.RemoteObject.RemoteListener listener
    • closed

      protected boolean closed
    • crossoverObject

      protected T crossoverObject
    • clazz

      protected Class<T> clazz
  • Constructor Details

    • RemoteObject

      public RemoteObject(String channel, QueryConnection connection, Class<T> clazz, ClassRegistry registry)
      Initialize RemoteObject and act as Object Receiver
      Parameters:
      channel - the channel
      connection - the connection
      clazz - the expected class
      registry - the class registry
    • RemoteObject

      public RemoteObject(String channel, QueryConnection connection, T object, ClassRegistry registry)
      Initialize RemoteObject and act as Object Sender
      Parameters:
      channel - the channel
      connection - the connection
      object - the provided object
      registry - the class registry
  • Method Details

    • getContext

      public ReferenceContext getContext()
      Get the reference context
      Returns:
      reference context for this remote object
    • getClassRegistry

      public ClassRegistry getClassRegistry()
      Get the class registry
      Returns:
      class registry for this remote object
    • isQueueQuery

      public boolean isQueueQuery()
      Is this object queue query when the connection is inactive?
      Returns:
      true if queue is enabled
    • setQueueQuery

      public void setQueueQuery(boolean queueQuery)
      Set whether the remote object should queue the query when the connection goes inactive
      Parameters:
      queueQuery - should queue?
    • getCrossoverObject

      protected T getCrossoverObject() throws TimeoutException
      Throws:
      TimeoutException
    • checkPing

      public boolean checkPing()
      Check if the object is available on the RemoteObject sender
      Returns:
    • ping

      protected void ping() throws TimeoutException
      Throws:
      TimeoutException
    • getExecutorService

      public ExecutorService getExecutorService()
      Get ThreadPooling handler
      Returns:
      the service, null if its run synchronously inside connection thread
    • setExecutorService

      public void setExecutorService(ExecutorService executorService)
      Set handler for ThreadPooling
      Parameters:
      executorService - the service
    • getFutureTimeout

      public long getFutureTimeout()
      Max timeout for object reflection and connection
      Returns:
      -1 if unlimited
    • setFutureTimeout

      public void setFutureTimeout(long futureTimeout)
      Set max timeout for object reflection and connection
      Parameters:
      futureTimeout - -1 for unlimited timeout
    • close

      public void close()
      Close the remote object. Disable for future object processing.
    • isClosed

      public boolean isClosed()
      Is the Remote closed?
      Returns:
      true if its closed
    • nextQueueId

      protected long nextQueueId()
    • getConnection

      public QueryConnection getConnection()
      Get the connection bridge for the remote object
      Returns:
      connection
    • getObject

      public T getObject() throws TimeoutException
      Get the object preserved for this remote connection
      Returns:
      the object
      Throws:
      TimeoutException - if it reaches the timeout time
    • finalizeReferences

      protected void finalizeReferences()
    • submit

      protected void submit(Runnable r)
    • findMethod

      protected Method findMethod(Object refer, String method, Class<?>[] hint, Object... args)
    • unfilter

      protected Object unfilter(Object target) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • filter

      protected Object filter(Object target)
    • closeCrossReference

      protected void closeCrossReference(long id)
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • collect

      protected void collect(Class<?> cl, ArrayList<Class<?>> clazz)
    • preventUnknownObject

      protected void preventUnknownObject(Class<?> cl)
    • newObject

      protected <K extends ObjectReference> K newObject(long id, List<Class<?>> clazz)