Top Constructors Methods
com.mchange.v2.coalesce

public final Class CoalescerFactory

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Coalescer
createCoalescer()

Creates a "Coalescer" that coalesces Objects according to their equals() method.

public static Coalescer
createCoalescer(boolean
if true, the Coalescer will use WeakReferences to hold its canonical instances, allowing them to be garbage collected if they are nowhere in use.
weak
,
boolean
if true, access to the Coalescer will be automatically synchronized. if set to false, then users must manually synchronize access.
synced
)

Creates a "Coalescer" that coalesces Objects according to their equals() method.

public static Coalescer
createCoalescer(CoalesceChecker
CoalesceChecker that will be used to determine whether two objects are equivalent and can be coalesced. [If cc is null, then two objects will be coalesced iff o1.equals( o2 ).]
cc
,
boolean
if true, the Coalescer will use WeakReferences to hold its canonical instances, allowing them to be garbage collected if they are nowhere in use.
weak
,
boolean
if true, access to the Coalescer will be automatically synchronized. if set to false, then users must manually synchronize access.
synced
)

Creates a "Coalescer" that coalesces Objects according to the checkCoalesce() method of a "CoalesceChecker".

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CoalescerFactoryback to summary
public CoalescerFactory()

Method Detail

createCoalescerback to summary
public static Coalescer createCoalescer()

Creates a "Coalescer" that coalesces Objects according to their equals() method. Given a set of n Objects among whom equals() would return true, calling coalescer.coalesce() in any order on any sequence of these Objects will always return a single "canonical" instance.

This method creates a weak, synchronized coalesecer, safe for use by multiple Threads.

createCoalescerback to summary
public static Coalescer createCoalescer(boolean weak, boolean synced)

Creates a "Coalescer" that coalesces Objects according to their equals() method. Given a set of n Objects among whom equals() would return true, calling coalescer.coalesce() in any order on any sequence of these Objects will always return a single "canonical" instance.

Parameters
weak:boolean

if true, the Coalescer will use WeakReferences to hold its canonical instances, allowing them to be garbage collected if they are nowhere in use.

synced:boolean

if true, access to the Coalescer will be automatically synchronized. if set to false, then users must manually synchronize access.

createCoalescerback to summary
public static Coalescer createCoalescer(CoalesceChecker cc, boolean weak, boolean synced)

Creates a "Coalescer" that coalesces Objects according to the checkCoalesce() method of a "CoalesceChecker". Given a set of n Objects among whom calling cc.checkCoalesce() on any pair would return true, calling coalescer.coalesce() in any order on any sequence of these Objects will always return a single "canonical" instance. This allows one to define immutable value Objects whose equals() method is a mere identity test -- one can use a Coalescer in a factory method to ensure that no two instances with the same values are made available to clients.

Parameters
cc:CoalesceChecker

CoalesceChecker that will be used to determine whether two objects are equivalent and can be coalesced. [If cc is null, then two objects will be coalesced iff o1.equals( o2 ).]

weak:boolean

if true, the Coalescer will use WeakReferences to hold its canonical instances, allowing them to be garbage collected if they are nowhere in use.

synced:boolean

if true, access to the Coalescer will be automatically synchronized. if set to false, then users must manually synchronize access.