com.jrockit.memleak.mlp
Class InfoCachingFactory

java.lang.Object
  extended by com.jrockit.memleak.util.DelegatingValueFactory
      extended by com.jrockit.memleak.mlp.InfoCachingFactory
All Implemented Interfaces:
IMemleakValueFactory, IInfoCacheControl
Direct Known Subclasses:
NameMappingCacheFactory

public class InfoCachingFactory
extends DelegatingValueFactory
implements IInfoCacheControl

Author:
mpersson

Field Summary
 
Fields inherited from class com.jrockit.memleak.util.DelegatingValueFactory
delegate
 
Constructor Summary
InfoCachingFactory(IMemleakValueFactory delegate)
          Create a factory delegating everything to delegate, but caching created IObjectInfos and IClassInfos.
 
Method Summary
 void clearAll()
          Clear everything
 void clearClasses(int... classIDs)
           
 void clearObjects(int... objectIDs)
           
 IArrayInfo createArrayInfo(int objectID, IClassInfo classInfo, int length)
          Create an IArrayInfo value object.
 IClassInfo createClassInfo(int classID, java.lang.String name, int modifiers, int numDeclaredStaticFields, int numInstanceFields, java.lang.String srcFileName, IObjectSpecifier classLoaderSpec)
          Create IClassInfo value object.
 IObjectInfo createObjectInfo(int objectID, IClassInfo classInfo)
          Create a IObjectInfo value object.
 ITypeHeapInfo<IClassInfo> createTypeHeapInfo(IClassInfo classInfo, int numInstances, long size, float growthRate, long creationMillis)
          Create ITypeHeapInfo value object.
 IClassInfo getClassInfo(int classID)
           
 IClassRef getClassRef(int classID)
           
 ITypeHeapInfo<IClassInfo> getLastTypeHeapInfo(IClassInfo classInfo)
           
 IObjectInfo getObjectInfo(int objectID)
           
 IObjectInfo getObjectInfo(IObjectSpecifier objectSpec)
           
 IObjectSpecifier getObjectSpec(int objectID)
           
 boolean markDiscarded(IObjectInfo objectInfo)
          Mark the given objectInfo as discarded, if possible and if (it is likely that) the objectInfo was created by this factory.
 
Methods inherited from class com.jrockit.memleak.util.DelegatingValueFactory
createArraySizeInfo, createFieldInfo, createHeapHistogram, createInstanceReferrers, createLocation, createMethodInfo, createPointToTypeInfo, createPrimitiveFieldValue, createPrimitiveValue, createReferenceFieldValue, createReferenceValue, createRelationshipInfo, createStaticField, createThreadRoot, createTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InfoCachingFactory

public InfoCachingFactory(IMemleakValueFactory delegate)
Create a factory delegating everything to delegate, but caching created IObjectInfos and IClassInfos.

Parameters:
delegate -
Method Detail

createArrayInfo

public IArrayInfo createArrayInfo(int objectID,
                                  IClassInfo classInfo,
                                  int length)
Description copied from interface: IMemleakValueFactory
Create an IArrayInfo value object.

IClassInfo.isArrayClass() for classInfo must be true, or IllegalArgumentException will be thrown.

Note that if length is unknown (-1), IMemleakValueFactory.createObjectInfo(int, IClassInfo) may be called instead.

Specified by:
createArrayInfo in interface IMemleakValueFactory
Overrides:
createArrayInfo in class DelegatingValueFactory
Returns:
IArrayInfo
See Also:
IMemleakValueFactory.createObjectInfo(int, IClassInfo)

getObjectSpec

public IObjectSpecifier getObjectSpec(int objectID)
Specified by:
getObjectSpec in interface IInfoCacheControl
Returns:
an IObjectSpecifier corresponding to objectID, never null, unless objectID is OBJECT_ID_NULL.

getObjectInfo

public IObjectInfo getObjectInfo(IObjectSpecifier objectSpec)
Specified by:
getObjectInfo in interface IInfoCacheControl
Returns:
the IObjectInfo corresponding to objectSpec, or null.

getObjectInfo

public IObjectInfo getObjectInfo(int objectID)
Specified by:
getObjectInfo in interface IInfoCacheControl
Returns:
the IObjectInfo corresponding to objectID, or null.

createObjectInfo

public IObjectInfo createObjectInfo(int objectID,
                                    IClassInfo classInfo)
Description copied from interface: IMemleakValueFactory
Create a IObjectInfo value object.

If IClassInfo.isArrayClass() for classInfo is true, an IArrayInfo must be returned, with the length set to the uninitialized value -1. The instance should preferably also implement IModifyOnce.

Specified by:
createObjectInfo in interface IMemleakValueFactory
Overrides:
createObjectInfo in class DelegatingValueFactory
Returns:
IObjectInfo

clearObjects

public void clearObjects(int... objectIDs)
Specified by:
clearObjects in interface IInfoCacheControl

getClassRef

public IClassRef getClassRef(int classID)
Specified by:
getClassRef in interface IInfoCacheControl
Returns:
an IClassRef corresponding to classID, never null, unless classID is OBJECT_ID_NULL, maybe.

getClassInfo

public IClassInfo getClassInfo(int classID)
Specified by:
getClassInfo in interface IInfoCacheControl
Returns:
the IClassInfo corresponding to classID, or null.

createClassInfo

public IClassInfo createClassInfo(int classID,
                                  java.lang.String name,
                                  int modifiers,
                                  int numDeclaredStaticFields,
                                  int numInstanceFields,
                                  java.lang.String srcFileName,
                                  IObjectSpecifier classLoaderSpec)
Description copied from interface: IMemleakValueFactory
Create IClassInfo value object.

Specified by:
createClassInfo in interface IMemleakValueFactory
Overrides:
createClassInfo in class DelegatingValueFactory
classLoaderSpec - or null if unknown
Returns:
IClassInfo

clearClasses

public void clearClasses(int... classIDs)
Specified by:
clearClasses in interface IInfoCacheControl

clearAll

public void clearAll()
Description copied from interface: IInfoCacheControl
Clear everything

Specified by:
clearAll in interface IInfoCacheControl

createTypeHeapInfo

public ITypeHeapInfo<IClassInfo> createTypeHeapInfo(IClassInfo classInfo,
                                                    int numInstances,
                                                    long size,
                                                    float growthRate,
                                                    long creationMillis)
Description copied from interface: IMemleakValueFactory
Create ITypeHeapInfo value object.

Specified by:
createTypeHeapInfo in interface IMemleakValueFactory
Overrides:
createTypeHeapInfo in class DelegatingValueFactory
Returns:
ITypeHeapInfo

getLastTypeHeapInfo

public ITypeHeapInfo<IClassInfo> getLastTypeHeapInfo(IClassInfo classInfo)
Specified by:
getLastTypeHeapInfo in interface IInfoCacheControl
Returns:
the last created ITypeHeapInfo for classInfo, or null.

markDiscarded

public boolean markDiscarded(IObjectInfo objectInfo)
Description copied from interface: IMemleakValueFactory
Mark the given objectInfo as discarded, if possible and if (it is likely that) the objectInfo was created by this factory. This method is here and not in IObjectInfo in order to require access to the factory.

Specified by:
markDiscarded in interface IMemleakValueFactory
Overrides:
markDiscarded in class DelegatingValueFactory
Returns:
true if the state changed


Copyright © 1999, 2011, Oracle and/or its affiliates. All rights reserved.