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

public Class DefaultSizeOfEngine

extends Object
implements SizeOfEngine
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.pool.SizeOfEngine
Imports
java.io.File, .IOException, java.net.MalformedURLException, .URL, java.util.ArrayList, .Collection, .List, net.sf.ehcache.CacheException, net.sf.ehcache.pool.Size, .SizeOfEngine, net.sf.ehcache.pool.sizeof.AgentSizeOf, .ReflectionSizeOf, .SizeOf, .UnsafeSizeOf, .MaxDepthExceededException, net.sf.ehcache.pool.sizeof.filter.AnnotationSizeOfFilter, .CombinationSizeOfFilter, .ResourceSizeOfFilter, .SizeOfFilter, org.slf4j.Logger, .LoggerFactory

Author
Alex Snaps

Field Summary

Modifier and TypeField and Description
private final boolean
private static final SizeOfFilter
private static final Logger
private final int
private final SizeOf
private static final boolean
public static final String
USER_FILTER_RESOURCE

System property defining a user specific resource based size-of filter.

private static final String

Constructor Summary

AccessConstructor and Description
public
DefaultSizeOfEngine(int
the max object graph that will be traversed.
maxDepth
,
boolean
true if the object traversal should be aborted when the max depth is exceeded
abortWhenMaxDepthExceeded
)

Creates a default size of engine using the best available sizing algorithm.

public
DefaultSizeOfEngine(int
the max object graph that will be traversed.
maxDepth
,
boolean
true if the object traversal should be aborted when the max depth is exceeded
abortWhenMaxDepthExceeded
,
boolean
true if no info log explaining which agent was chosen should be printed
silent
)

Creates a default size of engine using the best available sizing algorithm.

private
DefaultSizeOfEngine(DefaultSizeOfEngine defaultSizeOfEngine, int maxDepth, boolean abortWhenMaxDepthExceeded)

Method Summary

Modifier and TypeMethod and Description
public SizeOfEngine
copyWith(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.SizeOfEngine.copyWith.

Make a copy of the SizeOf engine, preserving all of its internal state but overriding the specified parameters
private static SizeOfFilter
private static boolean
public Size
sizeOf(final Object
the key of the element
key
,
final Object
the value of the element
value
,
final Object
the container of the element, ie: element object + eventual overhead
container
)

Implements net.sf.ehcache.pool.SizeOfEngine.sizeOf.

Size an element
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

abortWhenMaxDepthExceededback to summary
private final boolean abortWhenMaxDepthExceeded
DEFAULT_FILTERback to summary
private static final SizeOfFilter DEFAULT_FILTER
LOGback to summary
private static final Logger LOG
maxDepthback to summary
private final int maxDepth
sizeOfback to summary
private final SizeOf sizeOf
USE_VERBOSE_DEBUG_LOGGINGback to summary
private static final boolean USE_VERBOSE_DEBUG_LOGGING
USER_FILTER_RESOURCEback to summary
public static final 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.
VERBOSE_DEBUG_LOGGINGback to summary
private static final String VERBOSE_DEBUG_LOGGING

Constructor Detail

DefaultSizeOfEngineback to summary
public DefaultSizeOfEngine(int maxDepth, boolean abortWhenMaxDepthExceeded)

Creates a default size of engine using the best available sizing algorithm.

Parameters
maxDepth:int

the max object graph that will be traversed.

abortWhenMaxDepthExceeded:boolean

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

DefaultSizeOfEngineback to summary
public DefaultSizeOfEngine(int maxDepth, boolean abortWhenMaxDepthExceeded, boolean silent)

Creates a default size of engine using the best available sizing algorithm.

Parameters
maxDepth:int

the max object graph that will be traversed.

abortWhenMaxDepthExceeded:boolean

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

silent:boolean

true if no info log explaining which agent was chosen should be printed

DefaultSizeOfEngineback to summary
private DefaultSizeOfEngine(DefaultSizeOfEngine defaultSizeOfEngine, int maxDepth, boolean abortWhenMaxDepthExceeded)

Method Detail

copyWithback to summary
public SizeOfEngine copyWith(int maxDepth, boolean abortWhenMaxDepthExceeded)

Implements net.sf.ehcache.pool.SizeOfEngine.copyWith.

Doc from net.sf.ehcache.pool.SizeOfEngine.copyWith.

Make a copy of the SizeOf engine, preserving all of its internal state but overriding the specified parameters

Parameters
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:SizeOfEngine

a copy of the SizeOf engine using the specified parameters

getUserFilterback to summary
private static SizeOfFilter getUserFilter()
getVerboseSizeOfDebugLoggingback to summary
private static boolean getVerboseSizeOfDebugLogging()
sizeOfback to summary
public Size sizeOf(final Object key, final Object value, final Object container)

Implements net.sf.ehcache.pool.SizeOfEngine.sizeOf.

Doc from net.sf.ehcache.pool.SizeOfEngine.sizeOf.

Size an element

Parameters
key:Object

the key of the element

value:Object

the value of the element

container:Object

the container of the element, ie: element object + eventual overhead

Returns:Size

the size of the element in bytes