Class TimeoutHandler
java.lang.Object
com.databricks.jdbc.dbclient.impl.common.TimeoutHandler
-
Constructor Summary
ConstructorsConstructorDescriptionTimeoutHandler(int timeoutSeconds, String operationDescription, Runnable onTimeoutAction) Creates a new timeout handler with the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks 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 Details
-
TimeoutHandler
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 Details
-
checkTimeout
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 implementsIDatabricksClient.- Parameters:
timeoutSeconds- Timeout in secondsstatementId- The statement IDclient- The Databricks client- Returns:
- A new TimeoutHandler instance
-