com.sas.iom.orb
Class ResourceTracker

com.sas.iom.orb.ResourceTracker
All Implemented Interfaces:
com.sas.iom.orb.TrackedResourceInterface

public class ResourceTracker
implements com.sas.iom.orb.TrackedResourceInterface

A repository of resources that need to be shutdown all at once (eg when a container is destroyed). The ResourceTracker is itself a tracked resource so that resource trackers can be nested. The ResourceTracker must be enabled by calling enable() before it will track any resources. Some resources such as ThreadPool automatically add themselves to the ResourceTracker.


Constructor Summary
ResourceTracker()
          Construct a resource tracker.
 
Method Summary
 void enable()
          Enable a resource tracker.
static ResourceTracker getInstance()
          Get the default resource tracker.
 void shutdown(boolean waitForCompletion)
          Shutdown all tracked resources.
 void trackResource(com.sas.iom.orb.TrackedResourceInterface resource)
          Track a resource.
 void untrackResource(com.sas.iom.orb.TrackedResourceInterface resource)
          Remove a resource from the tracker.
 

Constructor Detail

ResourceTracker

public ResourceTracker()
Construct a resource tracker.

Method Detail

getInstance

public static ResourceTracker getInstance()
Get the default resource tracker.

Returns:
the default resource tracker

enable

public void enable()
Enable a resource tracker. No resources will be tracked until the tracker is enabled.


trackResource

public void trackResource(com.sas.iom.orb.TrackedResourceInterface resource)
Track a resource.

Parameters:
resource - the resource to track

untrackResource

public void untrackResource(com.sas.iom.orb.TrackedResourceInterface resource)
Remove a resource from the tracker.

Parameters:
resource - the resource to remove

shutdown

public void shutdown(boolean waitForCompletion)
Shutdown all tracked resources.

Specified by:
shutdown in interface com.sas.iom.orb.TrackedResourceInterface



Copyright © 2009 SAS Institute Inc. All Rights Reserved.