Module org.eclipse.persistence.core
Class CommitOrderCalculator
java.lang.Object
org.eclipse.persistence.internal.sessions.CommitOrderCalculator
This class calculates a commit order for a series of classes
based on the dependencies between them. It builds up a graph of
dependencies (CommitOrderDependencyNodes) then applies topological
sort to them to get an ordering.
This is a throwaway class, which exists only for the lifetime of
the calculation.
The algorithm is described in the method comment for orderCommits().
This class also includes static methods for quicksort, copied from
the standard libraries and adapted for these objects, since that
seemed like the easiest way to sort.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected Vector
<CommitOrderDependencyNode> protected Vector
protected AbstractSession
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
void
Add to each node the dependent nodesvoid
Add to each node the dependent nodesvoid
int
getNodes()
Return the constraint ordered classes.Return the constraint ordered descriptors.void
Calculate the commit order.
-
Field Details
-
currentTime
protected int currentTime -
nodes
-
orderedDescriptors
-
session
-
-
Constructor Details
-
CommitOrderCalculator
-
-
Method Details
-
addNode
-
addNodes
-
calculateMappingDependencies
public void calculateMappingDependencies()Add to each node the dependent nodes -
calculateSpecifiedDependencies
public void calculateSpecifiedDependencies()Add to each node the dependent nodes -
depthFirstSearch
public void depthFirstSearch() -
getNextTime
public int getNextTime() -
getNodes
-
getOrderedClasses
Return the constraint ordered classes. -
getOrderedDescriptors
Return the constraint ordered descriptors. -
nodeFor
-
nodeFor
-
orderCommits
public void orderCommits()Calculate the commit order. Do a depth first search on the graph, skipping nodes that we have already visited or are in the process of visiting. Keep a counter and note when we first encounter a node and when we finish visiting it. Once we've visited everything, sort nodes by finishing time
-