Package org.jboss.netty.util
Class DefaultObjectSizeEstimator
- java.lang.Object
-
- org.jboss.netty.util.DefaultObjectSizeEstimator
-
- All Implemented Interfaces:
ObjectSizeEstimator
- Direct Known Subclasses:
AbstractTrafficShapingHandler.SimpleObjectSizeEstimator
public class DefaultObjectSizeEstimator extends java.lang.Object implements ObjectSizeEstimator
The defaultObjectSizeEstimator
implementation for general purpose.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.ConcurrentMap<java.lang.Class<?>,java.lang.Integer>
class2size
-
Constructor Summary
Constructors Constructor Description DefaultObjectSizeEstimator()
Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
align(int size)
private int
estimateSize(java.lang.Class<?> clazz, java.util.Set<java.lang.Class<?>> visitedClasses)
int
estimateSize(java.lang.Object o)
Returns the estimated size of the specified object in bytes.
-
-
-
Method Detail
-
estimateSize
public int estimateSize(java.lang.Object o)
Description copied from interface:ObjectSizeEstimator
Returns the estimated size of the specified object in bytes.- Specified by:
estimateSize
in interfaceObjectSizeEstimator
- Returns:
- a positive integer which represents the size of the specified object in bytes
-
estimateSize
private int estimateSize(java.lang.Class<?> clazz, java.util.Set<java.lang.Class<?>> visitedClasses)
-
align
private static int align(int size)
-
-