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);
}
}