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 Summary
Constructors Constructor Description TimeoutHandler(int timeoutSeconds, String operationDescription, Runnable onTimeoutAction)Creates a new timeout handler with the provided parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckTimeout()Checks if the operation has timed out.static TimeoutHandlerforStatement(int timeoutSeconds, StatementId statementId, IDatabricksClient client)Factory method to create a timeout handler for a databricks client with a statement ID.
-
-
-
Constructor Detail
-
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 timeoutoperationDescription- Description of the operation for loggingonTimeoutAction- Runnable to call when a timeout occurs
-
-
Method Detail
-
checkTimeout
public void checkTimeout() throws DatabricksTimeoutExceptionChecks 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 implementsIDatabricksClient.- Parameters:
timeoutSeconds- Timeout in secondsstatementId- The statement IDclient- The Databricks client- Returns:
- A new TimeoutHandler instance
-
-