private void checkIfNeedHeartBeat(
     LinkedList<BackendConnection> heartBeatCons,
     ConQueue queue,
     ConcurrentLinkedQueue<BackendConnection> checkLis,
     long hearBeatTime,
     long hearBeatTime2) {
   int MAX_CONS_IN_ONE_CHECK = 10;
   Iterator<BackendConnection> checkListItor = checkLis.iterator();
   while (checkListItor.hasNext()) {
     BackendConnection con = checkListItor.next();
     if (con.isClosed()) {
       checkListItor.remove();
       continue;
     }
     if (validSchema(con.getSchema())) {
       if (con.getLastTime() < hearBeatTime) {
         if (heartBeatCons.size() < MAX_CONS_IN_ONE_CHECK) {
           checkListItor.remove();
           // Heart beat check
           con.setBorrowed(true);
           heartBeatCons.add(con);
         }
       }
     } else if (con.getLastTime() < hearBeatTime2) {
       { // not valid schema conntion should close for idle
         // exceed 2*conHeartBeatPeriod
         checkListItor.remove();
         con.close(" heart beate idle ");
       }
     }
   }
 }
  private void returnCon(BackendConnection c) {
    c.setAttachment(null);
    c.setBorrowed(false);
    c.setLastTime(TimeUtil.currentTimeMillis());
    ConQueue queue = this.conMap.getSchemaConQueue(c.getSchema());

    boolean ok = false;
    if (c.isAutocommit()) {
      ok = queue.getAutoCommitCons().offer(c);
    } else {
      ok = queue.getManCommitCons().offer(c);
    }
    if (!ok) {

      LOGGER.warn("can't return to pool ,so close con " + c);
      c.close("can't return to pool ");
    }
  }
  private BackendConnection takeCon(
      BackendConnection conn,
      final ResponseHandler handler,
      final Object attachment,
      String schema) {

    conn.setBorrowed(true);
    if (!conn.getSchema().equals(schema)) {
      // need do schema syn in before sql send
      conn.setSchema(schema);
    }
    ConQueue queue = conMap.getSchemaConQueue(schema);
    queue.incExecuteCount();
    // queue.incExecuteCount();
    conn.setAttachment(attachment);
    handler.connectionAcquired(conn);
    return conn;
  }
 public void connectionClosed(BackendConnection conn) {
   ConQueue queue = this.conMap.getSchemaConQueue(conn.getSchema());
   if (queue != null) {
     queue.removeCon(conn);
   }
 }