jklustor-overlap-0.0.2-20140619012940 (ChemAxon)


com.chemaxon.overlap.concurrent
Class BatchedPagedProcessor

Object
  extended by com.chemaxon.overlap.concurrent.BatchedPagedProcessor

public final class BatchedPagedProcessor
extends Object

Lightweight wrapper to provide batched paged processing.

Licensing: this class can be used with valid LicenseGlobals.OVERLAP license.

Author:
Gabor Imre

Method Summary
static
<S,T> void
process(int pagesize, int maxQueueSize, com.chemaxon.calculations.common.SubProgressObserver po, ExecutorService ex, Iterator<S> source, Function<S,T> process, ErrorHandler<S> error, ResultHandler<S,T> target)
          Launch a long running process.
static
<S,T> void
processManaged(MBeanServer mbs, ObjectName on, int pagesize, int maxQueueSize, com.chemaxon.calculations.common.SubProgressObserver po, ListeningExecutorService ex, Iterator<S> source, Function<S,T> process, ErrorHandler<S> error, ResultHandler<S,T> target)
          Launch a managed long running process.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

processManaged

public static <S,T> void processManaged(MBeanServer mbs,
                                        ObjectName on,
                                        int pagesize,
                                        int maxQueueSize,
                                        com.chemaxon.calculations.common.SubProgressObserver po,
                                        ListeningExecutorService ex,
                                        Iterator<S> source,
                                        Function<S,T> process,
                                        ErrorHandler<S> error,
                                        ResultHandler<S,T> target)
                           throws InstanceAlreadyExistsException,
                                  MBeanRegistrationException,
                                  NotCompliantMBeanException
Launch a managed long running process.

This method blocks until done or cancelled through the supplied ProgressObserver. Note that management through JMX might use thread interruption for signalling

Type Parameters:
S - Source type
T - Target type
Parameters:
pagesize - Number of sources to bundle
maxQueueSize - Max queue size.
po - Progress observer to track execution. Method SubProgressObserver.done() will be invoked before returning
ex - ListeningExecutorService to use. Note that using MoreExecutors.sameThreadExecutor() results in sequentially consistent master thread execution. Use MoreExecutors.listeningDecorator(java.util.concurrent.ExecutorService) to acqire a ListeningExecutorService from an ExecutorService.
source - Inputs to process
process - Function to apply on each input
error - Handler for errors
target - Handler for results
Throws:
chemaxon.license.LicenseException - when appropriate license is not available
InstanceAlreadyExistsException
MBeanRegistrationException
NotCompliantMBeanException

process

public static <S,T> void process(int pagesize,
                                 int maxQueueSize,
                                 com.chemaxon.calculations.common.SubProgressObserver po,
                                 ExecutorService ex,
                                 Iterator<S> source,
                                 Function<S,T> process,
                                 ErrorHandler<S> error,
                                 ResultHandler<S,T> target)
Launch a long running process.

Type Parameters:
S - Source type
T - Target type
Parameters:
pagesize - Number of sources to bundle
maxQueueSize - Max queue size.
po - Progress observer to track execution. Method SubProgressObserver.done() will be invoked before returning
ex - ExecutorService to use. Note that using MoreExecutors.sameThreadExecutor() results in sequentially consistent master thread execution
source - Inputs to process
process - Function to apply on each input
error - Handler for errors
target - Handler for results
Throws:
chemaxon.license.LicenseException - when appropriate license is not available

jklustor-overlap-0.0.2-20140619012940 (ChemAxon)