Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javolution.context
Class HeapContext

    java.lang.Object
      javolution.context.Context
          javolution.context.AllocatorContext
              javolution.context.HeapContext

All Implemented Interfaces:
  java.io.Serializable, XMLSerializable

    public class HeapContext

extends AllocatorContext

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.

Version:
  5.2, August 19, 2007
Author:
  Jean-Marie Dautelle
See Also:
  Serialized Form

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

### HeapContext

    public HeapContext()

  Default constructor.

Method Detail

### enter

    public static HeapContext enter()

  Enters a heap context.

  Returns:
    the heap context entered.

### exit

    public static HeapContext exit()

  Exits the current heap context.

  Returns:
    the heap context being exited.
  Throws:
    `java.lang.ClassCastException` - if the context is not a heap context.

### deactivate

    protected void deactivate()

  Description copied from class: `AllocatorContext`
  Deactivates the `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`).

  Specified by:
    `deactivate` in class `AllocatorContext`

### getAllocator

    protected Allocator getAllocator(ObjectFactory factory)

  Description copied from class: `AllocatorContext`
  Returns the allocator for the specified factory in this context.

  Specified by:
    `getAllocator` in class `AllocatorContext`
  Parameters:
    `factory` - the factory for which the allocator is returned.
  Returns:
    the allocator producing instances of the specified factory.

### enterAction

    protected void enterAction()

  Description copied from class: `Context`
  The action to be performed after this context becomes the current context.

  Specified by:
    `enterAction` in class `Context`

### exitAction

    protected void exitAction()

  Description copied from class: `Context`
  The action to be performed before this context is no more the current context.

  Specified by:
    `exitAction` in class `Context`

Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 - 2007 Javolution.