Top Description Fields Constructors Methods
net.sf.ehcache.pool.sizeof

public Class AgentSizeOf

extends SizeOf
Class Inheritance
Imports
net.sf.ehcache.pool.sizeof.filter.PassThroughFilter, .SizeOfFilter

SizeOf implementation that relies on a Java agent to be loaded to do the measurement It will try to load the agent through the JDK6 Attach API if available All it's constructor do throw UnsupportedOperationException if the agent isn't present or couldn't be loaded dynamically
Authors
Chris Dennis, Alex Snaps

Field Summary

Modifier and TypeField and Description
private static final boolean
public static final String
BYPASS_LOADING

System property name to bypass attaching to the VM and loading of Java agent to measure Object sizes.

Constructor Summary

AccessConstructor and Description
public
AgentSizeOf()

Builds a new SizeOf that will not filter fields and will cache reflected fields

public
AgentSizeOf(SizeOfFilter
The filter to apply
filter
)

Builds a new SizeOf that will filter fields according to the provided filter and will cache reflected fields

public
AgentSizeOf(SizeOfFilter
The filter to apply
filter
,
boolean
whether to cache reflected fields
caching
)

Builds a new SizeOf that will filter fields according to the provided filter

Method Summary

Modifier and TypeMethod and Description
public long
sizeOf(Object
the object to measure the size of
obj
)

Implements abstract net.sf.ehcache.pool.sizeof.SizeOf.sizeOf.

Calculates the size in memory (heap) of the instance passed in, not navigating the down graph
Inherited from net.sf.ehcache.pool.sizeof.SizeOf:
deepSizeOf

Field Detail

AGENT_LOADEDback to summary
private static final boolean AGENT_LOADED
BYPASS_LOADINGback to summary
public static final String BYPASS_LOADING

System property name to bypass attaching to the VM and loading of Java agent to measure Object sizes.

Constructor Detail

AgentSizeOfback to summary
public AgentSizeOf() throws UnsupportedOperationException

Builds a new SizeOf that will not filter fields and will cache reflected fields

Exceptions
UnsupportedOperationException:
If agent couldn't be loaded or isn't present
See Also
AgentSizeOf(net.sf.ehcache.pool.sizeof.filter.SizeOfFilter, boolean)
AgentSizeOfback to summary
public AgentSizeOf(SizeOfFilter filter) throws UnsupportedOperationException

Builds a new SizeOf that will filter fields according to the provided filter and will cache reflected fields

Parameters
filter:SizeOfFilter

The filter to apply

Exceptions
UnsupportedOperationException:
If agent couldn't be loaded or isn't present
See Also
AgentSizeOf(net.sf.ehcache.pool.sizeof.filter.SizeOfFilter, boolean), SizeOfFilter
AgentSizeOfback to summary
public AgentSizeOf(SizeOfFilter filter, boolean caching) throws UnsupportedOperationException

Builds a new SizeOf that will filter fields according to the provided filter

Parameters
filter:SizeOfFilter

The filter to apply

caching:boolean

whether to cache reflected fields

Exceptions
UnsupportedOperationException:
If agent couldn't be loaded or isn't present
See Also
SizeOfFilter

Method Detail

sizeOfback to summary
public long sizeOf(Object obj)

Implements abstract net.sf.ehcache.pool.sizeof.SizeOf.sizeOf.

Doc from net.sf.ehcache.pool.sizeof.SizeOf.sizeOf.

Calculates the size in memory (heap) of the instance passed in, not navigating the down graph

Parameters
obj:Object

the object to measure the size of

Returns:long

the object size in memory in bytes

Annotations
@Override