org.semanticweb.elk.util.concurrent.computation
Class BaseInputProcessor<J>

java.lang.Object
  extended by org.semanticweb.elk.util.concurrent.computation.BaseInputProcessor<J>
All Implemented Interfaces:
InputProcessor<J>

public abstract class BaseInputProcessor<J>
extends Object
implements InputProcessor<J>

Implements basic job queueing and lets subclasses focus on processing single jobs

Author:
Pavel Klinov pavel.klinov@uni-ulm.de

Constructor Summary
BaseInputProcessor()
           
BaseInputProcessor(InputProcessorListenerNotifyFinishedJob<J> listener)
           
 
Method Summary
 void finish()
          Indicate that processing of the input is finished.
 void process()
          Process all currently submitted jobs.
protected abstract  void process(J job)
           
 void submit(J job)
          Submit a job to be processed by this manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseInputProcessor

public BaseInputProcessor()

BaseInputProcessor

public BaseInputProcessor(InputProcessorListenerNotifyFinishedJob<J> listener)
Method Detail

submit

public void submit(J job)
Description copied from interface: InputProcessor
Submit a job to be processed by this manager. This method can never fail or be interrupted.

Specified by:
submit in interface InputProcessor<J>
Parameters:
job - the job to be submitted

process

public void process()
             throws InterruptedException
Description copied from interface: InputProcessor
Process all currently submitted jobs. This method is intended to be executed from several threads, therefore it is not guaranteed that all jobs will be processed when the method terminates.

Specified by:
process in interface InputProcessor<J>
Throws:
InterruptedException - if interrupted during processing

finish

public void finish()
Description copied from interface: InputProcessor
Indicate that processing of the input is finished. This method should be eventually called after every call of InputProcessor.process() (but it is not necessary that every call of InputProcessor.process() should be followed by InputProcessor.finish()).

Specified by:
finish in interface InputProcessor<J>

process

protected abstract void process(J job)


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