Top Description Inners Fields Constructors Methods
net.sf.ehcache.pool.impl

public Class UnboundedPool

extends Object
implements Pool
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.pool.Pool
Imports
java.util.Collection, .Collections, net.sf.ehcache.pool.Pool, .PoolAccessor, .PoolEvictor, .PoolParticipant, .SizeOfEngine

A no-op pool which does not enforce any resource consumption limit.
Authors
Ludovic Orban, Alex Snaps

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
UnboundedPool.UnboundedPoolAccessor

The PoolAccessor class of the UnboundedPool

Field Summary

Modifier and TypeField and Description
public static final PoolAccessor<PoolParticipant>
UNBOUNDED_ACCESSOR

An accessor that just is unbounded

Constructor Summary

AccessConstructor and Description
public
UnboundedPool()

Create an UnboundedPool instance

Method Summary

Modifier and TypeMethod and Description
public PoolAccessor<T extends PoolParticipant>
createPoolAccessor(PoolParticipant
the participant which will use the created accessor.
participant
,
int
maximum depth of the object graph to traverse
maxDepth
,
boolean
true if the object traversal should be aborted when the max depth is exceeded
abortWhenMaxDepthExceeded
)

Implements net.sf.ehcache.pool.Pool.createPoolAccessor.

Return a PoolAccessor whose consumption is tracked by this pool, using a default SizeOf engine.
public PoolAccessor<T extends PoolParticipant>
createPoolAccessor(PoolParticipant
the participant which will use the created accessor.
participant
,
SizeOfEngine
the SizeOf engine used to measure the size of objects added through the created accessor.
sizeOfEngine
)

Implements net.sf.ehcache.pool.Pool.createPoolAccessor.

Return a PoolAccessor whose consumption is tracked by this pool, using a specific SizeOf engine.
public PoolEvictor<T extends PoolParticipant>
getEvictor()

Implements net.sf.ehcache.pool.Pool.getEvictor.

Return the pool evictor used by this pool.
public long
getMaxSize()

Implements net.sf.ehcache.pool.Pool.getMaxSize.

Return the maximum size of the pool.
public Collection<PoolAccessor<T extends PoolParticipant>>
getPoolAccessors()

Implements net.sf.ehcache.pool.Pool.getPoolAccessors.

Return the participants accessing this pool.
public long
getSize()

Implements net.sf.ehcache.pool.Pool.getSize.

Return the used size of the pool.
public void
registerPoolAccessor(PoolAccessor<T extends PoolParticipant>
accessor to be registered
accessor
)

Implements net.sf.ehcache.pool.Pool.registerPoolAccessor.

Register an accessor implementation with this pool.
public void
removePoolAccessor(PoolAccessor<T extends PoolParticipant>
accessor to be removed
accessor
)

Implements net.sf.ehcache.pool.Pool.removePoolAccessor.

Remove the supplied accessor from this pool.
public void
setMaxSize(long
the new pool size.
newSize
)

Implements net.sf.ehcache.pool.Pool.setMaxSize.

Change the maximum size of the pool.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

UNBOUNDED_ACCESSORback to summary
public static final PoolAccessor<PoolParticipant> UNBOUNDED_ACCESSOR

An accessor that just is unbounded

Constructor Detail

UnboundedPoolback to summary
public UnboundedPool()

Create an UnboundedPool instance

Method Detail

createPoolAccessorback to summary
public PoolAccessor<T extends PoolParticipant> createPoolAccessor(PoolParticipant participant, int maxDepth, boolean abortWhenMaxDepthExceeded)

Implements net.sf.ehcache.pool.Pool.createPoolAccessor.

Doc from net.sf.ehcache.pool.Pool.createPoolAccessor.

Return a PoolAccessor whose consumption is tracked by this pool, using a default SizeOf engine.

Parameters
participant:PoolParticipant

the participant which will use the created accessor.

maxDepth:int

maximum depth of the object graph to traverse

abortWhenMaxDepthExceeded:boolean

true if the object traversal should be aborted when the max depth is exceeded

Returns:PoolAccessor<T extends PoolParticipant>

a PoolAccessor whose consumption is tracked by this pool.

createPoolAccessorback to summary
public PoolAccessor<T extends PoolParticipant> createPoolAccessor(PoolParticipant participant, SizeOfEngine sizeOfEngine)

Implements net.sf.ehcache.pool.Pool.createPoolAccessor.

Doc from net.sf.ehcache.pool.Pool.createPoolAccessor.

Return a PoolAccessor whose consumption is tracked by this pool, using a specific SizeOf engine.

Parameters
participant:PoolParticipant

the participant which will use the created accessor.

sizeOfEngine:SizeOfEngine

the SizeOf engine used to measure the size of objects added through the created accessor.

Returns:PoolAccessor<T extends PoolParticipant>

a PoolAccessor whose consumption is tracked by this pool.

getEvictorback to summary
public PoolEvictor<T extends PoolParticipant> getEvictor()

Implements net.sf.ehcache.pool.Pool.getEvictor.

Doc from net.sf.ehcache.pool.Pool.getEvictor.

Return the pool evictor used by this pool.

Returns:PoolEvictor<T extends PoolParticipant>

the pool evictor

getMaxSizeback to summary
public long getMaxSize()

Implements net.sf.ehcache.pool.Pool.getMaxSize.

Doc from net.sf.ehcache.pool.Pool.getMaxSize.

Return the maximum size of the pool.

Returns:long

the maximum size of the pool.

getPoolAccessorsback to summary
public Collection<PoolAccessor<T extends PoolParticipant>> getPoolAccessors()

Implements net.sf.ehcache.pool.Pool.getPoolAccessors.

Doc from net.sf.ehcache.pool.Pool.getPoolAccessors.

Return the participants accessing this pool.

Returns:Collection<PoolAccessor<T extends PoolParticipant>>

participants using this pool

getSizeback to summary
public long getSize()

Implements net.sf.ehcache.pool.Pool.getSize.

Doc from net.sf.ehcache.pool.Pool.getSize.

Return the used size of the pool.

Returns:long

used size of the pool.

registerPoolAccessorback to summary
public void registerPoolAccessor(PoolAccessor<T extends PoolParticipant> accessor)

Implements net.sf.ehcache.pool.Pool.registerPoolAccessor.

Doc from net.sf.ehcache.pool.Pool.registerPoolAccessor.

Register an accessor implementation with this pool.

Parameters
accessor:PoolAccessor<T extends PoolParticipant>

accessor to be registered

removePoolAccessorback to summary
public void removePoolAccessor(PoolAccessor<T extends PoolParticipant> accessor)

Implements net.sf.ehcache.pool.Pool.removePoolAccessor.

Doc from net.sf.ehcache.pool.Pool.removePoolAccessor.

Remove the supplied accessor from this pool.

Parameters
accessor:PoolAccessor<T extends PoolParticipant>

accessor to be removed

setMaxSizeback to summary
public void setMaxSize(long newSize)

Implements net.sf.ehcache.pool.Pool.setMaxSize.

Doc from net.sf.ehcache.pool.Pool.setMaxSize.

Change the maximum size of the pool.

Parameters
newSize:long

the new pool size.

net.sf.ehcache.pool.impl back to summary

private final Class UnboundedPool.UnboundedPoolAccessor

extends Object
implements PoolAccessor<PoolParticipant>
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.pool.PoolAccessor

The PoolAccessor class of the UnboundedPool

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public long
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
)

Implements net.sf.ehcache.pool.PoolAccessor.add.

Add an element to the pool.
public boolean
canAddWithoutEvicting(Object
the key of the element
key
,
Object
the value of the element
value
,
Object
the element-container object
container
)

Implements net.sf.ehcache.pool.PoolAccessor.canAddWithoutEvicting.

Check if there is enough room in the pool to add an element without provoking any eviction
public void
clear()

Implements net.sf.ehcache.pool.PoolAccessor.clear.

Free resources used by this accessor.
public long
delete(long
number of bytes
sizeOf
)

Implements net.sf.ehcache.pool.PoolAccessor.delete.

Delete a fixed number of bytes from the pool.
public PoolParticipant
getParticipant()

Implements net.sf.ehcache.pool.PoolAccessor.getParticipant.

Return the store that uses this accessor
public long
getPoolOccupancy()

Implements net.sf.ehcache.pool.PoolAccessor.getPoolOccupancy.

Returns the occupied size for this pool.
public long
getPoolSize()

Implements net.sf.ehcache.pool.PoolAccessor.getPoolSize.

Returns the size of this pool.
public long
getSize()

Implements net.sf.ehcache.pool.PoolAccessor.getSize.

Return how many bytes this accessor consumes from the pool.
public boolean
hasAbortedSizeOf()

Implements net.sf.ehcache.pool.PoolAccessor.hasAbortedSizeOf.

Check if the store may contain elements which the SizeOf engine could not fully size.
public long
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
)

Implements net.sf.ehcache.pool.PoolAccessor.replace.

Delete a fixed number of bytes from the pool with the given objects.
public void
setMaxSize(final long
the value in bytes
newValue
)

Implements net.sf.ehcache.pool.PoolAccessor.setMaxSize.

Sets the max size for this pool
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

UnboundedPoolAccessorback to summary
private UnboundedPoolAccessor()

Method Detail

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

Implements net.sf.ehcache.pool.PoolAccessor.add.

Doc from net.sf.ehcache.pool.PoolAccessor.add.

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)

Implements net.sf.ehcache.pool.PoolAccessor.canAddWithoutEvicting.

Doc from net.sf.ehcache.pool.PoolAccessor.canAddWithoutEvicting.

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()

Implements net.sf.ehcache.pool.PoolAccessor.clear.

Doc from net.sf.ehcache.pool.PoolAccessor.clear.

Free resources used by this accessor.

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

Implements net.sf.ehcache.pool.PoolAccessor.delete.

Doc from net.sf.ehcache.pool.PoolAccessor.delete.

Delete a fixed number of bytes from the pool.

Parameters
sizeOf: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 PoolParticipant getParticipant()

Implements net.sf.ehcache.pool.PoolAccessor.getParticipant.

Doc from net.sf.ehcache.pool.PoolAccessor.getParticipant.

Return the store that uses this accessor

Returns:PoolParticipant

store using this accessor

getPoolOccupancyback to summary
public long getPoolOccupancy()

Implements net.sf.ehcache.pool.PoolAccessor.getPoolOccupancy.

Doc from net.sf.ehcache.pool.PoolAccessor.getPoolOccupancy.

Returns the occupied size for this pool.

Returns:long

occupied pool size

getPoolSizeback to summary
public long getPoolSize()

Implements net.sf.ehcache.pool.PoolAccessor.getPoolSize.

Doc from net.sf.ehcache.pool.PoolAccessor.getPoolSize.

Returns the size of this pool.

Returns:long

pool size

getSizeback to summary
public long getSize()

Implements net.sf.ehcache.pool.PoolAccessor.getSize.

Doc from net.sf.ehcache.pool.PoolAccessor.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()

Implements net.sf.ehcache.pool.PoolAccessor.hasAbortedSizeOf.

Doc from net.sf.ehcache.pool.PoolAccessor.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)

Implements net.sf.ehcache.pool.PoolAccessor.replace.

Doc from net.sf.ehcache.pool.PoolAccessor.replace.

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(final long newValue)

Implements net.sf.ehcache.pool.PoolAccessor.setMaxSize.

Doc from net.sf.ehcache.pool.PoolAccessor.setMaxSize.

Sets the max size for this pool

Parameters
newValue:long

the value in bytes