org.chwf.resources
Class ResourceManager

java.lang.Object
  |
  +--org.chwf.resources.ResourceManager

public class ResourceManager
extends java.lang.Object

A per-thread resource manager. The system must initialize this resource manager before any managed resources are used. It is released after all resource utilization is complete:

 ResourceManager.init();
 // resource utilization ...
 ResourceManager.release();
Resource manager initialization and release is the responsibility of the System, not developers. Developers should not interact with this class at all, except for testing purposes.

Author:
Paul Strack

Constructor Summary
ResourceManager()
           
 
Method Summary
static void init()
          Initialize resource management for this thread.
static boolean isInitialized()
          True if management is initialized.
static void release(java.lang.Throwable error)
          Release all managed resources, and terminate resource management for this thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceManager

public ResourceManager()
Method Detail

isInitialized

public static boolean isInitialized()
True if management is initialized.
Returns:
True if management is initialized.

init

public static void init()
                 throws ResourceInitException
Initialize resource management for this thread. Developers should not call this method except for testing.
Throws:
ResourceInitException - If called while initialized.

release

public static void release(java.lang.Throwable error)
                    throws ResourceException,
                           ResourceInitException
Release all managed resources, and terminate resource management for this thread. Developers should not call this method except for testing.
Parameters:
error - Error status for the thread of execution (null if there were no errors).
Throws:
ResourceException - If there were failures during the release operation. This is a chained exception; the full set of errors can be retrieved via ResourceException.getNextException()
ResourceInitException - If called while not initialized.


Copyright © 2002-2004, Paul Strack. All Rights Reserved.