Class ReusablePluginWorkUnit

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

@PublicAPI 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
See Also:
  • Constructor Details

    • ReusablePluginWorkUnit

      public ReusablePluginWorkUnit()
      Constructor.
  • Method Details

    • setInput

      public void setInput(Object obj) throws ExecutionException
      Sets the plugin object and the input molecule.
      Specified by:
      setInput in interface chemaxon.util.concurrent.WorkUnit
      Overrides:
      setInput in class PluginWorkUnit
      Parameters:
      obj - a {plugin object, input molecule} object array
      Throws:
      ExecutionException
    • call

      public Object call() throws Exception
      Performs the calculation and returns the result returned by getResult().
      Specified by:
      call in interface Callable
      Overrides:
      call in class PluginWorkUnit
      Returns:
      the calculation result or exception object on error
      Throws:
      Exception
    • getResult

      public Object getResult() throws 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:
      Exception
    • getWrapperException

      public Exception getWrapperException(Exception e)
      Returns a wrapper exception to be returned.
      Overrides:
      getWrapperException in class PluginWorkUnit
      Parameters:
      e - the base exception
      Returns:
      the wrapper exception