Class QueryProcessorConnectionImpl
java.lang.Object
com.illumon.iris.db.tables.remotequery.QueryProcessorConnectionImpl
- All Implemented Interfaces:
com.fishlib.dataobjects.HashCommandConstants
,RemoteQueryCommandConstants
,QueryProcessorConnection
,io.deephaven.enterprise.comm.api.CommandHandler
,io.deephaven.enterprise.comm.BaseCommandConstants
public class QueryProcessorConnectionImpl
extends Object
implements RemoteQueryCommandConstants, io.deephaven.enterprise.comm.api.CommandHandler, QueryProcessorConnection
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
Nested classes/interfaces inherited from interface com.illumon.iris.db.tables.remotequery.QueryProcessorConnection
QueryProcessorConnection.AsynchronousErrorHandler, QueryProcessorConnection.AsyncQueryResultHandler<RETURN_TYPE>, QueryProcessorConnection.DisconnectHandler, QueryProcessorConnection.QueryFuture<RETURN_TYPE>, QueryProcessorConnection.QueryHandle, QueryProcessorConnection.QueryProcessorConnectionCommandHandler
-
Field Summary
Fields inherited from interface io.deephaven.enterprise.comm.BaseCommandConstants
PING, PONG, REGISTER_QUEUE_LISTENER, RESPONSE
Fields 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_UNSUBSCRIBE
Fields 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 TypeMethodDescriptionvoid
Adds a command handler to the list of handlers that may service unknown commands.static QueryProcessorConnection
establishSecondaryConnection
(com.fishlib.io.logger.Logger log, AuthToken authToken, String processorName, String processInfoId, String processorHost, int processorPort, int websocketPort, String envoyPrefix, long expirationDeadlineMS, QueryProcessorConnection.DisconnectHandler disconnectHandler, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, boolean combineWorkerConnectionStats, TokenFactoryFactory tokenAuthenticationManager) static QueryProcessorConnection
establishSecondaryConnection
(com.fishlib.io.logger.Logger log, AuthToken authToken, String processorName, String processInfoId, String processorHost, int processorPort, long expirationDeadlineMS, QueryProcessorConnection.DisconnectHandler disconnectHandler, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams) Delegate toestablishSecondaryConnection(Logger, AuthToken, String, String, String, int, int, String, long, DisconnectHandler, ConnectionMonitor.Params, boolean, TokenFactoryFactory)
with combineWorkerConnectionStats=false, the default authentication client manager, and "unknown" values for web socket connection.static QueryProcessorConnection
establishSecondaryConnection
(com.fishlib.io.logger.Logger log, AuthToken authToken, String processorName, String processInfoId, String processorHost, int processorPort, long expirationDeadlineMS, QueryProcessorConnection.DisconnectHandler disconnectHandler, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, boolean combineWorkerConnectionStats, TokenFactoryFactory tokenAuthenticationManager) Delegate toestablishSecondaryConnection(Logger, AuthToken, String, String, String, int, int, String, long, DisconnectHandler, ConnectionMonitor.Params, boolean, TokenFactoryFactory)
with "unknown" values for web socket connection.static QueryProcessorConnection
establishSecondaryConnection
(com.fishlib.io.logger.Logger log, AuthToken authToken, String processorName, String processInfoId, String processorHost, int processorPort, long expirationDeadlineMS, QueryProcessorConnection.DisconnectHandler disconnectHandler, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, TokenFactoryFactory tokenAuthenticationManager) Delegate toestablishSecondaryConnection(Logger, AuthToken, String, String, String, int, int, String, long, DisconnectHandler, ConnectionMonitor.Params, boolean, TokenFactoryFactory)
with combineWorkerConnectionStats=false, and "unknown" values for web socket connection.<TYPE> TYPE
executeQuery
(byte[] remoteQueryInstanceBytes, boolean concurrent) Execute the given query bytes synchronously and return the result.<TYPE> TYPE
executeQuery
(RemoteQuery<TYPE> remoteQuery, boolean concurrent) Execute the given query synchronously and return the result.<TYPE> QueryProcessorConnection.QueryFuture<TYPE>
executeQueryAsync
(byte[] remoteQueryInstanceBytes, boolean concurrent) Submit a query asynchronously.executeQueryAsync
(byte[] remoteQueryInstanceBytes, boolean concurrent, QueryProcessorConnection.AsyncQueryResultHandler<TYPE> handler) Submit a query asynchronously.<TYPE> QueryProcessorConnection.QueryFuture<TYPE>
executeQueryAsync
(RemoteQuery<TYPE> remoteQuery, boolean concurrent) Submit a query asynchronously.executeQueryAsync
(RemoteQuery<TYPE> remoteQuery, boolean concurrent, QueryProcessorConnection.AsyncQueryResultHandler<TYPE> handler) Submit a query asynchronously.int
int
void
handleClientDeath
(io.deephaven.enterprise.comm.api.ClientEntry client) void
handleCommand
(io.deephaven.enterprise.comm.api.ClientEntry client, com.fishlib.base.Command comm) Object[]
invokeRemoteTableMethod
(int handleId, Method method, Object[] args) Support for RemoteTableHandleManager's remote table method invocations.invokeRemoteTableMethodConcurrent
(int handleId, Method method, Object[] args) Support for RemoteTableHandleManager's remoteAsyncMethod
table method invocations.boolean
void
registerTableErrorHandler
(QueryProcessorConnection.AsynchronousErrorHandler asynchronousErrorHandler) void
release()
Disconnects from the query processor.void
releaseRemoteTableHandle
(Integer handleId) Support for RemoteTableHandleManager's remote table garbage collection.void
releaseRemoteTableMapHandle
(Integer handleId) Support for RemoteTableHandleManager's remote table garbage collection.void
removeCommandHandler
(QueryProcessorConnection.QueryProcessorConnectionCommandHandler commandHandler) Removes a command handler from the lsit of handlers that may service unknown commands.void
sendCommandNoResponse
(com.fishlib.base.Command command) Send a single commmand, expecting no response.void
subscribeToLogBuffer
(com.fishlib.io.logger.LogBufferRecordListener listener) boolean
subscribeToPreemptiveUpdates
(int tableId, BitSet columnsToSubscribe, boolean isViewPort) void
unsubscribeFromLogBuffer
(com.fishlib.io.logger.LogBufferRecordListener listener) boolean
unsubscribeFromPreemptiveUpdates
(int tableId) updatePreemptiveSubscriptionColumnsAsync
(int tableId, BitSet newColumns) updateViewportAndColumnsAsync
(int tableId, Index newViewPort, BitSet newColumns) updateViewportAsync
(int tableId, Index newViewPort) 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.db.tables.remotequery.QueryProcessorConnection
executeQuery, executeQuery
-
Method Details
-
establishSecondaryConnection
public static QueryProcessorConnection establishSecondaryConnection(@NotNull com.fishlib.io.logger.Logger log, @Nullable AuthToken authToken, @NotNull String processorName, @NotNull String processInfoId, @NotNull String processorHost, int processorPort, long expirationDeadlineMS, @Nullable QueryProcessorConnection.DisconnectHandler disconnectHandler, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams) throws IOException Delegate toestablishSecondaryConnection(Logger, AuthToken, String, String, String, int, int, String, long, DisconnectHandler, ConnectionMonitor.Params, boolean, TokenFactoryFactory)
with combineWorkerConnectionStats=false, the default authentication client manager, and "unknown" values for web socket connection.- Throws:
IOException
-
establishSecondaryConnection
public static QueryProcessorConnection establishSecondaryConnection(@NotNull com.fishlib.io.logger.Logger log, @Nullable AuthToken authToken, @NotNull String processorName, @NotNull String processInfoId, @NotNull String processorHost, int processorPort, long expirationDeadlineMS, @Nullable QueryProcessorConnection.DisconnectHandler disconnectHandler, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, @NotNull TokenFactoryFactory tokenAuthenticationManager) throws IOException Delegate toestablishSecondaryConnection(Logger, AuthToken, String, String, String, int, int, String, long, DisconnectHandler, ConnectionMonitor.Params, boolean, TokenFactoryFactory)
with combineWorkerConnectionStats=false, and "unknown" values for web socket connection.- Throws:
IOException
-
establishSecondaryConnection
public static QueryProcessorConnection establishSecondaryConnection(@NotNull com.fishlib.io.logger.Logger log, @Nullable AuthToken authToken, @NotNull String processorName, @NotNull String processInfoId, @NotNull String processorHost, int processorPort, long expirationDeadlineMS, @Nullable QueryProcessorConnection.DisconnectHandler disconnectHandler, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, boolean combineWorkerConnectionStats, @NotNull TokenFactoryFactory tokenAuthenticationManager) throws IOException Delegate toestablishSecondaryConnection(Logger, AuthToken, String, String, String, int, int, String, long, DisconnectHandler, ConnectionMonitor.Params, boolean, TokenFactoryFactory)
with "unknown" values for web socket connection.- Throws:
IOException
-
establishSecondaryConnection
public static QueryProcessorConnection establishSecondaryConnection(@NotNull com.fishlib.io.logger.Logger log, @Nullable AuthToken authToken, @NotNull String processorName, @NotNull String processInfoId, @NotNull String processorHost, int processorPort, int websocketPort, String envoyPrefix, long expirationDeadlineMS, @Nullable QueryProcessorConnection.DisconnectHandler disconnectHandler, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, boolean combineWorkerConnectionStats, @NotNull TokenFactoryFactory tokenAuthenticationManager) throws IOException - Throws:
IOException
-
getDispatcherConnection
- Specified by:
getDispatcherConnection
in interfaceQueryProcessorConnection
-
getProcessorName
- Specified by:
getProcessorName
in interfaceQueryProcessorConnection
- Returns:
- The name of the RemoteQueryProcessor's process, and its client-connection CommServer. ("RemoteQueryDispatcher_worker-" + #) Note: RemoteQueryDispatcher code refers to this String as the workerName.
-
getProcessorHost
- Specified by:
getProcessorHost
in interfaceQueryProcessorConnection
-
getProcessorPort
public int getProcessorPort()- Specified by:
getProcessorPort
in interfaceQueryProcessorConnection
-
getWebsocketPort
public int getWebsocketPort()- Specified by:
getWebsocketPort
in interfaceQueryProcessorConnection
-
getEnvoyPrefix
- Specified by:
getEnvoyPrefix
in interfaceQueryProcessorConnection
-
getWorkerName
- Specified by:
getWorkerName
in interfaceQueryProcessorConnection
- Returns:
- A shorter, more display-friendly version of the RemoteQueryProcessor's name. ("worker_" + #) Note: RemoteQueryDispatcher code refers to this String as the workerId.
-
getProcessInfoId
- Specified by:
getProcessInfoId
in interfaceQueryProcessorConnection
- Returns:
- A unique identifier assigned to the RemoteQueryProcessor (worker)
-
subscribeToPreemptiveUpdates
public boolean subscribeToPreemptiveUpdates(int tableId, BitSet columnsToSubscribe, boolean isViewPort) - Specified by:
subscribeToPreemptiveUpdates
in interfaceQueryProcessorConnection
-
unsubscribeFromPreemptiveUpdates
public boolean unsubscribeFromPreemptiveUpdates(int tableId) - Specified by:
unsubscribeFromPreemptiveUpdates
in interfaceQueryProcessorConnection
-
updatePreemptiveSubscriptionColumnsAsync
- Specified by:
updatePreemptiveSubscriptionColumnsAsync
in interfaceQueryProcessorConnection
-
updateViewportAndColumnsAsync
public Future<Boolean> updateViewportAndColumnsAsync(int tableId, Index newViewPort, BitSet newColumns) - Specified by:
updateViewportAndColumnsAsync
in interfaceQueryProcessorConnection
-
updateViewportAsync
- Specified by:
updateViewportAsync
in interfaceQueryProcessorConnection
-
subscribeToLogBuffer
public void subscribeToLogBuffer(@NotNull com.fishlib.io.logger.LogBufferRecordListener listener) throws IOException - Specified by:
subscribeToLogBuffer
in interfaceQueryProcessorConnection
- Throws:
IOException
-
unsubscribeFromLogBuffer
public void unsubscribeFromLogBuffer(@NotNull com.fishlib.io.logger.LogBufferRecordListener listener) throws IOException - Specified by:
unsubscribeFromLogBuffer
in interfaceQueryProcessorConnection
- Throws:
IOException
-
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceQueryProcessorConnection
- Returns:
- The internal CommClient's connection status.
-
release
Disconnects from the query processor. Subsequent method invocations will fail due to disconnection.- Specified by:
release
in interfaceQueryProcessorConnection
- Throws:
IOException
- if an error occurs communicating with the server
-
getTableManager
- Specified by:
getTableManager
in interfaceQueryProcessorConnection
-
getTableMapManager
- Specified by:
getTableMapManager
in interfaceQueryProcessorConnection
-
getRemoteDatabase
- Specified by:
getRemoteDatabase
in interfaceQueryProcessorConnection
-
registerTableErrorHandler
public void registerTableErrorHandler(QueryProcessorConnection.AsynchronousErrorHandler asynchronousErrorHandler) - Specified by:
registerTableErrorHandler
in interfaceQueryProcessorConnection
-
handleCommand
public void handleCommand(io.deephaven.enterprise.comm.api.ClientEntry client, com.fishlib.base.Command comm) - Specified by:
handleCommand
in interfaceio.deephaven.enterprise.comm.api.CommandHandler
-
addCommandHandler
public void addCommandHandler(QueryProcessorConnection.QueryProcessorConnectionCommandHandler commandHandler) Description copied from interface:QueryProcessorConnection
Adds a command handler to the list of handlers that may service unknown commands. The QueryProcessorConnection does not hold a reference to the command handler; so the user must ensure reachability of the commandHandler.- Specified by:
addCommandHandler
in interfaceQueryProcessorConnection
- Parameters:
commandHandler
- the command handler to add.
-
removeCommandHandler
public void removeCommandHandler(QueryProcessorConnection.QueryProcessorConnectionCommandHandler commandHandler) Description copied from interface:QueryProcessorConnection
Removes a command handler from the lsit of handlers that may service unknown commands.- Specified by:
removeCommandHandler
in interfaceQueryProcessorConnection
- Parameters:
commandHandler
- the command handler to remove
-
handleClientDeath
public void handleClientDeath(io.deephaven.enterprise.comm.api.ClientEntry client) - Specified by:
handleClientDeath
in interfaceio.deephaven.enterprise.comm.api.CommandHandler
-
executeQuery
public <TYPE> TYPE executeQuery(RemoteQuery<TYPE> remoteQuery, boolean concurrent) throws IOException Execute the given query synchronously and return the result. This may convert the RemoteQuery into a byte stream and callQueryProcessorConnection.executeQuery(byte[], boolean)
This method is divorced from any logic for pushing classes to the server-side. Use getDispatcherConnection().pushClientClasses(), if necessary.- Specified by:
executeQuery
in interfaceQueryProcessorConnection
- Type Parameters:
TYPE
- the return type of the remote query- Parameters:
remoteQuery
- the queryconcurrent
- if true, permit the query to proceed concurrently with data refresh processing- Returns:
- query result
- Throws:
IOException
- if an error occurs communicating with the server
-
executeQuery
public <TYPE> TYPE executeQuery(byte[] remoteQueryInstanceBytes, boolean concurrent) Execute the given query bytes synchronously and return the result. This method is for "advanced" usage only, if you already have a remote query instance in byte array form.- Specified by:
executeQuery
in interfaceQueryProcessorConnection
- Type Parameters:
TYPE
- the return type of the remote query- Parameters:
remoteQueryInstanceBytes
- the queryconcurrent
- if true, permit the query to proceed concurrently with data refresh processing- Returns:
- query result
-
executeQueryAsync
public <TYPE> QueryProcessorConnection.QueryHandle executeQueryAsync(RemoteQuery<TYPE> remoteQuery, boolean concurrent, QueryProcessorConnection.AsyncQueryResultHandler<TYPE> handler) throws IOException Submit a query asynchronously. This may convert the RemoteQuery into a byte stream and callQueryProcessorConnection.executeQueryAsync(byte[], boolean, AsyncQueryResultHandler)
Query progress will be reported via the AsyncQueryResultHandler.- Specified by:
executeQueryAsync
in interfaceQueryProcessorConnection
- Type Parameters:
TYPE
- the return type of the remote query- Parameters:
remoteQuery
- the queryconcurrent
- if true, permit the query to proceed concurrently with data refresh processinghandler
- asynchronous result handler- Returns:
- a QueryHandle for the async query
- Throws:
IOException
- if an error occurs communicating with the server
-
executeQueryAsync
public <TYPE> QueryProcessorConnection.QueryFuture<TYPE> executeQueryAsync(RemoteQuery<TYPE> remoteQuery, boolean concurrent) throws IOException Submit a query asynchronously. This may convert the RemoteQuery into a byte stream and callQueryProcessorConnection.executeQueryAsync(byte[], boolean)
Returns a query handle from which the results can be retrieved when results are ready- Specified by:
executeQueryAsync
in interfaceQueryProcessorConnection
- Type Parameters:
TYPE
- the return type of the remote query- Parameters:
remoteQuery
- the queryconcurrent
- if true, permit the query to proceed concurrently with data refresh processing- Returns:
- a QueryFuture for the async query
- Throws:
IOException
- if an error occurs communicating with the server
-
executeQueryAsync
public <TYPE> QueryProcessorConnection.QueryFuture<TYPE> executeQueryAsync(byte[] remoteQueryInstanceBytes, boolean concurrent) Submit a query asynchronously. Returns a query handle from which the results can be retrieved when results are ready This method is for "advanced" usage only, if you already have a remote query instance in byte array form.- Specified by:
executeQueryAsync
in interfaceQueryProcessorConnection
- Type Parameters:
TYPE
- the return type of the remote query- Parameters:
remoteQueryInstanceBytes
- the queryconcurrent
- if true, permit the query to proceed concurrently with data refresh processing- Returns:
- a QueryFuture for the async query
-
executeQueryAsync
public <TYPE> QueryProcessorConnection.QueryHandle executeQueryAsync(byte[] remoteQueryInstanceBytes, boolean concurrent, QueryProcessorConnection.AsyncQueryResultHandler<TYPE> handler) Submit a query asynchronously. Query progress will be reported via the AsyncQueryResultHandler. This method is for "advanced" usage only, if you already have a remote query instance in byte array form.- Specified by:
executeQueryAsync
in interfaceQueryProcessorConnection
- Type Parameters:
TYPE
- the return type of the remote query- Parameters:
remoteQueryInstanceBytes
- the queryconcurrent
- if true, permit the query to proceed concurrently with data refresh processinghandler
- asynchronous result handler- Returns:
- a QueryHandle for the async query
-
releaseRemoteTableHandle
Support for RemoteTableHandleManager's remote table garbage collection.- Specified by:
releaseRemoteTableHandle
in interfaceQueryProcessorConnection
- Parameters:
handleId
- the handle to release
-
invokeRemoteTableMethod
Support for RemoteTableHandleManager's remote table method invocations.- Specified by:
invokeRemoteTableMethod
in interfaceQueryProcessorConnection
- Parameters:
handleId
- the handle to invoke a method onmethod
- the Table method to invokeargs
- the arguments to the method- Returns:
- the return value of the remotely executed method
-
invokeRemoteTableMethodConcurrent
public Object invokeRemoteTableMethodConcurrent(int handleId, @NotNull Method method, Object[] args) Support for RemoteTableHandleManager's remoteAsyncMethod
table method invocations.- Specified by:
invokeRemoteTableMethodConcurrent
in interfaceQueryProcessorConnection
- Parameters:
handleId
- The handle IDmethod
- The methodargs
- The method's arguments- Returns:
- THe method's result
-
releaseRemoteTableMapHandle
Support for RemoteTableHandleManager's remote table garbage collection.- Specified by:
releaseRemoteTableMapHandle
in interfaceQueryProcessorConnection
- Parameters:
handleId
- the handle to release
-
sendCommandNoResponse
Description copied from interface:QueryProcessorConnection
Send a single commmand, expecting no response.- Specified by:
sendCommandNoResponse
in interfaceQueryProcessorConnection
- Parameters:
command
- The command to send.- Throws:
IOException
- If a problem occurs sending the command.
-