Class PersistentQueryHandleBase
java.lang.Object
com.illumon.iris.controller.handle.PersistentQueryHandleBase
- All Implemented Interfaces:
PersistentQueryHandle
- Direct Known Subclasses:
CommunityPersistentQueryHandle
,DoNothingHandle
,EnterprisePersistentQueryHandle
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PersistentQueryConfiguration
protected final ControllerConfigurationType
protected final ControllerDispatcherHandler
protected final PublicPrivateKeyEncryption
protected final ThreadPoolExecutor
protected final ScriptPathLoader
protected final com.fishlib.io.logger.Logger
protected final String
protected PersistentQueryState
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
PersistentQueryHandleBase
(com.fishlib.io.logger.Logger log, Object queryHandleContext) Create a new PQ Handle. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected abstract WorkerHandle
createWorkerHandle
(RemoteProcessingRequest request, QueryDispatcherConnection dispatcherConnection) protected void
ensureShutdown
(boolean awaitDisconnection) protected String
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.protected boolean
maybeSetTerminalStatus
(Supplier<PersistentQueryState.Status> statusSupplier) protected abstract boolean
onDispatcherConnected
(QueryDispatcherConnection connection) protected void
protected void
protected void
protected abstract void
protected void
protected boolean
restore
(WorkerHandle workerHandle, PersistentQueryState oldState) If this PQ Handle object is being recreated from saved state, instead ofstart
being called this method restores the object.void
Shutdown the worker, if it is running.void
start
(long whenToStopMillis) Start the worker.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.controller.handle.PersistentQueryHandle
canTryToRestore, restore
-
Field Details
-
log
@NotNull protected final com.fishlib.io.logger.Logger log -
configurationType
-
config
-
loader
-
state
-
executorService
-
dispatcherConnectionHandler
-
encryption
-
workerRequestHandle
-
logPrefix
-
-
Constructor Details
-
PersistentQueryHandleBase
protected PersistentQueryHandleBase(@NotNull com.fishlib.io.logger.Logger log, @NotNull Object queryHandleContext) Create a new PQ Handle. Note after creating the object, one of two things should happen: eitherstart
orrestore
should be called.- Parameters:
log
- the log.queryHandleContext
- A context object containing the required parameters for this object.
-
-
Method Details
-
onStartRequested
protected abstract void onStartRequested() -
onDispatcherConnected
-
createWorkerHandle
protected abstract WorkerHandle createWorkerHandle(RemoteProcessingRequest request, QueryDispatcherConnection dispatcherConnection) -
getWorkerHandle
Description copied from interface:PersistentQueryHandle
Get theWorkerHandle
for an active worker. May return null if the worker is not running.- Specified by:
getWorkerHandle
in interfacePersistentQueryHandle
- Returns:
- the
WorkerHandle
or null if the worker is not running
-
getVersion
public long getVersion()Description copied from interface:PersistentQueryHandle
Get the currently running version of the Persistent Query.- Specified by:
getVersion
in interfacePersistentQueryHandle
- Returns:
- the version of the running query
-
getState
Description copied from interface:PersistentQueryHandle
Get the current state object for the Persistent Query.- Specified by:
getState
in interfacePersistentQueryHandle
- Returns:
- the current state
-
start
public void start(long whenToStopMillis) Description copied from interface:PersistentQueryHandle
Start the worker. Only one ofstart()
orrestore()
should be called after construction.- Specified by:
start
in interfacePersistentQueryHandle
- Parameters:
whenToStopMillis
- The scheduled stopping time for scheduled configs, or zero otherwise.
-
restore
If this PQ Handle object is being recreated from saved state, instead ofstart
being called this method restores the object.- Parameters:
workerHandle
- a worker handle to use as our own- Returns:
- true if we were able to restore this object, false otherwise
-
shutdown
Description copied from interface:PersistentQueryHandle
Shutdown the worker, if it is running.- Specified by:
shutdown
in interfacePersistentQueryHandle
- Parameters:
lastAuthenticatedUser
- the authenticating user requesting the shutdownlastEffectiveUser
- the effective user requesting the shuutdown
-
ensureShutdown
protected void ensureShutdown(boolean awaitDisconnection) - Parameters:
awaitDisconnection
- Used to communicate whether we need to care further about ensuring disconnection, or not. If true, we block until interrupted or until another thread calls ensureShutdown(false). If false, we're asserting that the DB is already disconnected, or that we don't care (because no script was run yet).
-
checkQueryTerminatingOrTerminal
protected boolean checkQueryTerminatingOrTerminal() -
maybeSetTerminalStatus
-
onError
-
onFailure
-
onFailure
-
publishState
protected void publishState() -
getScriptCode
-