Class TimeoutHandler

java.lang.Object
com.databricks.jdbc.dbclient.impl.common.TimeoutHandler

public class TimeoutHandler extends Object
Utility class to handle statement execution timeouts.
  • Constructor Details

    • TimeoutHandler

      public TimeoutHandler(int timeoutSeconds, String operationDescription, Runnable onTimeoutAction)
      Creates a new timeout handler with the provided parameters.
      Parameters:
      timeoutSeconds - Timeout in seconds, 0 means no timeout
      operationDescription - Description of the operation for logging
      onTimeoutAction - Runnable to call when a timeout occurs
  • Method Details

    • checkTimeout

      public void checkTimeout() throws DatabricksTimeoutException
      Checks if the operation has timed out. If a timeout occurs, it attempts to execute the timeout action and throws a DatabricksTimeoutException.
      Throws:
      DatabricksTimeoutException - if the operation timed out
    • forStatement

      public static TimeoutHandler forStatement(int timeoutSeconds, StatementId statementId, IDatabricksClient client)
      Factory method to create a timeout handler for a databricks client with a statement ID. This works with any client that implements IDatabricksClient.
      Parameters:
      timeoutSeconds - Timeout in seconds
      statementId - The statement ID
      client - The Databricks client
      Returns:
      A new TimeoutHandler instance