Class RemoteObject<T>
java.lang.Object
septogeddon.pluginquery.library.remote.RemoteObject<T>
- Type Parameters:
T- Anything
RemoteObject controller
- Author:
- Thito Yalasatria Sunarya
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected ClassRegistryprotected booleanprotected QueryConnectionprotected ReferenceContextprotected Tprotected ExecutorServiceprotected longprotected AtomicLongprotected RemoteObject<T>.septogeddon.pluginquery.library.remote.RemoteObject.RemoteListenerprotected Tprotected Map<Long, RemoteFuture> protected boolean -
Constructor Summary
ConstructorsConstructorDescriptionRemoteObject(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 TypeMethodDescriptionbooleanCheck if the object is available on the RemoteObject sendervoidclose()Close the remote object.protected voidcloseCrossReference(long id) protected voidprotected Objectprotected voidprotected MethodfindMethod(Object refer, String method, Class<?>[] hint, Object... args) Get the class registryGet the connection bridge for the remote objectGet the reference contextprotected TGet ThreadPooling handlerlongMax timeout for object reflection and connectionGet the object preserved for this remote connectionfinal inthashCode()booleanisClosed()Is the Remote closed?booleanIs this object queue query when the connection is inactive?protected <K extends ObjectReference>
Kprotected longprotected voidping()protected voidpreventUnknownObject(Class<?> cl) voidsetExecutorService(ExecutorService executorService) Set handler for ThreadPoolingvoidsetFutureTimeout(long futureTimeout) Set max timeout for object reflection and connectionvoidsetQueueQuery(boolean queueQuery) Set whether the remote object should queue the query when the connection goes inactiveprotected voidprotected 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
-