Class QueryDispatcherConnectionImpl
java.lang.Object
com.illumon.iris.db.tables.remotequery.QueryDispatcherConnectionImpl
- All Implemented Interfaces:
com.fishlib.dataobjects.HashCommandConstants,RemoteQueryCommandConstants,QueryDispatcherConnection,io.deephaven.enterprise.comm.api.CommandHandler,io.deephaven.enterprise.comm.BaseCommandConstants
public class QueryDispatcherConnectionImpl
extends Object
implements RemoteQueryCommandConstants, io.deephaven.enterprise.comm.api.CommandHandler, QueryDispatcherConnection
Implementation of
QueryDispatcherConnection.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.illumon.iris.db.tables.remotequery.QueryDispatcherConnection
QueryDispatcherConnection.JobInfo, QueryDispatcherConnection.QueryProcessorRequestHandle -
Field Summary
FieldsFields inherited from interface io.deephaven.enterprise.comm.BaseCommandConstants
PING, PONG, REGISTER_QUEUE_LISTENER, RESPONSEFields inherited from interface com.fishlib.dataobjects.HashCommandConstants
HASHTABLE_CLEAR, HASHTABLE_GET_ALL_ENTRIES, HASHTABLE_GET_KEYS, HASHTABLE_PUT, HASHTABLE_PUTALL, HASHTABLE_REMOVE, HASHTABLE_REMOVEALL, HASHTABLE_SUBSCRIBE, HASHTABLE_UNSUBSCRIBEFields inherited from interface com.illumon.iris.db.RemoteQueryCommandConstants
CANCEL_REMOTE_QUERY, CURRENT_HEAP_UPDATE, GET_TABLE_PARTITION_ID, LOG_BUFFER_RECORD, LOG_BUFFER_SUBSCRIPTION, MAXIMUM_HEAP_REQUEST, PROGRESS_UPDATE, REGISTER, REMOTE_QUERY_CONCURRENT, REMOTE_QUERY_DISPATCHER_ADD_JOB, REMOTE_QUERY_DISPATCHER_ADMIN_COMMAND, REMOTE_QUERY_DISPATCHER_CANCEL_JOB, REMOTE_QUERY_DISPATCHER_INFO_FOR_JOB, REMOTE_QUERY_DISPATCHER_PUSH_CLASSES, REMOTE_QUERY_DISPATCHER_THREAD_DUMP, REMOTE_QUERY_FATAL_ERROR, REMOTE_QUERY_GET_SCOPE_VAR, REMOTE_QUERY_METHOD_CALL, REMOTE_QUERY_PREEMPTIVE_TABLE_DELTA, REMOTE_QUERY_PREEMPTIVE_TABLE_SNAPSHOT, REMOTE_QUERY_PREEMPTIVE_TABLE_SUBSCRIPTION, REMOTE_QUERY_PROCESSOR_TERMINATE, REMOTE_QUERY_RELEASE_REFERENCE, REMOTE_QUERY_SERIAL, REMOTE_QUERY_TABLE_ERROR, REMOTE_TABLE_HANDLE_CREATE, REMOTE_TABLE_HANDLE_UPDATE, REMOTE_TABLE_MAP_KEY_ADDITION, REMOTE_TABLE_MAP_RELEASE, RTLM_CREATE_LOGGER, RTLM_DELETE_TABLE, SERVER_INFO_REQUEST, SUBSCRIBE_USAGE_UPDATES -
Method Summary
Modifier and TypeMethodDescriptionstatic QueryDispatcherConnectionstatic QueryDispatcherConnectiongetConnection(com.fishlib.io.logger.Logger log, String dispatcherHost, int dispatcherPort, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams) static QueryDispatcherConnectiongetConnection(com.fishlib.io.logger.Logger log, String dispatcherHost, int dispatcherPort, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, TokenFactoryFactory tokenAuthenticationManager) static QueryDispatcherConnectiongetConnection(com.fishlib.io.logger.Logger log, String dispatcherHost, int dispatcherPort, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, TokenFactoryFactory tokenAuthenticationManager, BiConsumer<io.deephaven.enterprise.comm.api.ClientEntry, com.fishlib.base.Command> commandHandler, Consumer<io.deephaven.enterprise.comm.api.ClientEntry> clientDeathHandler, Consumer<QueryDispatcherConnection> newConnectionConsumer) Factory method to get a QueryDispatcherConnection for remote queries.static QueryDispatcherConnectiongetConnection(com.fishlib.io.logger.Logger log, String dispatcherHost, int dispatcherPort, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, BiConsumer<io.deephaven.enterprise.comm.api.ClientEntry, com.fishlib.base.Command> commandHandler, Consumer<io.deephaven.enterprise.comm.api.ClientEntry> clientDeathHandler, Consumer<QueryDispatcherConnection> newConnectionConsumer) static QueryDispatcherConnectiongetConnection(io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams) static QueryDispatcherConnectiongetConnection(io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, TokenFactoryFactory tokenAuthenticationManager) static QueryDispatcherConnectiongetConnection(String dispatcherHost, int dispatcherPort) static QueryDispatcherConnectiongetConnection(String dispatcherHost, int dispatcherPort, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams) static QueryDispatcherConnectiongetConnection(String dispatcherHost, int dispatcherPort, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, TokenFactoryFactory tokenAuthenticationManager) static QueryDispatcherConnectiongetConnectionIfAvailable(TokenFactoryFactory tokenAuthenticationManager, String dispatcherHost, int dispatcherPort) Factory method to get a QueryDispatcherConnection for remote queries.static QueryDispatcherConnectiongetConnectionIfAvailable(String dispatcherHost, int dispatcherPort) getQueryProcessor(boolean addClientClassesToClassPath, List<RemoteQueryClassDefinition> classList, long timeoutMillis) Gets a query processor assigned by the dispatcher, optionally pushing client classes.getQueryProcessor(QueryDispatcherConnection.QueryProcessorRequestHandle handle, RemoteProcessingRequest request, boolean exportQueryScope, List<RemoteQueryClassDefinition> classList, long timeoutMillis, QueryProcessorConnection.DisconnectHandler disconnectHandler, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams) Gets a query processor assigned by the dispatcher, and pushes client classes for use in future queries.getQueryProcessor(QueryDispatcherConnection.QueryProcessorRequestHandle handle, RemoteProcessingRequest request, boolean exportQueryScope, List<RemoteQueryClassDefinition> classList, long timeoutMillis, QueryProcessorConnection.DisconnectHandler disconnectHandler, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, TokenFactoryFactory tokenAuthenticationManager) Gets a query processor assigned by the dispatcher, and pushes client classes for use in future queries.getQueryProcessor(RemoteProcessingRequest request, List<RemoteQueryClassDefinition> classList) Gets a query processor assigned by the dispatcher, and pushes client classes for use in future queries.getQueryProcessor(RemoteProcessingRequest request, List<RemoteQueryClassDefinition> classList, long timeoutMillis) getQueryProcessorRequestHandle(boolean combineWorkerConnectionStats) Create a new, single-use handle for use in requesting a new query processor.getQueryProcessorRequestHandle(boolean combineWorkerConnectionStats, Consumer<String> eventConsumer) Create a new, single-use handle for use in requesting a new query processor.voidhandleClientDeath(io.deephaven.enterprise.comm.api.ClientEntry client) voidhandleCommand(io.deephaven.enterprise.comm.api.ClientEntry client, com.fishlib.base.Command comm) booleanvoidpushClientClasses(List<RemoteQueryClassDefinition> classList) Pushes client classes to the dispatcher for use in future queries.voidrelease(boolean force) This optional method allows programs to ensure that no dispatcher CommClient connections remain, if it's called once for the result of every getConnection() invocation.static voidreleaseAll(com.fishlib.io.logger.Logger log, boolean force) voidrequestThreadDump(String workerProcessInfoId, boolean ignoreMissingJob, boolean waitForResponse) voidsendCancelJob(String workerProcessInfoId, boolean ignoreMissingJob, boolean waitForResponse) com.fishlib.base.CommandsendCommand(com.fishlib.base.Command command) sendInfoForJob(String workerProcessInfoId) Request information about a job the dispatcher may be handling.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.iris.db.tables.remotequery.QueryDispatcherConnection
getQueryProcessorRequestHandle
-
Field Details
-
DISPATCHER_TIMEOUT_MS
public static final long DISPATCHER_TIMEOUT_MS- See Also:
-
-
Method Details
-
sendCommand
- Specified by:
sendCommandin interfaceQueryDispatcherConnection- Throws:
IOException
-
handleCommand
public void handleCommand(io.deephaven.enterprise.comm.api.ClientEntry client, com.fishlib.base.Command comm) - Specified by:
handleCommandin interfaceio.deephaven.enterprise.comm.api.CommandHandler
-
handleClientDeath
public void handleClientDeath(io.deephaven.enterprise.comm.api.ClientEntry client) - Specified by:
handleClientDeathin interfaceio.deephaven.enterprise.comm.api.CommandHandler
-
getDispatcherHost
- Specified by:
getDispatcherHostin interfaceQueryDispatcherConnection
-
toString
-
pushClientClasses
Pushes client classes to the dispatcher for use in future queries.- Specified by:
pushClientClassesin interfaceQueryDispatcherConnection- Parameters:
classList- the classes to be pushed- Throws:
IOException- from the socket operations
-
getQueryProcessorRequestHandle
public QueryDispatcherConnection.QueryProcessorRequestHandle getQueryProcessorRequestHandle(boolean combineWorkerConnectionStats) Description copied from interface:QueryDispatcherConnectionCreate a new, single-use handle for use in requesting a new query processor.- Specified by:
getQueryProcessorRequestHandlein interfaceQueryDispatcherConnection- Parameters:
combineWorkerConnectionStats- if true, use one set of statistics items for the worker connection statistics, rather than a different set of items for each worker connection- Returns:
- A new, single-use handle for use in requesting a new query processor.
-
getQueryProcessorRequestHandle
public QueryDispatcherConnection.QueryProcessorRequestHandle getQueryProcessorRequestHandle(boolean combineWorkerConnectionStats, @NotNull Consumer<String> eventConsumer) Description copied from interface:QueryDispatcherConnectionCreate a new, single-use handle for use in requesting a new query processor.- Specified by:
getQueryProcessorRequestHandlein interfaceQueryDispatcherConnection- Parameters:
combineWorkerConnectionStats- if true, use one set of statistics items for the worker connection statistics, rather than a different set of items for each worker connectioneventConsumer- Function that takes a string to allow logging detailed status updates upon worker startup.- Returns:
- A new, single-use handle for use in requesting a new query processor.
-
getQueryProcessor
public QueryProcessorConnection getQueryProcessor(QueryDispatcherConnection.QueryProcessorRequestHandle handle, RemoteProcessingRequest request, boolean exportQueryScope, List<RemoteQueryClassDefinition> classList, long timeoutMillis, @Nullable QueryProcessorConnection.DisconnectHandler disconnectHandler, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, @NotNull TokenFactoryFactory tokenAuthenticationManager) throws RemoteQueryException Gets a query processor assigned by the dispatcher, and pushes client classes for use in future queries.- Specified by:
getQueryProcessorin interfaceQueryDispatcherConnection- Parameters:
handle-request-exportQueryScope-classList-timeoutMillis- How long to wait for the job to be scheduled and the processor to be assigned. <= 0 means practically forever.disconnectHandler-connectionMonitorParams-tokenAuthenticationManager-- Returns:
- Throws:
RemoteQueryException
-
getQueryProcessor
public QueryProcessorConnection getQueryProcessor(QueryDispatcherConnection.QueryProcessorRequestHandle handle, RemoteProcessingRequest request, boolean exportQueryScope, List<RemoteQueryClassDefinition> classList, long timeoutMillis, @Nullable QueryProcessorConnection.DisconnectHandler disconnectHandler, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams) throws RemoteQueryException Gets a query processor assigned by the dispatcher, and pushes client classes for use in future queries.- Specified by:
getQueryProcessorin interfaceQueryDispatcherConnection- Parameters:
handle-request-classList-timeoutMillis- How long to wait for the job to be scheduled and the processor to be assigned. <= 0 means practically forever.disconnectHandler-connectionMonitorParams-- Returns:
- A new QueryProcessorConnection
- Throws:
RemoteQueryException
-
getQueryProcessor
public QueryProcessorConnection getQueryProcessor(boolean addClientClassesToClassPath, List<RemoteQueryClassDefinition> classList, long timeoutMillis) throws RemoteQueryException Gets a query processor assigned by the dispatcher, optionally pushing client classes. This method will create a RemoteProcessingRequest and automatically retry authentication with different origins if a failure occurs -
getQueryProcessor
public QueryProcessorConnection getQueryProcessor(RemoteProcessingRequest request, List<RemoteQueryClassDefinition> classList, long timeoutMillis) throws RemoteQueryException - Specified by:
getQueryProcessorin interfaceQueryDispatcherConnection- Throws:
RemoteQueryException
-
getQueryProcessor
public QueryProcessorConnection getQueryProcessor(RemoteProcessingRequest request, List<RemoteQueryClassDefinition> classList) throws RemoteQueryException Gets a query processor assigned by the dispatcher, and pushes client classes for use in future queries. Uses default timeout (1 week, effectively infinite).- Specified by:
getQueryProcessorin interfaceQueryDispatcherConnection- Parameters:
request- the remote processing requestclassList- the classes to be pushed- Returns:
- the QueryProcessorConnection
- Throws:
RemoteQueryException
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceQueryDispatcherConnection- Returns:
- The internal CommClient's connection status.
-
release
This optional method allows programs to ensure that no dispatcher CommClient connections remain, if it's called once for the result of every getConnection() invocation. Calling it more than once per getConnection() will result in unexpectedly disconnected clients.- Specified by:
releasein interfaceQueryDispatcherConnection- Parameters:
force- force a disconnection even if the reference count is not zero- Throws:
IOException- from the socket calls
-
sendInfoForJob
public QueryDispatcherConnection.JobInfo sendInfoForJob(String workerProcessInfoId) throws RemoteQueryException Description copied from interface:QueryDispatcherConnectionRequest information about a job the dispatcher may be handling.- Specified by:
sendInfoForJobin interfaceQueryDispatcherConnection- Parameters:
workerProcessInfoId- the worker process info id for the job- Returns:
- A
JobInfoobject with the information requested; note that if the job does not exist that is not an error. - Throws:
RemoteQueryException- if retrieving the information failed.
-
sendCancelJob
public void sendCancelJob(String workerProcessInfoId, boolean ignoreMissingJob, boolean waitForResponse) throws RemoteQueryException - Specified by:
sendCancelJobin interfaceQueryDispatcherConnection- Throws:
RemoteQueryException
-
requestThreadDump
public void requestThreadDump(String workerProcessInfoId, boolean ignoreMissingJob, boolean waitForResponse) throws RemoteQueryException - Specified by:
requestThreadDumpin interfaceQueryDispatcherConnection- Throws:
RemoteQueryException
-
releaseAll
public static void releaseAll(com.fishlib.io.logger.Logger log, boolean force) -
getConnection
- Throws:
IOException
-
getConnection
public static QueryDispatcherConnection getConnection(@Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams) throws IOException - Throws:
IOException
-
getConnection
public static QueryDispatcherConnection getConnection(@Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, @NotNull TokenFactoryFactory tokenAuthenticationManager) throws IOException - Throws:
IOException
-
getConnection
public static QueryDispatcherConnection getConnection(String dispatcherHost, int dispatcherPort) throws IOException - Throws:
IOException
-
getConnection
public static QueryDispatcherConnection getConnection(String dispatcherHost, int dispatcherPort, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams) throws IOException - Throws:
IOException
-
getConnection
public static QueryDispatcherConnection getConnection(String dispatcherHost, int dispatcherPort, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, @NotNull TokenFactoryFactory tokenAuthenticationManager) throws IOException - Throws:
IOException
-
getConnection
public static QueryDispatcherConnection getConnection(com.fishlib.io.logger.Logger log, String dispatcherHost, int dispatcherPort, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams) throws IOException - Throws:
IOException
-
getConnection
public static QueryDispatcherConnection getConnection(com.fishlib.io.logger.Logger log, String dispatcherHost, int dispatcherPort, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, @Nullable BiConsumer<io.deephaven.enterprise.comm.api.ClientEntry, com.fishlib.base.Command> commandHandler, @Nullable Consumer<io.deephaven.enterprise.comm.api.ClientEntry> clientDeathHandler, @Nullable Consumer<QueryDispatcherConnection> newConnectionConsumer) throws IOException- Throws:
IOException
-
getConnection
public static QueryDispatcherConnection getConnection(com.fishlib.io.logger.Logger log, String dispatcherHost, int dispatcherPort, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, @NotNull TokenFactoryFactory tokenAuthenticationManager) throws IOException - Throws:
IOException
-
getConnection
public static QueryDispatcherConnection getConnection(com.fishlib.io.logger.Logger log, String dispatcherHost, int dispatcherPort, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, @NotNull TokenFactoryFactory tokenAuthenticationManager, @Nullable BiConsumer<io.deephaven.enterprise.comm.api.ClientEntry, com.fishlib.base.Command> commandHandler, @Nullable Consumer<io.deephaven.enterprise.comm.api.ClientEntry> clientDeathHandler, @Nullable Consumer<QueryDispatcherConnection> newConnectionConsumer) throws IOExceptionFactory method to get a QueryDispatcherConnection for remote queries. See release() for connection cleanup, if desired.- Parameters:
log- the logdispatcherHost- the dispatcher's hostdispatcherPort- the dispatcher's portconnectionMonitorParams- the connection monitor parameterstokenAuthenticationManager- an authentication client managercommandHandler- if provided, a consumer to be called when a command is sent by the dispatcherclientDeathHandler- if provided, a consumer to be called when the dispatcher diesnewConnectionConsumer- if provided, a consumer to be called if a new connection is established- Returns:
- A new connection if none is cached for the host/port pair provided, or the cached connection
- Throws:
IOException- from the socket calls- ImplNote:
- If the connection already existed then the
commandHandlerandclientDeathHandlerwill not be attached.
-
getConnectionIfAvailable
public static QueryDispatcherConnection getConnectionIfAvailable(TokenFactoryFactory tokenAuthenticationManager, String dispatcherHost, int dispatcherPort) Factory method to get a QueryDispatcherConnection for remote queries. See release() for connection cleanup, if desired.- Parameters:
dispatcherHost- the dispatcher's hostdispatcherPort- the dispatcher's port- Returns:
- The cached connection if one is available and connected, or null if none is available
-
getConnectionIfAvailable
public static QueryDispatcherConnection getConnectionIfAvailable(String dispatcherHost, int dispatcherPort)
-