chemaxon.marvin.plugin.concurrent
Class ReusablePluginWorkUnit

java.lang.Object
  extended by chemaxon.marvin.plugin.concurrent.PluginWorkUnit
      extended by chemaxon.marvin.plugin.concurrent.ReusablePluginWorkUnit
All Implemented Interfaces:
WorkUnit, java.util.concurrent.Callable

public class ReusablePluginWorkUnit
extends PluginWorkUnit

Work unit performing plugin calculation. The input is a {plugin object, input molecule} array, the plugin is supposed to be coming from a ReusableInputProducer and returned by getResult(). The calculation result should be fetched from the plugin later in the application and returned to the input producer by calling ReusableInputProducer.reuse(java.lang.Object). You can use a CompositeInputProducer composed of a ReusableInputProducer and a MolInputProducer to provide the input for this work unit.

Since:
Marvin 5.0
Author:
Nora Mate
See Also:
MolInputProducer, ReusableInputProducer, CompositeInputProducer

Field Summary
 
Fields inherited from class chemaxon.marvin.plugin.concurrent.PluginWorkUnit
plugin, target
 
Constructor Summary
ReusablePluginWorkUnit()
          Constructor.
 
Method Summary
 java.lang.Object call()
          Performs the calculation and returns the result returned by getResult().
 java.lang.Object getResult()
          Returns the plugin object itself.
 java.lang.Exception getWrapperException(java.lang.Exception e)
          Returns a wrapper exception to be returned.
 void setInput(java.lang.Object obj)
          Sets the plugin object and the input molecule.
 
Methods inherited from class chemaxon.marvin.plugin.concurrent.PluginWorkUnit
getHeader, setPlugin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReusablePluginWorkUnit

public ReusablePluginWorkUnit()
Constructor.

Method Detail

setInput

public void setInput(java.lang.Object obj)
              throws java.util.concurrent.ExecutionException
Sets the plugin object and the input molecule.

Specified by:
setInput in interface WorkUnit
Overrides:
setInput in class PluginWorkUnit
Parameters:
obj - a {plugin object, input molecule} object array
Throws:
java.util.concurrent.ExecutionException

call

public java.lang.Object call()
                      throws java.lang.Exception
Performs the calculation and returns the result returned by getResult().

Specified by:
call in interface java.util.concurrent.Callable
Overrides:
call in class PluginWorkUnit
Returns:
the calculation result or exception object on error
Throws:
java.lang.Exception

getResult

public java.lang.Object getResult()
                           throws java.lang.Exception
Returns the plugin object itself. The calculation result should be fetched from the plugin later in the application and returned to the input producer by calling ReusableInputProducer.reuse(java.lang.Object).

Specified by:
getResult in class PluginWorkUnit
Returns:
the plugin object
Throws:
java.lang.Exception

getWrapperException

public java.lang.Exception getWrapperException(java.lang.Exception e)
Returns a wrapper exception to be returned.

Overrides:
getWrapperException in class PluginWorkUnit
Parameters:
e - the base exception
Returns:
the wrapper exception