-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for timeouts in select queries (#123)
This provides a mechanism to specify a default timeout for all select queries created by a given DatabaseEngine plus the possibility to override the configured value on individual queries. It also exposes the Statement#cancel() method, that allows a thread to cancel a query running on other query and is supported by the production-ready JDBC drivers supported by pdb.
- Loading branch information
Showing
6 changed files
with
183 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/com/feedzai/commons/sql/abstraction/engine/DatabaseEngineTimeoutException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2019 Feedzai | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.feedzai.commons.sql.abstraction.engine; | ||
|
||
/** | ||
* A {@link DatabaseEngineException} that represents a timeout error. | ||
*/ | ||
public class DatabaseEngineTimeoutException extends DatabaseEngineException { | ||
|
||
/** | ||
* Constructs a new exception with the specified detail message and | ||
* cause. <p>Note that the detail message associated with | ||
* {@code cause} is <i>not</i> automatically incorporated in | ||
* this exception's detail message. | ||
* | ||
* @param message the detail message (which is saved for later retrieval | ||
* by the {@link #getMessage()} method). | ||
* @param cause the cause (which is saved for later retrieval by the | ||
* {@link #getCause()} method). (A <tt>null</tt> value is | ||
* permitted, and indicates that the cause is nonexistent or | ||
* unknown.) | ||
*/ | ||
public DatabaseEngineTimeoutException(final String message, final Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters