"

2013 FRC Java API

"

com.sun.squawk
Class CallbackManager

java.lang.Object
  extended by com.sun.squawk.CallbackManager

public final class CallbackManager
extends Object

Class that manages callbacks for occasional events, which might be notified by isolate's other than the one that regsistered the callback objects. This class manages executing callbacks in the context of the isolate that registered the callback.


Constructor Summary
CallbackManager(boolean runOnce)
          Creates a new instance of CallbackManager
 
Method Summary
 void add(Isolate iso, Runnable hook)
          Add a hook to run in isolate iso.
 void add(Runnable hook)
          Add a hook to run in the current isolate's context.
 boolean containsOtherIsolates()
          If this CallbackManager contains any callbacks to be run in a context other than the current context, return true.
 boolean isRunOnce()
          Should only be run once, like for a shutdown hook.
 boolean remove(Isolate iso)
          Remove all hooks previously-registered for the given isolate.
 boolean remove(Isolate iso, Runnable hook)
          Remove a hook previously-registered for the isolate iso.
 boolean remove(Runnable hook)
          Remove a hook previously-registered for the current isolate.
 void removeAll()
          Remove all hooks.
 void runHooks()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallbackManager

public CallbackManager(boolean runOnce)
Creates a new instance of CallbackManager

Parameters:
runOnce - if true clean up agressively while executing run()
Method Detail

isRunOnce

public boolean isRunOnce()
Should only be run once, like for a shutdown hook.

Returns:
true if this callback should be

add

public void add(Isolate iso,
                Runnable hook)
Add a hook to run in isolate iso.

Parameters:
iso - the isolate context in which to run hook
hook - the Runnable to run
Throws:
IllegalArgumentException - if the hook is already registered to run in this isolate.

add

public void add(Runnable hook)
Add a hook to run in the current isolate's context.

Parameters:
hook -
Throws:
IllegalArgumentException - if the hook is already registered to run in this isolate.

remove

public boolean remove(Isolate iso,
                      Runnable hook)
Remove a hook previously-registered for the isolate iso. Like the add method, this method does not do any security checks.

Parameters:
iso - the isolate context to search
hook - the hook to search for
Returns:
true if hook was registered in the iso context.

remove

public boolean remove(Runnable hook)
Remove a hook previously-registered for the current isolate. Like the add method, this method does not do any security checks.

Parameters:
hook - the hook to search for
Returns:
true if hook was registered in the iso context.

remove

public boolean remove(Isolate iso)
Remove all hooks previously-registered for the given isolate.

Parameters:
iso - the isolate context to search
Returns:
true if any hooks were registered in the iso context.

removeAll

public void removeAll()
Remove all hooks.


runHooks

public void runHooks()

containsOtherIsolates

public boolean containsOtherIsolates()
If this CallbackManager contains any callbacks to be run in a context other than the current context, return true.

Returns:
true if contains cross-isolate callback.

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"