提交 1738a44a authored 作者: noelgrandin's avatar noelgrandin

improve previous patch

 - methods can be private
 - return value from method unused
 - don't throw an exception which would drop the ODBC connection, rather just send an error response
上级 c8fec1e6
...@@ -933,28 +933,28 @@ public class PgServerThread implements Runnable { ...@@ -933,28 +933,28 @@ public class PgServerThread implements Runnable {
return this.processId; return this.processId;
} }
synchronized void setActiveRequest(JdbcStatement statement) { private synchronized void setActiveRequest(JdbcStatement statement) {
activeRequest = statement; activeRequest = statement;
} }
/** /**
* Kill a currently running query on this thread. * Kill a currently running query on this thread.
* @param secret the private key of the command * @param secret the private key of the command
* @return true if the command was successfully killed
*/ */
synchronized boolean cancelRequest(int secret) throws IOException { private synchronized void cancelRequest(int secret) throws IOException {
if (activeRequest != null) if (activeRequest != null)
{ {
if (secret != this.secret) throw new IOException("invalid cancel secret"); if (secret != this.secret) {
sendErrorResponse("invalid cancel secret");
return;
}
try { try {
activeRequest.cancel(); activeRequest.cancel();
activeRequest = null; activeRequest = null;
} catch (SQLException e) { } catch (SQLException e) {
throw DbException.convert(e); throw DbException.convert(e);
} }
return true;
} }
return false;
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论