|
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
javolution.context.HeapContext
public class HeapContext
This class represents the default allocator context. Allocations are
performed using the new
keyword and explicit object
recycling
is supported:
char[] buffer = ArrayFactory.CHARS_FACTORY.array(4098); // Possibly recycled.
while (reader.read(buffer) > 0) { ... }
ArrayFactory.CHARS_FACTORY.recycle(buffer); // Explicit recycling.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javolution.context.AllocatorContext |
---|
AllocatorContext.Reference<T> |
Field Summary |
---|
Fields inherited from class javolution.context.AllocatorContext |
---|
DEFAULT |
Fields inherited from class javolution.context.Context |
---|
ROOT |
Constructor Summary | |
---|---|
HeapContext()
Default constructor. |
Method Summary | |
---|---|
protected void |
deactivate()
Deactivates the allocators belonging to this context
for the current thread. |
static HeapContext |
enter()
Enters a heap context. |
protected void |
enterAction()
The action to be performed after this context becomes the current context. |
static HeapContext |
exit()
Exits the current heap context. |
protected void |
exitAction()
The action to be performed before this context is no more the current context. |
protected Allocator |
getAllocator(ObjectFactory factory)
Returns the allocator for the specified factory in this context. |
Methods inherited from class javolution.context.AllocatorContext |
---|
getCurrent, getDefault |
Methods inherited from class javolution.context.Context |
---|
enter, enter, exit, getOuter, getOwner, setCurrent, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HeapContext()
Method Detail |
---|
public static HeapContext enter()
public static HeapContext exit()
java.lang.ClassCastException
- if the context is not a heap context.protected void deactivate()
AllocatorContext
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
).
deactivate
in class AllocatorContext
protected Allocator getAllocator(ObjectFactory factory)
AllocatorContext
getAllocator
in class AllocatorContext
factory
- the factory for which the allocator is returned.
protected void enterAction()
Context
enterAction
in class Context
protected void exitAction()
Context
exitAction
in class Context
|
J avolution v5.2 (J2SE 1.5+) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |