|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.sco.Freezer
public class Freezer
Freezer is a helper class with static methods to assist transcribing non-ordered collection and map classes. When an unordered collection or map is written to the datastore and subsequently fetched, the order of elements can change. This causes optimistic failures for persistent instances that contain unordered collections even if the collection has not changed. Another issue solved by the Freezer is that if the user defines an ordering or hashing based on persistent values of the elements, during transcribing while fetching the instance from the datastore the persistent instance must be fetched. This causes recursion in the fetch process. Freezing is the process of iterating the elements of a collection or iterating the entrySet elements of a map and constructing an array of elements in an absolute ordering. Freezing is done during transcribing for storage. Thawing is the process of iterating the frozen elements and storing them in their user-visible order or using their user-visible hashCode. A collection or map is frozen when read from the datastore, and thawed upon first application use.
Nested Class Summary | |
---|---|
protected static class |
Freezer.FrozenIterator
This class iterates over an array. |
Constructor Summary | |
---|---|
protected |
Freezer()
This class currently is not used as a class but only as a helper. |
Method Summary | |
---|---|
static java.util.Map |
createAbsoluteOrderMap()
Create a map whose elements are ordered according to an absolute ordering. |
static java.util.Iterator |
createFrozenIterator(java.lang.Object[] frozen)
Create an iterator over frozen elements or entries. |
static java.lang.Object[] |
freeze(java.util.Collection set,
int size)
Provide a frozen array of elements from a Set. |
static java.util.Map.Entry[] |
freeze(java.util.Map map,
int size)
Provide a frozen array of elements from the entrySet of a Map. |
static java.util.Iterator |
frozenIterator(java.util.Map map,
int size)
Provide a frozen iterator of elements from the entrySet of a Map. |
static void |
printElements(java.io.PrintStream p,
java.lang.String s,
java.lang.Object[] elements)
For debugging, print the contents of a frozen collection. |
static void |
printEntries(java.io.PrintStream p,
java.lang.String s,
java.util.Map.Entry[] entries)
For debugging, print the contents of a frozen entrySet. |
static java.lang.Object[] |
thaw(SCOCollection sco,
StateManagerInternal owner,
java.lang.Object[] frozenElements)
Thaw the frozen elements of a collection. |
static java.util.Map.Entry[] |
thaw(SCOMap map,
StateManagerInternal owner,
java.util.Map.Entry[] frozenEntries)
Thaw the frozen elements of a map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Freezer()
Method Detail |
---|
public static java.lang.Object[] freeze(java.util.Collection set, int size)
size
- the number of elements in the collection.set
- the Set whose elements are to be ordered.
public static java.util.Map.Entry[] freeze(java.util.Map map, int size)
size
- the number of entries in the map.map
- the Map whose entrySet elements are to be calculated.
public static java.util.Iterator frozenIterator(java.util.Map map, int size)
size
- the number of entries in the map.map
- the Map whose entrySet elements are to be calculated.
public static java.util.Map createAbsoluteOrderMap()
public static java.util.Iterator createFrozenIterator(java.lang.Object[] frozen)
frozen
- the array of frozen entries or elements.
public static java.util.Map.Entry[] thaw(SCOMap map, StateManagerInternal owner, java.util.Map.Entry[] frozenEntries)
map
- the Map to be thawed.owner
- the StateManager that owns this Map.frozenEntries
- the frozen entries to be thawed.
public static java.lang.Object[] thaw(SCOCollection sco, StateManagerInternal owner, java.lang.Object[] frozenElements)
sco
- the frozen collection to be thawed.owner
- the StateManager that owns this collection.frozenElements
- the elements to be thawed.
public static void printEntries(java.io.PrintStream p, java.lang.String s, java.util.Map.Entry[] entries)
p
- where to write the output.s
- an identifying string.entries
- the Map.Entry[] to print.public static void printElements(java.io.PrintStream p, java.lang.String s, java.lang.Object[] elements)
p
- where to write the output.s
- an identifying string.elements
- the Object[] to print.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |