org.semanticweb.elk.util.concurrent.computation
Class SimpleInterrupter

java.lang.Object
  extended by org.semanticweb.elk.util.concurrent.computation.SimpleInterrupter
All Implemented Interfaces:
Interrupter

public class SimpleInterrupter
extends Object
implements Interrupter

A simple interrupter, which just stores the flag about the interrupt status and interrupts the thread that is assigned to this interrupter

Author:
"Yevgeny Kazakov"

Constructor Summary
SimpleInterrupter()
           
 
Method Summary
 void clearInterrupt()
          Clears the interrupt status: computation is no longer interrupted
 void clearThreadToInterrupt()
          De-registers a thread to be interrupted (so that no thread is interrupted accidently)
 void interrupt()
          Requests the computation to be interrupted
 boolean isInterrupted()
          Checks if the computation was requested to be interrupted
 void registerCurrentThreadToInterrupt()
          Assign the current thread is interrupted when interrupt() is called
 void registerThreadToInterrupt(Thread toInterrupt)
          Make sure the given thread is interrupted when interrupt() is called
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleInterrupter

public SimpleInterrupter()
Method Detail

registerThreadToInterrupt

public void registerThreadToInterrupt(Thread toInterrupt)
Make sure the given thread is interrupted when interrupt() is called

Parameters:
toInterrupt - the thread which will be interrupted

registerCurrentThreadToInterrupt

public void registerCurrentThreadToInterrupt()
Assign the current thread is interrupted when interrupt() is called


clearThreadToInterrupt

public void clearThreadToInterrupt()
De-registers a thread to be interrupted (so that no thread is interrupted accidently)


interrupt

public void interrupt()
Description copied from interface: Interrupter
Requests the computation to be interrupted

Specified by:
interrupt in interface Interrupter

isInterrupted

public boolean isInterrupted()
Description copied from interface: Interrupter
Checks if the computation was requested to be interrupted

Specified by:
isInterrupted in interface Interrupter
Returns:
true if the computation was requested to be interrupted

clearInterrupt

public void clearInterrupt()
Description copied from interface: Interrupter
Clears the interrupt status: computation is no longer interrupted

Specified by:
clearInterrupt in interface Interrupter


Copyright © 2011-2013 Department of Computer Science, University of Oxford. All Rights Reserved.