Class ActionHierarchy
java.lang.Object
com.arjuna.ats.arjuna.coordinator.ActionHierarchy
Class that represents the transaction hierarchy. This class
can cope with transaction hierarchies of arbitrary depth.
- Since:
- 1.0.
- Version:
- $Id: ActionHierarchy.java 2342 2006-03-30 13:06:17Z $
- Author:
- Mark Little (mark@arjuna.com)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionActionHierarchy(int depth) Create a new (blank) hierarchy with sufficient space for the specified number of transactions.ActionHierarchy(ActionHierarchy theCopy) Create a new copy of the specified transaction hierarchy. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanInsert new entry growing table as needed.final booleanAdd the transaction id at the specified level.voidCreate a copy of the specified transaction hierarchy.final intdepth()Returns the current depth of the hierarchy.final booleanequals(ActionHierarchy other) Overloads Object.equals.final intfindCommonPrefix(ActionHierarchy oldHierarchy) Find common prefix in two hierarchies.final voidRemove the deepest nested transaction from the hierarchy.final com.arjuna.ats.arjuna.coordinator.ActionInfogetActionInfo(int typeIndex) final UidgetActionUid(int typeIndex) final UidReturns the transaction id of the most deeply nested transaction.final booleanisAncestor(Uid target) Scan hierarchy looking for a particular Uid starting at deepest and going up.voidpack(OutputBuffer state) Pack the hierarchy into the buffer.voidprint(PrintWriter strm) Print out the transaction hierarchy.voidunpack(InputBuffer state) CAREFULLY unpack the 'new' hierarchy.
-
Field Details
-
DEFAULT_HIERARCHY_DEPTH
public static final int DEFAULT_HIERARCHY_DEPTH- See Also:
-
-
Constructor Details
-
ActionHierarchy
public ActionHierarchy(int depth) Create a new (blank) hierarchy with sufficient space for the specified number of transactions. Once this space is exhausted, additional space will be obtained dynamically. -
ActionHierarchy
Create a new copy of the specified transaction hierarchy.
-
-
Method Details
-
print
Print out the transaction hierarchy. -
copy
Create a copy of the specified transaction hierarchy. Any hierarchy currently maintained by this object will be lost in favour of the new hierarchy. We check for self-assignment. -
equals
Overloads Object.equals. -
add
Insert new entry growing table as needed. Transaction id will be added as a top-level transaction.- Returns:
trueif successful,falseotherwise.
-
add
Add the transaction id at the specified level.- Returns:
trueif successful,falseotherwise.
-
isAncestor
Scan hierarchy looking for a particular Uid starting at deepest and going up. Do NOT go past any top level action.- Returns:
trueif is ancestor,falseotherwise.
-
pack
Pack the hierarchy into the buffer.- Throws:
IOException
-
unpack
CAREFULLY unpack the 'new' hierarchy. We unpack into a temporary to ensure that the current hierarchy is not corrupted.- Throws:
IOException
-
forgetDeepest
public final void forgetDeepest()Remove the deepest nested transaction from the hierarchy. -
findCommonPrefix
Find common prefix in two hierarchies.- Returns:
- the index of the first common ancestor.
-
depth
public final int depth()Returns the current depth of the hierarchy.- Returns:
- the hierarchy depth.
-
getDeepestActionUid
Returns the transaction id of the most deeply nested transaction.- Returns:
- the
Uidof the deepest transaction.
-
getActionUid
- Returns:
- the identity of the transaction at the specified level in the hierarchy.
-
getActionInfo
public final com.arjuna.ats.arjuna.coordinator.ActionInfo getActionInfo(int typeIndex) - Returns:
- the ActionInfo for the transaction at the specified level. ActionInfo is not a public class so this is of limited use outside of the transaction system.
-