Class RemoteQueryDispatcher
java.lang.Object
com.illumon.iris.db.tables.remotequery.RemoteQueryDispatcher
- All Implemented Interfaces:
WorkerLeaseHandler.LeaseRecreationCallback
public class RemoteQueryDispatcher
extends Object
implements WorkerLeaseHandler.LeaseRecreationCallback
Dispatcher class to create query workers.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic boolean
static final String
The name of the directory under /etc/sysconfig/deephaven/etcd/client/ that contains our etcd endpoint, user, password, certificate, etc.static final int
What is the maximum frequency which we will try to renew a lease.static final int
How often, in seconds, do we renew our etcd lease.static final int
How long does our etcd lease last in seconds? If we do not renew the lease for this many seconds, then etcd will automatically revoke it; and all of our workers will terminate.static final int
How long will we wait for our etcd lease to be granted or renewed, in milliseconds before determining that we had a failure.static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Invoked After we've recreated the lease, to recreate the status entries for each worker.static io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.node.ArrayNode
static File
static File
getCachedClassDirectory
(String processUserName) static File
static File
getClassDirectoryRoot
(String processUserName) static int
static double
static String
getUserWorkspaceRoot
(String processUserName) static Map<String,
WorkerKind> getWorkerKindMap
(com.fishlib.io.logger.Logger log, com.fishlib.configuration.Configuration configuration) Produce the map of worker kind objects that the dispatcher supports.static void
boolean
Should we recreate leases if the lease has failed?boolean
shutdown()
-
Field Details
-
DISPATCHER_ETCD_RW_CONTEXT
The name of the directory under /etc/sysconfig/deephaven/etcd/client/ that contains our etcd endpoint, user, password, certificate, etc.- See Also:
-
ETCD_LEASE_TTL_SECONDS
public static final int ETCD_LEASE_TTL_SECONDSHow long does our etcd lease last in seconds? If we do not renew the lease for this many seconds, then etcd will automatically revoke it; and all of our workers will terminate. -
ETCD_LEASE_RENEW_SECONDS
public static final int ETCD_LEASE_RENEW_SECONDSHow often, in seconds, do we renew our etcd lease. This must be less thanETCD_LEASE_TTL_SECONDS
; for safety it should be no more than 50% of the TTL value. -
ETCD_LEASE_RENEW_RETRY_DELAY_SECONDS
public static final int ETCD_LEASE_RENEW_RETRY_DELAY_SECONDSWhat is the maximum frequency which we will try to renew a lease. If a lease renewal times out, we will try again more quickly than the standard ETCD_LEASE_RENEW_SECONDS. -
LEASE_KEEPALIVE_TIMEOUT_MS
public static final int LEASE_KEEPALIVE_TIMEOUT_MSHow long will we wait for our etcd lease to be granted or renewed, in milliseconds before determining that we had a failure. -
prefixNonce
public static final long prefixNonce -
ALLOW_RUN_AS
public static boolean ALLOW_RUN_AS
-
-
Constructor Details
-
RemoteQueryDispatcher
public RemoteQueryDispatcher(IrisLogCreator logCreator, String dispatcherHostName) throws IOException, ExecutionException, InterruptedException, TimeoutException
-
-
Method Details
-
getUserWorkspaceRoot
-
getClassDirectoryRoot
-
getClassDirectoryRoot
-
getCachedClassDirectory
-
getCachedClassDirectory
-
getMemoryOverheadMegabytes
public static int getMemoryOverheadMegabytes() -
getMemoryOverheadPercent
public static double getMemoryOverheadPercent() -
getWorkerKindMap
@NotNull public static Map<String,WorkerKind> getWorkerKindMap(com.fishlib.io.logger.Logger log, com.fishlib.configuration.Configuration configuration) Produce the map of worker kind objects that the dispatcher supports.- Parameters:
log
- the logconfiguration
- the configuration object- Returns:
- a Map from name to WorkerKind
-
generateWorkerKindJson
public static io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.node.ArrayNode generateWorkerKindJson(@NotNull Map<String, WorkerKind> map) - Parameters:
map
- map from WorkerKind name to WorkerKind object- Returns:
- JSON string to send to web API and other clients
-
shutdown
public boolean shutdown() -
main
-
shouldRecreateLease
public boolean shouldRecreateLease()Description copied from interface:WorkerLeaseHandler.LeaseRecreationCallback
Should we recreate leases if the lease has failed?- Specified by:
shouldRecreateLease
in interfaceWorkerLeaseHandler.LeaseRecreationCallback
- Returns:
- true if we should attempt to recreate leases
-
doRecreateStatuses
public boolean doRecreateStatuses()Description copied from interface:WorkerLeaseHandler.LeaseRecreationCallback
Invoked After we've recreated the lease, to recreate the status entries for each worker.- Specified by:
doRecreateStatuses
in interfaceWorkerLeaseHandler.LeaseRecreationCallback
- Returns:
- true if all statuses were recreated successfully, false otherwise
-