org.scijava.module
Class ModuleRunner

java.lang.Object
  extended by org.scijava.AbstractContextual
      extended by org.scijava.module.ModuleRunner
All Implemented Interfaces:
Runnable, Callable<Module>, Contextual

public class ModuleRunner
extends AbstractContextual
implements Callable<Module>, Runnable

Helper class for executing a Module, including pre- and post-processing and event notification.

This class implements both Runnable and Callable, to make it easier to invoke in a variety of ways, such as with the java.util.concurrent package.

Author:
Curtis Rueden

Constructor Summary
ModuleRunner(Context context, Module module, List<? extends ModulePreprocessor> pre, List<? extends ModulePostprocessor> post)
           
 
Method Summary
 Module call()
           
 void postProcess()
          Feeds the module through the ModulePostprocessors.
 ModulePreprocessor preProcess()
          Feeds the module through the ModulePreprocessors.
 void run()
          Executes the module, including pre- and post-processing and event notification.
 
Methods inherited from class org.scijava.AbstractContextual
context, getContext, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleRunner

public ModuleRunner(Context context,
                    Module module,
                    List<? extends ModulePreprocessor> pre,
                    List<? extends ModulePostprocessor> post)
Method Detail

preProcess

public ModulePreprocessor preProcess()
Feeds the module through the ModulePreprocessors.

Returns:
The preprocessor that canceled the execution, or null if all preprocessors completed successfully.

postProcess

public void postProcess()
Feeds the module through the ModulePostprocessors.


call

public Module call()
Specified by:
call in interface Callable<Module>

run

public void run()
Executes the module, including pre- and post-processing and event notification.

Specified by:
run in interface Runnable


Copyright © 2009–2015 SciJava. All rights reserved.