Class RemoteObject<T>
java.lang.Object
septogeddon.pluginquery.library.remote.RemoteObject<T>
- Type Parameters:
T
- Anything
RemoteObject controller
- Author:
- Thito Yalasatria Sunarya
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected ClassRegistry
protected boolean
protected QueryConnection
protected ReferenceContext
protected T
protected ExecutorService
protected long
protected AtomicLong
protected RemoteObject<T>.septogeddon.pluginquery.library.remote.RemoteObject.RemoteListener
protected T
protected Map
<Long, RemoteFuture> protected boolean
-
Constructor Summary
ConstructorDescriptionRemoteObject
(String channel, QueryConnection connection, Class<T> clazz, ClassRegistry registry) Initialize RemoteObject and act as Object ReceiverRemoteObject
(String channel, QueryConnection connection, T object, ClassRegistry registry) Initialize RemoteObject and act as Object Sender -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if the object is available on the RemoteObject sendervoid
close()
Close the remote object.protected void
closeCrossReference
(long id) protected void
protected Object
protected void
protected Method
findMethod
(Object refer, String method, Class<?>[] hint, Object... args) Get the class registryGet the connection bridge for the remote objectGet the reference contextprotected T
Get ThreadPooling handlerlong
Max timeout for object reflection and connectionGet the object preserved for this remote connectionfinal int
hashCode()
boolean
isClosed()
Is the Remote closed?boolean
Is this object queue query when the connection is inactive?protected <K extends ObjectReference>
Kprotected long
protected void
ping()
protected void
preventUnknownObject
(Class<?> cl) void
setExecutorService
(ExecutorService executorService) Set handler for ThreadPoolingvoid
setFutureTimeout
(long futureTimeout) Set max timeout for object reflection and connectionvoid
setQueueQuery
(boolean queueQuery) Set whether the remote object should queue the query when the connection goes inactiveprotected void
protected Object
-
Field Details
-
executorService
-
channel
-
futureTimeout
protected long futureTimeout -
object
-
connection
-
queueQuery
protected boolean queueQuery -
lastQueueId
-
classRegistry
-
queuedInvocation
-
context
-
listener
protected RemoteObject<T>.septogeddon.pluginquery.library.remote.RemoteObject.RemoteListener listener -
closed
protected boolean closed -
crossoverObject
-
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 channelconnection
- the connectionclazz
- the expected classregistry
- the class registry
-
RemoteObject
Initialize RemoteObject and act as Object Sender- Parameters:
channel
- the channelconnection
- the connectionobject
- the provided objectregistry
- the class registry
-
-
Method Details
-
getContext
Get the reference context- Returns:
- reference context for this remote object
-
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
- Throws:
TimeoutException
-
checkPing
public boolean checkPing()Check if the object is available on the RemoteObject sender- Returns:
-
ping
- Throws:
TimeoutException
-
getExecutorService
Get ThreadPooling handler- Returns:
- the service, null if its run synchronously inside connection thread
-
setExecutorService
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
Get the connection bridge for the remote object- Returns:
- connection
-
getObject
Get the object preserved for this remote connection- Returns:
- the object
- Throws:
TimeoutException
- if it reaches the timeout time
-
finalizeReferences
protected void finalizeReferences() -
submit
-
findMethod
-
unfilter
- Throws:
ClassNotFoundException
-
filter
-
closeCrossReference
protected void closeCrossReference(long id) -
hashCode
public final int hashCode() -
collect
-
preventUnknownObject
-
newObject
-