public void close() { RuntimeException closeError = null; if (transferList != null) { synchronized (this) { for (Transfer transfer : transferList) { try { traceOperation("SESSION_CLOSE", 0); transfer.writeInt(SessionRemote.SESSION_CLOSE); done(transfer); transfer.close(); } catch (RuntimeException e) { trace.error(e, "close"); closeError = e; } catch (Exception e) { trace.error(e, "close"); } } } transferList = null; } traceSystem.close(); if (embedded != null) { embedded.close(); embedded = null; } if (closeError != null) { throw closeError; } }
/** * Cancel the statement with the given id. * * @param id the statement id */ public void cancelStatement(int id) { for (Transfer transfer : transferList) { try { Transfer trans = transfer.openNewConnection(); trans.init(); trans.writeInt(clientVersion); trans.writeInt(clientVersion); trans.writeString(null); trans.writeString(null); trans.writeString(sessionId); trans.writeInt(SessionRemote.SESSION_CANCEL_STATEMENT); trans.writeInt(id); trans.close(); } catch (IOException e) { trace.debug(e, "could not cancel statement"); } } }
/** * Write the operation to the trace system if debug trace is enabled. * * @param operation the operation performed * @param id the id of the operation */ public void traceOperation(String operation, int id) { if (trace.isDebugEnabled()) { trace.debug("{0} {1}", operation, id); } }