Interface PersistentQueryHandle
- All Known Implementing Classes:
CommunityPersistentQueryHandle
,DoNothingHandle
,EnterprisePersistentQueryHandle
,PersistentQueryHandleBase
public interface PersistentQueryHandle
This interface defines a local handle to a remote Persistent Query. The query may be an Enterprise worker, or a
Community worker.
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Check whether the class of this object can attempt to restore already running workers.getState()
Get the current state object for the Persistent Query.long
Get the currently running version of the Persistent Query.Get theWorkerHandle
for an active worker.default boolean
restore
(PersistentQueryState oldState) Attempt to restore a worker.void
Shutdown the worker, if it is running.void
start
(long shouldStopTimeMillis) Start the worker.
-
Method Details
-
getVersion
long getVersion()Get the currently running version of the Persistent Query.- Returns:
- the version of the running query
-
getState
PersistentQueryState getState()Get the current state object for the Persistent Query.- Returns:
- the current state
-
start
void start(long shouldStopTimeMillis) Start the worker. Only one ofstart()
orrestore()
should be called after construction.- Parameters:
shouldStopTimeMillis
- The scheduled stopping time for scheduled configs, or zero otherwise.
-
restore
Attempt to restore a worker. Only one ofstart()
orrestore()
should be called after construction.- Parameters:
oldState
- the old PQ state from where to attempt to restore- Returns:
- true if the restore attempt succeeded
-
canTryToRestore
default boolean canTryToRestore()Check whether the class of this object can attempt to restore already running workers.- Returns:
- true if the class of this object can attempt to restore an already running worker
-
shutdown
Shutdown the worker, if it is running.- Parameters:
lastAuthenticatedUser
- the authenticating user requesting the shutdownlastEffectiveUser
- the effective user requesting the shuutdown
-
getWorkerHandle
Get theWorkerHandle
for an active worker. May return null if the worker is not running.- Returns:
- the
WorkerHandle
or null if the worker is not running
-