2015/07/26 - Apache DirectMemory has been retired.

For more information, please explore the Attic.

public interface

AllocationPolicy

org.apache.directmemory.memory.AllocationPolicy
Known Indirect Subclasses

Class Overview

Interface describing the buffer allocation policy. The implementations will be initialized by setting the list of buffers init(List), and every allocation will call #getActiveBuffer(OffHeapMemoryBuffer, int), passing the previously (possibly null) buffer that failed to allocate and the number of the current allocation

Summary

Public Methods
abstract Allocator getActiveAllocator(Allocator previousAllocator, int allocationNumber)
Returns the Allocator to use to allocate.
abstract void init(List<Allocator> allocators)
Initialization function.
abstract void reset()
Reset internal state

Public Methods

public abstract Allocator getActiveAllocator (Allocator previousAllocator, int allocationNumber)

Returns the Allocator to use to allocate.

Parameters
previousAllocator : the previously used Allocator, or null if it's the first allocation
allocationNumber : the number of time the allocation has already failed.
Returns
  • the Allocator to use, or null if allocation has failed.

public abstract void init (List<Allocator> allocators)

Initialization function.

public abstract void reset ()

Reset internal state