Protege 3.3.1

edu.stanford.smi.protege.util
Class ExclusiveRunnable

java.lang.Object
  extended by edu.stanford.smi.protege.util.ExclusiveRunnable
All Implemented Interfaces:
Runnable

public abstract class ExclusiveRunnable
extends Object
implements Runnable

This class is a Runnable that only allows one thread to be executing at a time. It includes methods that allow a caller to wait for the execution to start or finish. This class implements its own notions of running and aborted. Is this implemented in Java Core?

Author:
tredmond

Constructor Summary
ExclusiveRunnable()
           
 
Method Summary
 void abort()
          Sets the aborted flag for the current runnable.
abstract  void execute()
          This method is where the developer implements his own execute procedure.
 boolean isAborted()
           
 void run()
          It is generally expected that the developer will not override this method.
 void waitForShutdown()
          Wait for execution to complete.
 void waitForStartup()
          Waits for the execution to start.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExclusiveRunnable

public ExclusiveRunnable()
Method Detail

execute

public abstract void execute()
This method is where the developer implements his own execute procedure.


run

public void run()
It is generally expected that the developer will not override this method. The actual code to execute should be placed in the execute() method.

Specified by:
run in interface Runnable

waitForStartup

public void waitForStartup()
Waits for the execution to start.


waitForShutdown

public void waitForShutdown()
Wait for execution to complete.


abort

public void abort()
Sets the aborted flag for the current runnable. If you don't wait for the runnable to be running then setting the aborted flag won't do what you want. It is possible to start a thread (but it isn't running yet), abort the thread (still not running) and for the thread to start running with the abort flag reset to false.


isAborted

public boolean isAborted()

Protege 3.3.1

Submit a bug report or feature request
Protégé is a trademark of Stanford University.
Copyright (c) 1998-2007 Stanford University.