public void setTimeout(Xid id, long timeout) throws UnknownDtxBranchException { DtxBranch branch = getBranch(id); if(branch != null) { branch.setTimeout(timeout); } else { throw new UnknownDtxBranchException(id); } }
@Override public void dtxSetTimeout(ServerSession session, DtxSetTimeout method) { try { session.setTimeoutDtx(method.getXid(), method.getTimeout()); } catch(UnknownDtxBranchException e) { exception(session, method, ExecutionErrorCode.NOT_FOUND, e.getMessage()); } }
public long getTimeout(Xid id) throws UnknownDtxBranchException { DtxBranch branch = getBranch(id); if(branch != null) { return branch.getTimeout(); } else { throw new UnknownDtxBranchException(id); } }
@Override public void dtxForget(ServerSession session, DtxForget method) { try { session.forgetDtx(method.getXid()); } catch(UnknownDtxBranchException e) { exception(session, method, ExecutionErrorCode.NOT_FOUND, e.getMessage()); } catch(IncorrectDtxStateException e) { exception(session, method, ExecutionErrorCode.ILLEGAL_STATE, e.getMessage()); } }
public void forget(Xid id) throws UnknownDtxBranchException, IncorrectDtxStateException { DtxBranch branch = getBranch(id); if(branch != null) { synchronized (branch) { if(!branch.hasAssociatedSessions()) { if(branch.getState() != DtxBranch.State.HEUR_COM && branch.getState() != DtxBranch.State.HEUR_RB) { throw new IncorrectDtxStateException("Branch should not be forgotten - " + "it is not heuristically complete", id); } branch.setState(DtxBranch.State.FORGOTTEN); unregisterBranch(branch); } else { throw new IncorrectDtxStateException("Branch was still associated with a session", id); } } } else { throw new UnknownDtxBranchException(id); } }
@Override public void dtxGetTimeout(ServerSession session, DtxGetTimeout method) { GetTimeoutResult result = new GetTimeoutResult(); try { result.setTimeout(session.getTimeoutDtx(method.getXid())); session.executionResult(method.getId(), result); } catch(UnknownDtxBranchException e) { exception(session, method, ExecutionErrorCode.NOT_FOUND, e.getMessage()); } }
exception(session, method, ExecutionErrorCode.NOT_FOUND, e.getMessage());
exception(session, method, ExecutionErrorCode.NOT_FOUND, e.getMessage());
exception(session, method, ExecutionErrorCode.NOT_FOUND, e.getMessage());
exception(session, method, ExecutionErrorCode.ILLEGAL_STATE, e.getMessage());