com.jniwrapper
Class NativeResourceCollector

java.lang.Object
  extended by com.jniwrapper.NativeResourceCollector

public class NativeResourceCollector
extends java.lang.Object

Garbage collection assistant for native resources. Frees resources when their holders are about to be collected. This always happens after all finalization has been run on those classes.


Method Summary
 void addNativeResource(java.lang.Object holder, NativeResource resource)
           
 void addShutdownAction(java.lang.Runnable action)
          Adds the action that will run on shutdown of the process before collecting native resources.
static NativeResourceCollector getInstance()
           
 java.util.List getShutdownActions()
          Returns shutdown action list.
 void removeShutdownAction(java.lang.Runnable action)
          Removes the action from the shutdown action list.
 void start()
          Starts native resource collector thread.
 void stop()
          Stops native resource collector thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addShutdownAction

public void addShutdownAction(java.lang.Runnable action)
Adds the action that will run on shutdown of the process before collecting native resources.

Parameters:
action - the action to execute

removeShutdownAction

public void removeShutdownAction(java.lang.Runnable action)
Removes the action from the shutdown action list.

Parameters:
action - the action to remove

getShutdownActions

public java.util.List getShutdownActions()
Returns shutdown action list.

Returns:
shutdown action list

addNativeResource

public void addNativeResource(java.lang.Object holder,
                              NativeResource resource)

getInstance

public static NativeResourceCollector getInstance()

start

public void start()
Starts native resource collector thread.

Note. You should use this method for applets only (in Applet.start method).

See Also:
Applet.start()

stop

public void stop()
Stops native resource collector thread.

Note. You should use this method for applets only (in Applet.stop method).

See Also:
Applet.stop()