Class CycleBreaker

java.lang.Object
org.castor.core.util.CycleBreaker

public class CycleBreaker extends Object

lightweight mechanism for thread-safe detection of cyclic calls to hashCode or equals in objects created by the XML CodeGenerator.

Usage

  1. startingToCycle is called on a particular object prior to recursing on it, and recursion should only occur if this call returns false.
  2. releaseCycleHandle is called after the recursive call returns in order to release the cycle lock on the object.

Note : Do not use this cycle breaking mechanism on object comparisons where two instances may share the same reference to some third object, such as a String constant.

Author:
Jim Procter