com.esri.arcgis.system
Class Cleaner

java.lang.Object
  extended by com.esri.arcgis.system.Cleaner

public class Cleaner
extends Object

This class is used to programatically release references to arcobjects.

References are normally released when the Java object is garbage collected. However, there are times when you want to force the release.

Consider the case where your object is a proxy to a RasterDataset that you are editing. The object may not be garbage collected for some time. Until it is, the RasterDataset may hold onto any files it is writing to, and the updates might not get flushed to the file. The files might remain in use and cannot be deleted till references to the object are released.

By explicitly calling release, the RasterDataset will free the resources it was using, and do any required clean-up tasks. At some time later, the Java object will be garbage collected.


Constructor Summary
Cleaner()
           
 
Method Summary
static void release(Object anObject)
          Releases a specific reference to an arcobject.
static void releaseAll()
          Releases all outstanding references to arcobjects.
static void releaseAllInCurrentThread()
          Tells the runtime to release all objects used in the current thread since the last 'trackObjectsInCurrentThread' call.
static void trackObjectsInCurrentThread()
          Tells the runtime to remember all objects used in the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cleaner

public Cleaner()
Method Detail

releaseAll

public static void releaseAll()
Releases all outstanding references to arcobjects. This method must only be called just prior to the JVM terminating.


trackObjectsInCurrentThread

public static void trackObjectsInCurrentThread()
Tells the runtime to remember all objects used in the current thread. Garbage collection of these objects will no longer take place, since the runtime maintains a reference to them.
You must call com.esri.arcgis.system.Cleaner.releaseAllInCurrentThread to release these objects.

See Also:
Cleaner.releaseAllInCurrentThread()

releaseAllInCurrentThread

public static void releaseAllInCurrentThread()
Tells the runtime to release all objects used in the current thread since the last 'trackObjectsInCurrentThread' call.

See Also:
Cleaner.trackObjectsInCurrentThread()

release

public static void release(Object anObject)
Releases a specific reference to an arcobject.

Parameters:
anObject - the object to be released
Throws:
IllegalArgumentException - if the object that is passed is not a reference to an arcobject.