use of com.actiontech.dble.server.NonBlockingSession in project dble by actiontech.
the class XASessionCheck method checkRollbackSession.
private void checkRollbackSession() {
for (NonBlockingSession session : rollbackSession.values()) {
this.rollbackSession.remove(session.getSource().getId());
session.rollback();
}
}
use of com.actiontech.dble.server.NonBlockingSession in project dble by actiontech.
the class ShowBinlogStatus method waitAllSession.
public static boolean waitAllSession() {
logger.info("waiting all sessions of distributed transaction which are not finished.");
long timeout = DbleServer.getInstance().getConfig().getSystem().getShowBinlogStatusTimeout();
long beginTime = TimeUtil.currentTimeMillis();
List<NonBlockingSession> fcList = getNeedWaitSession();
while (!fcList.isEmpty()) {
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10));
Iterator<NonBlockingSession> sListIterator = fcList.iterator();
while (sListIterator.hasNext()) {
NonBlockingSession session = sListIterator.next();
if (!session.isNeedWaitFinished()) {
sListIterator.remove();
}
}
if ((TimeUtil.currentTimeMillis() > beginTime + timeout)) {
logger.info("wait session finished timeout");
return false;
}
}
logger.info("all sessions of distributed transaction are paused.");
return true;
}
use of com.actiontech.dble.server.NonBlockingSession in project dble by actiontech.
the class ShowBinlogStatus method waitAllSession.
private static boolean waitAllSession(ManagerConnection c, long timeout, long beginTime) {
logger.info("waiting all sessions of distributed transaction which are not finished.");
List<NonBlockingSession> fcList = getNeedWaitSession();
while (!fcList.isEmpty()) {
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10));
Iterator<NonBlockingSession> sListIterator = fcList.iterator();
while (sListIterator.hasNext()) {
NonBlockingSession session = sListIterator.next();
if (!session.isNeedWaitFinished()) {
sListIterator.remove();
}
}
if (c.isClosed()) {
errMsg = "client closed while waiting for unfinished distributed transactions.";
logger.info(errMsg);
return false;
}
if (TimeUtil.currentTimeMillis() > beginTime + timeout) {
errMsg = "timeout while waiting for unfinished distributed transactions.";
logger.info(errMsg);
return false;
}
}
logger.info("all sessions of distributed transaction are paused.");
return true;
}
use of com.actiontech.dble.server.NonBlockingSession in project dble by actiontech.
the class ShowBinlogStatus method getNeedWaitSession.
private static List<NonBlockingSession> getNeedWaitSession() {
List<NonBlockingSession> fcList = new ArrayList<>();
for (NIOProcessor process : DbleServer.getInstance().getFrontProcessors()) {
for (FrontendConnection front : process.getFrontends().values()) {
if (!(front instanceof ServerConnection)) {
continue;
}
ServerConnection sc = (ServerConnection) front;
NonBlockingSession session = sc.getSession2();
if (session.isNeedWaitFinished()) {
fcList.add(session);
}
}
}
return fcList;
}
use of com.actiontech.dble.server.NonBlockingSession in project dble by actiontech.
the class XASessionCheck method checkCommitSession.
private void checkCommitSession() {
for (NonBlockingSession session : commitSession.values()) {
if (session.getXaState() == TxState.TX_COMMIT_FAILED_STATE) {
this.commitSession.remove(session.getSource().getId());
session.commit();
}
}
}
Aggregations