예제 #1
0
 public void execute() throws UnsupportedEncodingException {
   executed = true;
   CommandPacket packet = new CommandPacket();
   packet.packetId = 0;
   packet.command = MySQLPacket.COM_QUERY;
   packet.arg = rrn.getStatement().getBytes(conn.getCharset());
   conn.lastTime = TimeUtil.currentTimeMillis();
   packet.write(conn);
 }
예제 #2
0
  public boolean tryExistsCon(final BackendConnection conn, RouteResultsetNode node) {

    if (conn == null) {
      return false;
    }
    if (!conn.isFromSlaveDB() || node.canRunnINReadDB(this.autocommit)) {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("found connections in session to use " + conn + " for " + node);
      }
      conn.setAttachment(node);
      return true;
    } else {
      // slavedb connection and can't use anymore ,release it
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(
            "release slave connection,can't be used in trasaction  " + conn + " for " + node);
      }
      releaseConnection(node, LOGGER.isDebugEnabled(), false);
    }
    return false;
  }