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

For more information, please explore the Attic.

public class

RoundRobinAllocationPolicy

extends Object
implements AllocationPolicy
java.lang.Object
   ↳ org.apache.directmemory.memory.RoundRobinAllocationPolicy

Class Overview

Round Robin allocation policy. An internal counter is incremented (modulo the size of the buffer), so each calls to #getActiveBuffer(OffHeapMemoryBuffer, int) will increment the counter and return the buffer at the index of the counter.

Summary

Public Constructors
RoundRobinAllocationPolicy()
Public Methods
Allocator getActiveAllocator(Allocator previousAllocator, int allocationNumber)
Returns the Allocator to use to allocate.
void init(List<Allocator> allocators)
Initialization function.
void reset()
Reset internal state
void setMaxAllocations(int maxAllocations)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.directmemory.memory.AllocationPolicy

Public Constructors

public RoundRobinAllocationPolicy ()

Public Methods

public 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 void init (List<Allocator> allocators)

Initialization function.

public void reset ()

Reset internal state

public void setMaxAllocations (int maxAllocations)