Handle the exception when cancel query failed.

This commit is contained in:
anikikong
2021-07-01 07:04:41 +00:00
committed by Gitee
parent 37ff7bf9c8
commit cc7372ca3d
2 changed files with 6 additions and 1 deletions

View File

@ -178,6 +178,7 @@ public abstract class QueryExecutorBase implements QueryExecutor {
} catch (IOException e) {
// Safe to ignore.
LOGGER.trace("Ignoring exception on cancel request:", e);
throw new SQLException("Cancel request on this connection failed");
} finally {
if (cancelStream != null) {
try {

View File

@ -1143,7 +1143,11 @@ public class PgConnection implements BaseConnection {
@Override
public void cancelQuery() throws SQLException {
checkClosed();
try {
queryExecutor.sendQueryCancel();
} catch (SQLException e) {
queryExecutor.close();
}
}
@Override