|
J avolution v5.2 (J2SE 1.5+) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavolution.context.Context
javolution.context.AllocatorContext
public abstract class AllocatorContext
This class represents an allocator context; it defines the
the allocation policy of ObjectFactory
products.
The default
implementation is an instance of
HeapContext
context.
Specializations may allocate from local stacks (StackContext
),
specific memory areas (e.g. ImmortalContext
), aging pools (where
objects sufficiently old are recycled), switchable spaces (objects from
a particular frame are recycled when buffers are swapped), etc.
Nested Class Summary | |
---|---|
static class |
AllocatorContext.Reference<T>
This class represents a reference
allocated from the current AllocatorContext . |
Field Summary | |
---|---|
static Configurable<java.lang.Class<? extends AllocatorContext>> |
DEFAULT
Holds the default implementation ( HeapContext instance). |
Fields inherited from class javolution.context.Context |
---|
ROOT |
Constructor Summary | |
---|---|
protected |
AllocatorContext()
Default constructor. |
Method Summary | |
---|---|
protected abstract void |
deactivate()
Deactivates the allocators belonging to this context
for the current thread. |
protected abstract Allocator |
getAllocator(ObjectFactory factory)
Returns the allocator for the specified factory in this context. |
static AllocatorContext |
getCurrent()
Returns the current allocator context. |
static AllocatorContext |
getDefault()
Returns the default instance ( DEFAULT implementation). |
Methods inherited from class javolution.context.Context |
---|
enter, enter, enterAction, exit, exit, exitAction, getOuter, getOwner, setCurrent, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Configurable<java.lang.Class<? extends AllocatorContext>> DEFAULT
HeapContext
instance).
Constructor Detail |
---|
protected AllocatorContext()
Method Detail |
---|
public static AllocatorContext getCurrent()
getDefault()
is returned.
public static AllocatorContext getDefault()
DEFAULT
implementation).
protected abstract Allocator getAllocator(ObjectFactory factory)
factory
- the factory for which the allocator is returned.
protected abstract void deactivate()
allocators
belonging to this context
for the current thread. This method is typically called when an inner
allocator context is entered by the current thread, when exiting an
allocator context or when a concurrent executor has completed its task
within this allocator context. Deactivated allocators have no
user
(null
).
|
J avolution v5.2 (J2SE 1.5+) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |