org.compass.core.executor
Class DefaultExecutorManager

java.lang.Object
  extended by org.compass.core.executor.DefaultExecutorManager
All Implemented Interfaces:
CompassConfigurable, ExecutorManager, InternalExecutorManager

public class DefaultExecutorManager
extends Object
implements ExecutorManager, CompassConfigurable

The "default" implementation of an executor manager. Simply delegates operations to an internal executor manager created based on CompassEnvironment.ExecutorManager settings.

Author:
kimchy

Constructor Summary
DefaultExecutorManager()
           
 
Method Summary
 void close()
          Shuts down this executor manager.
 void configure(CompassSettings settings)
          Configure using the given settings.
<T> List<Future<T>>
invokeAll(Collection<Callable<T>> tasks)
           
<T> List<Future<T>>
invokeAllWithLimit(Collection<Callable<T>> tasks, int concurrencyThreshold)
          Similar to InternalExecutorManager.invokeAll(java.util.Collection), but only uses it if the number of tasks passes the concurrent limit.
<T> List<Future<T>>
invokeAllWithLimitBailOnException(Collection<Callable<T>> tasks, int concurrencyThreshold)
          Similar to ExecutorManager.invokeAllWithLimit(java.util.Collection, int), but if one task throws an exception will propogate the exception.
<V> ScheduledFuture<V>
schedule(Callable<V> callable, long delay, TimeUnit unit)
           
 ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
           
 ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
           
<T> Future<T>
submit(Callable<T> task)
           
 void submit(Runnable task)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultExecutorManager

public DefaultExecutorManager()
Method Detail

configure

public void configure(CompassSettings settings)
               throws CompassException
Description copied from interface: CompassConfigurable
Configure using the given settings.

Specified by:
configure in interface CompassConfigurable
Parameters:
settings - The settings for the configured object
Throws:
CompassException

invokeAllWithLimitBailOnException

public <T> List<Future<T>> invokeAllWithLimitBailOnException(Collection<Callable<T>> tasks,
                                                             int concurrencyThreshold)
Description copied from interface: ExecutorManager
Similar to ExecutorManager.invokeAllWithLimit(java.util.Collection, int), but if one task throws an exception will propogate the exception.

Specified by:
invokeAllWithLimitBailOnException in interface ExecutorManager

invokeAllWithLimit

public <T> List<Future<T>> invokeAllWithLimit(Collection<Callable<T>> tasks,
                                              int concurrencyThreshold)
Description copied from interface: ExecutorManager
Similar to InternalExecutorManager.invokeAll(java.util.Collection), but only uses it if the number of tasks passes the concurrent limit.

Specified by:
invokeAllWithLimit in interface ExecutorManager

close

public void close()
Description copied from interface: InternalExecutorManager
Shuts down this executor manager.

Specified by:
close in interface InternalExecutorManager

submit

public void submit(Runnable task)
Specified by:
submit in interface InternalExecutorManager
See Also:
ExecutorService.submit(Runnable)

submit

public <T> Future<T> submit(Callable<T> task)
Specified by:
submit in interface InternalExecutorManager
See Also:
ExecutorService.submit(java.util.concurrent.Callable)

invokeAll

public <T> List<Future<T>> invokeAll(Collection<Callable<T>> tasks)
                          throws InterruptedException
Specified by:
invokeAll in interface InternalExecutorManager
Throws:
InterruptedException
See Also:
ExecutorService.invokeAll(java.util.Collection)

schedule

public <V> ScheduledFuture<V> schedule(Callable<V> callable,
                                       long delay,
                                       TimeUnit unit)
Specified by:
schedule in interface InternalExecutorManager
See Also:
ScheduledExecutorService.schedule(java.util.concurrent.Callable, long, java.util.concurrent.TimeUnit)

scheduleAtFixedRate

public ScheduledFuture<?> scheduleAtFixedRate(Runnable command,
                                              long initialDelay,
                                              long period,
                                              TimeUnit unit)
Specified by:
scheduleAtFixedRate in interface InternalExecutorManager
See Also:
ScheduledExecutorService.scheduleAtFixedRate(Runnable, long, long, java.util.concurrent.TimeUnit)

scheduleWithFixedDelay

public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command,
                                                 long initialDelay,
                                                 long delay,
                                                 TimeUnit unit)
Specified by:
scheduleWithFixedDelay in interface InternalExecutorManager
See Also:
ScheduledExecutorService.scheduleWithFixedDelay(Runnable, long, long, java.util.concurrent.TimeUnit)


Copyright (c) 2004-2008 The Compass Project.