|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.offheapstore.paging.PhantomReferenceLimitedPageSource
public class PhantomReferenceLimitedPageSource
A PhantomReference based limited byte buffer source.
This buffer source tracks 'freeing' of allocated byte buffers using phantom
references to the allocated buffers and an associated reference queue. An
AtomicLong is then used to track number of available bytes for
allocation.
| Constructor Summary | |
|---|---|
PhantomReferenceLimitedPageSource(long max)
Create a source that will allocate at most max bytes. |
|
| Method Summary | |
|---|---|
Page |
allocate(int size,
boolean thief,
boolean victim,
OffHeapStorageArea owner)
Allocates a byte buffer of the given size. |
void |
free(Page buffer)
Frees the supplied buffer. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PhantomReferenceLimitedPageSource(long max)
max bytes.
max - the maximum total size of all available buffers| Method Detail |
|---|
public Page allocate(int size,
boolean thief,
boolean victim,
OffHeapStorageArea owner)
This BufferSource places no restrictions on the requested size of
the buffer.
allocate in interface PageSourcesize - size of page to allocatethief - true if the allocation can steal space from victimsvictim - true if the allocated page should be eligible for stealingowner - owner from which subsequent steal should occur
null in the case of failurepublic void free(Page buffer)
This implementation is a no-op, no validation of the supplied buffer is attempted, as freeing of allocated buffers is monitored via phantom references.
free in interface PageSourcepublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||