Class BaseWorker
java.lang.Object
com.illumon.iris.db.tables.remotequery.process.BaseWorker
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,KeepAliveWorker,Worker
- Direct Known Subclasses:
K8SWorkerImpl
This abstract class implements the
Worker interface, which the RemoteQueryDispatcher now uses.
The fields of this class were extracted from the RemoteQueryDispatcher and getter/setter methods
were added.-
Field Summary
FieldsFields inherited from interface com.illumon.iris.db.tables.remotequery.Worker
processUser -
Method Summary
Modifier and TypeMethodDescriptioncom.fishlib.base.log.LogOutputappend(com.fishlib.base.log.LogOutput logOutput) intReturns the additional allocated memory for this worker.Returns the artifactDirectory of this WorkerReturns the auth token for this WorkerlongReturns the cancelledTimeNS of this WorkerReturns the clientClassDirectory of this WorkerReturns the client connection address this Worker, which could be a hostname, IP, FQDN, service name, endpoint, etc.Returns the compiledClassDirectory of this WorkerReturns the dispatcherHostName of this WorkerReturns the name of this dispatcher used by etcd for discoveryintReturns the heapSizeMB of this WorkerReturns the last posted status for this Worker; Note it can be null if no status posted yet.Returns the last few lines captured from the worker's syserr.getName()Returns the name of this Worker.intgetPid()Returns the pid of this WorkerReturns the port of this WorkerReturns the processEventLogLogger of this WorkerReturns the unique id of this Worker processThe protocol that should be used to communicate with this worker.Returns the remoteProcessingRequest of this WorkerbooleanGet if the worker has been completely started and is reachable.longReturn the worker's TTL expiration (in millis since the epoch).Returns the userName of this WorkerDefaults to null, but allows K8S workers to specify a hostname for the worker, since each worker will have its own pod name.Returns the id of this WorkerReturns the nonce for registering this worker processbooleanimplementsProtocol(String protocol) Does this worker implement a given protocol?booleanReturns the isFinished status of this WorkerbooleanReturns the isJvmDestroySent status of this WorkerbooleanReturns true if this worker is registered.booleansetCancelledTimeNS(long cancelledTimeNS) Set the cancelledTimeNS for this workervoidsetJvmDestroySent(boolean jvmDestroySent) Sets the jvmDestroySent status of this WorkervoidsetLastPostedStatus(DispatcherClientConstants.PostedWorkerStatus newLastPostedStatus) Set the last posted status for this WorkervoidSet that this worker is registered.voidsetStarted(boolean started) Set if the worker has been completely started and is reachable.booleanSet the terminateRequestSent for this workervoidsetTimeToLive(long ttl) Set the time to live (in millis since the epoch).protected voidsleepFor(long millis) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.db.tables.remotequery.Worker
getProcessUserName, getWorkerKind, requestThreadDump, setProcessUserName, start, terminate
-
Field Details
-
log
protected final com.fishlib.io.logger.Logger log -
clientConnectionAddress
-
-
Method Details
-
append
public com.fishlib.base.log.LogOutput append(com.fishlib.base.log.LogOutput logOutput) - Specified by:
appendin interfacecom.fishlib.base.log.LogOutputAppendable
-
getName
Description copied from interface:KeepAliveWorkerReturns the name of this Worker.- Specified by:
getNamein interfaceKeepAliveWorker- Returns:
- the name of this Worker
-
getWorkerId
Description copied from interface:WorkerReturns the id of this Worker- Specified by:
getWorkerIdin interfaceWorker- Returns:
- the id of this Worker
-
getProcessInfoId
Description copied from interface:KeepAliveWorkerReturns the unique id of this Worker process- Specified by:
getProcessInfoIdin interfaceKeepAliveWorker- Returns:
- the unique id of this Worker process
-
getWorkerNonce
Description copied from interface:KeepAliveWorkerReturns the nonce for registering this worker process- Specified by:
getWorkerNoncein interfaceKeepAliveWorker- Returns:
- the nonce used for registration
-
getClientConnectionAddress
Description copied from interface:WorkerReturns the client connection address this Worker, which could be a hostname, IP, FQDN, service name, endpoint, etc. Clients will connect to the Worker via ClientConnectionAddress:Port- Specified by:
getClientConnectionAddressin interfaceWorker- Returns:
- the clientConnectionAddress of this Worker
-
getUserName
Description copied from interface:WorkerReturns the userName of this Worker- Specified by:
getUserNamein interfaceWorker- Returns:
- the userName of this Worker
-
getRemoteProcessingRequest
Description copied from interface:WorkerReturns the remoteProcessingRequest of this Worker- Specified by:
getRemoteProcessingRequestin interfaceWorker- Returns:
- the remoteProcessingRequest of this Worker.
-
getClientClassDirectory
Description copied from interface:WorkerReturns the clientClassDirectory of this Worker- Specified by:
getClientClassDirectoryin interfaceWorker- Returns:
- the clientClassDirectory of this Worker.
-
getHeapSizeMB
public int getHeapSizeMB()Description copied from interface:WorkerReturns the heapSizeMB of this Worker- Specified by:
getHeapSizeMBin interfaceWorker- Returns:
- the heapSizeMB of this Worker.
-
getAdditionalMemoryMB
public int getAdditionalMemoryMB()Description copied from interface:WorkerReturns the additional allocated memory for this worker.- Specified by:
getAdditionalMemoryMBin interfaceWorker- Returns:
- the additional memory allocated for this worker, in megabytes
-
getPort
Description copied from interface:WorkerReturns the port of this Worker -
implementsProtocol
Description copied from interface:WorkerDoes this worker implement a given protocol?- Specified by:
implementsProtocolin interfaceWorker- Parameters:
protocol- the protocol to check this worker for- Returns:
- whether the worker supports the requested protocol
-
getProtocols
Description copied from interface:WorkerThe protocol that should be used to communicate with this worker. Values that are currently defined are "Enterprise", "EnterpriseWebsocket" or "Community", but the dispatcher itself does not care, it just passes it to the client- Specified by:
getProtocolsin interfaceWorker- Returns:
- the protocols that the worker implement
-
isRegistered
public boolean isRegistered()Description copied from interface:KeepAliveWorkerReturns true if this worker is registered.- Specified by:
isRegisteredin interfaceKeepAliveWorker
-
setRegistered
public void setRegistered()Description copied from interface:WorkerSet that this worker is registered.- Specified by:
setRegisteredin interfaceWorker
-
getPid
public int getPid()Description copied from interface:WorkerReturns the pid of this Worker -
isFinished
public boolean isFinished()Description copied from interface:KeepAliveWorkerReturns the isFinished status of this Worker- Specified by:
isFinishedin interfaceKeepAliveWorker- Returns:
- the isFinished status of this Worker
-
getCompiledClassDirectory
Description copied from interface:WorkerReturns the compiledClassDirectory of this Worker- Specified by:
getCompiledClassDirectoryin interfaceWorker- Returns:
- the compiledClassDirectory of this Worker
-
getArtifactDirectory
Description copied from interface:WorkerReturns the artifactDirectory of this Worker- Specified by:
getArtifactDirectoryin interfaceWorker- Returns:
- the artifactDirectory of this Worker
-
getAuthToken
Description copied from interface:WorkerReturns the auth token for this Worker- Specified by:
getAuthTokenin interfaceWorker
-
getCancelledTimeNS
public long getCancelledTimeNS()Description copied from interface:WorkerReturns the cancelledTimeNS of this Worker- Specified by:
getCancelledTimeNSin interfaceWorker- Returns:
- the cancelledTimeNS of this Worker
-
setCancelledTimeNS
public boolean setCancelledTimeNS(long cancelledTimeNS) Description copied from interface:WorkerSet the cancelledTimeNS for this worker- Specified by:
setCancelledTimeNSin interfaceWorker- Parameters:
cancelledTimeNS- the port for this worker- Returns:
- true if the cancellation time was set, false if the worker was already cancelled
-
setTerminateRequestSent
public boolean setTerminateRequestSent()Description copied from interface:WorkerSet the terminateRequestSent for this worker- Specified by:
setTerminateRequestSentin interfaceWorker- Returns:
- true if the termination request was set, false if the termination request sent field has already been set
-
isJvmDestroySent
public boolean isJvmDestroySent()Description copied from interface:WorkerReturns the isJvmDestroySent status of this Worker- Specified by:
isJvmDestroySentin interfaceWorker- Returns:
- the isJvmDestroySent status of this Worker
-
setJvmDestroySent
public void setJvmDestroySent(boolean jvmDestroySent) Description copied from interface:WorkerSets the jvmDestroySent status of this Worker- Specified by:
setJvmDestroySentin interfaceWorker- Parameters:
jvmDestroySent- status of this Worker
-
getProcessEventLogLogger
Description copied from interface:WorkerReturns the processEventLogLogger of this Worker- Specified by:
getProcessEventLogLoggerin interfaceWorker- Returns:
- the processEventLogLogger of this Worker
-
getDispatcherHostName
Description copied from interface:WorkerReturns the dispatcherHostName of this Worker- Specified by:
getDispatcherHostNamein interfaceWorker- Returns:
- the dispatcherHostName of this Worker
-
getDispatcherNameForDiscovery
Description copied from interface:WorkerReturns the name of this dispatcher used by etcd for discovery- Specified by:
getDispatcherNameForDiscoveryin interfaceWorker- Returns:
- the discovery name for this dispatcher
-
getLatestErrorMessages
Description copied from interface:WorkerReturns the last few lines captured from the worker's syserr.- Specified by:
getLatestErrorMessagesin interfaceWorker- Returns:
- the last few lines from the worker's syserr
-
getWorkerHostname
Defaults to null, but allows K8S workers to specify a hostname for the worker, since each worker will have its own pod name.- Specified by:
getWorkerHostnamein interfaceWorker- Returns:
- The hostname of the worker.
-
getTimeToLiveExpiration
public long getTimeToLiveExpiration()Description copied from interface:KeepAliveWorkerReturn the worker's TTL expiration (in millis since the epoch).- Specified by:
getTimeToLiveExpirationin interfaceKeepAliveWorker- Returns:
- the maximum time that the worker has renewed it's TTL
-
setTimeToLive
public void setTimeToLive(long ttl) Description copied from interface:KeepAliveWorkerSet the time to live (in millis since the epoch).- Specified by:
setTimeToLivein interfaceKeepAliveWorker
-
getLastPostedStatus
Description copied from interface:KeepAliveWorkerReturns the last posted status for this Worker; Note it can be null if no status posted yet.- Specified by:
getLastPostedStatusin interfaceKeepAliveWorker- Returns:
- the last posted status for this Worker
-
setLastPostedStatus
Description copied from interface:KeepAliveWorkerSet the last posted status for this Worker- Specified by:
setLastPostedStatusin interfaceKeepAliveWorker
-
sleepFor
protected void sleepFor(long millis) -
getStarted
public boolean getStarted()Description copied from interface:WorkerGet if the worker has been completely started and is reachable. This is different from the worker being registered, which means the worker has phoned home that it is ready to accept connections.- Specified by:
getStartedin interfaceWorker- Returns:
- true if the worker has been started
-
setStarted
public void setStarted(boolean started) Description copied from interface:WorkerSet if the worker has been completely started and is reachable.- Specified by:
setStartedin interfaceWorker- Parameters:
started- true if the worker has been started
-