Package org.ehcache.sizeof.impl
Class AgentSizeOf
java.lang.Object
org.ehcache.sizeof.SizeOf
org.ehcache.sizeof.impl.AgentSizeOf
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
Inspired by Dr. Heinz Kabutz's Java Specialist Newsletter Issue #142
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final boolean
static final String
System property name to bypass attaching to the VM and loading of Java agent to measure Object sizes. -
Constructor Summary
ConstructorsConstructorDescriptionBuilds a new SizeOf that will not filter fields and will cache reflected fieldsAgentSizeOf
(SizeOfFilter filter) Builds a new SizeOf that will filter fields according to the provided filter and will cache reflected fieldsAgentSizeOf
(SizeOfFilter filter, boolean caching, boolean bypassFlyweight) Builds a new SizeOf that will filter fields according to the provided filter -
Method Summary
Methods inherited from class org.ehcache.sizeof.SizeOf
deepSizeOf, deepSizeOf, newInstance, newInstance
-
Field Details
-
BYPASS_LOADING
System property name to bypass attaching to the VM and loading of Java agent to measure Object sizes.- See Also:
-
AGENT_LOADED
private static final boolean AGENT_LOADED
-
-
Constructor Details
-
AgentSizeOf
Builds a new SizeOf that will not filter fields and will cache reflected fields- Throws:
UnsupportedOperationException
- If agent couldn't be loaded or isn't present- See Also:
-
AgentSizeOf
Builds a new SizeOf that will filter fields according to the provided filter and will cache reflected fields- Parameters:
filter
- The filter to apply- Throws:
UnsupportedOperationException
- If agent couldn't be loaded or isn't present- See Also:
-
AgentSizeOf
public AgentSizeOf(SizeOfFilter filter, boolean caching, boolean bypassFlyweight) throws UnsupportedOperationException Builds a new SizeOf that will filter fields according to the provided filter- Parameters:
filter
- The filter to applycaching
- whether to cache reflected fieldsbypassFlyweight
- whether "Flyweight Objects" are to be ignored- Throws:
UnsupportedOperationException
- If agent couldn't be loaded or isn't present- See Also:
-
-
Method Details