EclipseLink 2.2.0, build 'v20110202-r8913' API Reference

org.eclipse.persistence.sessions.factories
Enum ReferenceMode

java.lang.Object
  extended by java.lang.Enum<ReferenceMode>
      extended by org.eclipse.persistence.sessions.factories.ReferenceMode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ReferenceMode>

public enum ReferenceMode
extends java.lang.Enum<ReferenceMode>

Purpose: This class is a configuration property used to specify What type of Referenes EclipseLink will use when referencing Entities within the Persistence Context / UnitOfWork. Depending on the configured ReferenceMode some Entities may be garbage collected.

Author:
Gordon

Enum Constant Summary
FORCE_WEAK
          Same as weak reference except Objects that can not be changed tracked (Deferred Change Detection) will not be prevented from being garbage collected.
HARD
          References to Objects will be through hard references.
WEAK
          References to Objects that support active attribute change tracking (enabled through weaving or by the developer)will be held by weak references.
 
Method Summary
static ReferenceMode valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ReferenceMode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

HARD

public static final ReferenceMode HARD
References to Objects will be through hard references. These objects will not be available for garbage collection until the referencing artifact (usually a Persistence Context or UnitOfWork) released or closed.


WEAK

public static final ReferenceMode WEAK
References to Objects that support active attribute change tracking (enabled through weaving or by the developer)will be held by weak references. This means any of afore mentioned objects no longer referenced directly or indirectly will be available for garbage collection. If the object is gc'd before the EM/UnitOfWork flushes to the database then this object and any others like it will not be checked for changes. When a change is made to a change tracked object that object is moved to a hard reference and will not be available for GC until flushed. New and removed objects are also held by hard references. Non change tracked objects will always be held by "hard" references and are not available for GC. This is the default mode for EclipsLink. See: WeakReference AttributeChangeTrackingPolicy


FORCE_WEAK

public static final ReferenceMode FORCE_WEAK
Same as weak reference except Objects that can not be changed tracked (Deferred Change Detection) will not be prevented from being garbage collected. This may result in a loss of changes if a changed object is removed before being flushed to the database. When a change is made to a change tracked object that object is moved to a hard reference and will not be available for GC until flushed. New and removed objects are also held by hard references until flush..

Method Detail

values

public static ReferenceMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ReferenceMode c : ReferenceMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ReferenceMode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

EclipseLink 2.2.0, build 'v20110202-r8913' API Reference