Exemplo n.º 1
0
  public void releaseConnection(RouteResultsetNode rrn, boolean debug, final boolean needRollback) {

    BackendConnection c = target.remove(rrn);
    if (c != null) {
      if (debug) {
        LOGGER.debug("release connection " + c);
      }
      if (c.getAttachment() != null) {
        c.setAttachment(null);
      }
      if (!c.isClosed()) {
        if (c.isAutocommit()) {
          c.release();
        } else if (needRollback) {
          c.setResponseHandler(new RollbackReleaseHandler());
          c.rollback();
        } else {
          c.release();
        }
      }
    }
  }
Exemplo n.º 2
0
 public void releaseConnection(BackendConnection con) {
   Iterator<Entry<RouteResultsetNode, BackendConnection>> itor = target.entrySet().iterator();
   while (itor.hasNext()) {
     BackendConnection theCon = itor.next().getValue();
     if (theCon == con) {
       itor.remove();
       con.release();
       if (LOGGER.isDebugEnabled()) {
         LOGGER.debug("realse connection " + con);
       }
       break;
     }
   }
 }