Class DeephavenClusterConnection

java.lang.Object
io.deephaven.enterprise.dnd.client.DeephavenClusterConnection

public class DeephavenClusterConnection extends Object
An object that maintains connections to Deephaven services on a remote cluster. This is used by the Java Client to create and subscribe to queries, and also used by Core+ workers to connect to queries on different clusters.
  • Constructor Details

    • DeephavenClusterConnection

      public DeephavenClusterConnection(@NotNull String connectionUrl) throws IOException
      Create a new, unauthenticated connection to the specified Deephaven cluster. Users should call one of password(String, String), privateKey(String) or delegateToken(AuthToken) to authenticate with the server before accessing the provided services. This call uses defaults for the corePoolSize (4), the controller heartbeat period (10 seconds) and the controller heart beat timeout (2 seconds).
      Parameters:
      connectionUrl - the url of the remote system in the format `https://server-address:port/iris/connection.json`
      Throws:
      IOException - if there is a problem establishing a connection to the remote cluster
    • DeephavenClusterConnection

      public DeephavenClusterConnection(@NotNull String connectionUrl, int corePoolSize, long controllerHeartBeatPeriodMillis, long controllerHeartBeatTimeoutMillis) throws IOException
      Create a new, unauthenticated connection to the specified Deephaven cluster. Users should call one of password(String, String), privateKey(String) or delegateToken(AuthToken) to authenticate with the server before accessing the provided services.
      Parameters:
      connectionUrl - the url of the remote system in the format `https://server-address:port/iris/connection.json`
      corePoolSize - the size of the Core+ thread pool
      controllerHeartBeatPeriodMillis - heartbeat period to the controller, in milliseconds
      controllerHeartBeatTimeoutMillis - heartbeat timeout to the controller, in milliseconds
      Throws:
      IOException - if there is a problem establishing a connection to the remote cluster
  • Method Details

    • close

      public void close()
      Close all connections to the remote host.
    • password

      public boolean password(@NotNull String user, @NotNull String password)
      Authenticate with the server using a username and password
      Parameters:
      user - the username
      password - the password
      Returns:
      true if successfully authenticated, false otherwise.
    • privateKey

      public boolean privateKey(@NotNull String keyFile)
      Authenticate to the server using a private key file.
      Parameters:
      keyFile - the private key file
      Returns:
      true if successfully authenticated, false otherwise.
    • delegateToken

      public boolean delegateToken(@NotNull AuthToken delegateToken)
      Use a delegate token to authenticate.
      Parameters:
      delegateToken - the token to authenticate with
      Returns:
      true if successfully authenticated, false otherwise.
    • setMaxInboundMessageSize

      public void setMaxInboundMessageSize(int maxInboundMessageSize)
      Set the maximum inbound message size for connections created by this object.
      Parameters:
      maxInboundMessageSize - the new max inbound message size
    • getControllerClient

      public io.deephaven.enterprise.controller.client.ControllerClientGrpc getControllerClient()
      Get the controller client for the cluster. The controller client will automatically be authenticated when any of the authentication methods have completed successfully.
      Returns:
      the ControllerClientGrpc
    • getAuthenticationClient

      public AuthenticationClient getAuthenticationClient()
      Get the AuthenticationClient for the cluster.
      Returns:
      the authentication client
    • getExecutor

      public ScheduledExecutorService getExecutor()
      Get the ScheduledExecutorService used for connections created by this object.
      Returns:
      the ScheduledExecutorService
    • getUserContext

      public UserContext getUserContext() throws NotAuthenticatedException
      Get the authenticated UserContext for this object.
      Returns:
      the authenticated UserContext
      Throws:
      NotAuthenticatedException - if this connection has not been authenticated
    • makeGrpcChannel

      public io.grpc.ManagedChannel makeGrpcChannel(@NotNull String host, int port, @Nullable Map<String,String> extraHeaders) throws IOException
      Construct a gRPC channel for communication with the Persistent Query
      Parameters:
      host - the host of the query
      port - the port of the query
      extraHeaders - a map of any extra HTTP headers to include, or null if none.
      Returns:
      a new ManagedChannel for communication with the Persistent Query
      Throws:
      IOException - if there was a problem creating the channel