use of com.alibaba.cobar.mysql.nio.handler.RollbackReleaseHandler in project cobar by alibaba.
the class NonBlockingSession method clearConnections.
private void clearConnections(boolean pessimisticRelease) {
for (RouteResultsetNode node : target.keySet()) {
MySQLConnection c = target.remove(node);
if (c == null || c.isClosedOrQuit()) {
continue;
}
// 如果通道正在运行中,则关闭当前通道。
if (c.isRunning() || (pessimisticRelease && source.isClosed())) {
c.close();
continue;
}
// 非事务中的通道,直接释放资源。
if (c.isAutocommit()) {
c.release();
continue;
}
c.setResponseHandler(new RollbackReleaseHandler());
c.rollback();
}
}
Aggregations