try {
if (connection.getQueryTimeoutKillsConnection()) {
toCancel.wasCancelled = true;
toCancel.wasCancelledByTimeout = true;
connection.realClose(false, false, true,
new MySQLStatementCancelledException(Messages.getString("Statement.ConnectionKilledDueToTimeout")));
} else {
synchronized (cancelTimeoutMutex) {
if (origConnURL.equals(connection.getURL())) {
//All's fine
cancelConn = connection.duplicate();