Top Description Methods
net.sf.ehcache.pool

public Interface PoolAccessor<T extends net.sf.ehcache.pool.PoolParticipant>

Known Direct Implementers
net.sf.ehcache.pool.impl.AbstractPoolAccessor, net.sf.ehcache.pool.impl.UnboundedPool.UnboundedPoolAccessor
Type Parameters
<T>
Type representing this "other" side of this accessor (i.e. a store), so the evictor can interact with it

PoolAccessors are used by stores to tell the pools about their resource consumption
Authors
Ludovic Orban, Alex Snaps

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

how many bytes have been added to the pool or -1 if add failed.
add
(Object
the key of the element
key
,
Object
the value of the element
value
,
Object
the element-container object
container
,
boolean
true if the pool should accept adding the element, even if it's out of resources
force
)

Add an element to the pool.

public boolean

Returns:

true if there is enough room left
canAddWithoutEvicting
(Object
the key of the element
key
,
Object
the value of the element
value
,
Object
the element-container object
container
)

Check if there is enough room in the pool to add an element without provoking any eviction

public void
clear()

Free resources used by this accessor.

public long

Returns:

how many bytes have been freed from the pool.
delete
(long
number of bytes
size
)

Delete a fixed number of bytes from the pool.

public T

Returns:

store using this accessor
getParticipant
()

Return the store that uses this accessor

public long

Returns:

occupied pool size
getPoolOccupancy
()

Returns the occupied size for this pool.

public long

Returns:

pool size
getPoolSize
()

Returns the size of this pool.

public long

Returns:

how many bytes this accessor consumes from the pool.
getSize
()

Return how many bytes this accessor consumes from the pool.

public boolean

Returns:

true if the store may contain partially sized objects
hasAbortedSizeOf
()

Check if the store may contain elements which the SizeOf engine could not fully size.

public long

Returns:

the change in size of the pool, or Long#MIN_VALUE if replace failed.
replace
(long
the size of the object(s) being replaced
currentSize
,
Object
the key of the element
key
,
Object
the value of the element
value
,
Object
the element-container object
container
,
boolean
true if the pool should accept replacing the element, even if it's out of resources
force
)

Delete a fixed number of bytes from the pool with the given objects.

public void
setMaxSize(long
the value in bytes
newValue
)

Sets the max size for this pool

Method Detail

addback to summary
public long add(Object key, Object value, Object container, boolean force)

Add an element to the pool.

Parameters
key:Object

the key of the element

value:Object

the value of the element

container:Object

the element-container object

force:boolean

true if the pool should accept adding the element, even if it's out of resources

Returns:long

how many bytes have been added to the pool or -1 if add failed.

canAddWithoutEvictingback to summary
public boolean canAddWithoutEvicting(Object key, Object value, Object container)

Check if there is enough room in the pool to add an element without provoking any eviction

Parameters
key:Object

the key of the element

value:Object

the value of the element

container:Object

the element-container object

Returns:boolean

true if there is enough room left

clearback to summary
public void clear()

Free resources used by this accessor.

deleteback to summary
public long delete(long size) throws IllegalArgumentException

Delete a fixed number of bytes from the pool.

Parameters
size:long

number of bytes

Returns:long

how many bytes have been freed from the pool.

Exceptions
IllegalArgumentException:
when sizeOf is negative
getParticipantback to summary
public T getParticipant()

Return the store that uses this accessor

Returns:T

store using this accessor

getPoolOccupancyback to summary
public long getPoolOccupancy()

Returns the occupied size for this pool.

Returns:long

occupied pool size

getPoolSizeback to summary
public long getPoolSize()

Returns the size of this pool.

Returns:long

pool size

getSizeback to summary
public long getSize()

Return how many bytes this accessor consumes from the pool.

Returns:long

how many bytes this accessor consumes from the pool.

hasAbortedSizeOfback to summary
public boolean hasAbortedSizeOf()

Check if the store may contain elements which the SizeOf engine could not fully size.

Returns:boolean

true if the store may contain partially sized objects

replaceback to summary
public long replace(long currentSize, Object key, Object value, Object container, boolean force)

Delete a fixed number of bytes from the pool with the given objects.

Parameters
currentSize:long

the size of the object(s) being replaced

key:Object

the key of the element

value:Object

the value of the element

container:Object

the element-container object

force:boolean

true if the pool should accept replacing the element, even if it's out of resources

Returns:long

the change in size of the pool, or Long#MIN_VALUE if replace failed.

setMaxSizeback to summary
public void setMaxSize(long newValue)

Sets the max size for this pool

Parameters
newValue:long

the value in bytes