Package net.sf.ehcache.pool.impl
Class DefaultSizeOfEngine
- java.lang.Object
-
- net.sf.ehcache.pool.impl.DefaultSizeOfEngine
-
- All Implemented Interfaces:
SizeOfEngine
public class DefaultSizeOfEngine extends java.lang.Object implements SizeOfEngine
- Author:
- Alex Snaps
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringUSER_FILTER_RESOURCESystem property defining a user specific resource based size-of filter.
-
Constructor Summary
Constructors Constructor Description DefaultSizeOfEngine(int maxDepth, boolean abortWhenMaxDepthExceeded)Creates a default size of engine using the best available sizing algorithm.DefaultSizeOfEngine(int maxDepth, boolean abortWhenMaxDepthExceeded, boolean silent)Creates a default size of engine using the best available sizing algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SizeOfEnginecopyWith(int maxDepth, boolean abortWhenMaxDepthExceeded)Make a copy of the SizeOf engine, preserving all of its internal state but overriding the specified parametersSizesizeOf(java.lang.Object key, java.lang.Object value, java.lang.Object container)Size an element
-
-
-
Field Detail
-
USER_FILTER_RESOURCE
public static final java.lang.String USER_FILTER_RESOURCE
System property defining a user specific resource based size-of filter.The resource pointed to by this property must be a list of fully qualified field or class names, one per line:
# This is a comment org.mycompany.domain.MyType org.mycompany.domain.MyOtherType.myField
Fields or types matching against lines in this resource will be ignored when calculating the size of the object graph.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultSizeOfEngine
public DefaultSizeOfEngine(int maxDepth, boolean abortWhenMaxDepthExceeded)Creates a default size of engine using the best available sizing algorithm.- Parameters:
maxDepth- the max object graph that will be traversed.abortWhenMaxDepthExceeded- true if the object traversal should be aborted when the max depth is exceeded
-
DefaultSizeOfEngine
public DefaultSizeOfEngine(int maxDepth, boolean abortWhenMaxDepthExceeded, boolean silent)Creates a default size of engine using the best available sizing algorithm.- Parameters:
maxDepth- the max object graph that will be traversed.abortWhenMaxDepthExceeded- true if the object traversal should be aborted when the max depth is exceededsilent- true if no info log explaining which agent was chosen should be printed
-
-
Method Detail
-
copyWith
public SizeOfEngine copyWith(int maxDepth, boolean abortWhenMaxDepthExceeded)
Make a copy of the SizeOf engine, preserving all of its internal state but overriding the specified parameters- Specified by:
copyWithin interfaceSizeOfEngine- Parameters:
maxDepth- maximum depth of the object graph to traverseabortWhenMaxDepthExceeded- true if the object traversal should be aborted when the max depth is exceeded- Returns:
- a copy of the SizeOf engine using the specified parameters
-
sizeOf
public Size sizeOf(java.lang.Object key, java.lang.Object value, java.lang.Object container)
Size an element- Specified by:
sizeOfin interfaceSizeOfEngine- Parameters:
key- the key of the elementvalue- the value of the elementcontainer- the container of the element, ie: element object + eventual overhead- Returns:
- the size of the element in bytes
-
-