net.spy.concurrent
Class Rescheduler

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.concurrent.Rescheduler
All Implemented Interfaces:
Executor, ExecutorService, ScheduledExecutorService

public class Rescheduler
extends SpyObject
implements ScheduledExecutorService

ScheduledExecutorService wrapper that allows RetryableCallable objects to be retried upon failure. Note that while this does back an existing ScheduledExecutorService, any Callables sent directly into that service will not be eligible for retry.


Constructor Summary
Rescheduler(ScheduledExecutorService x)
          Get an instance of Rescheduler with the given backing ScheduledExecutorService.
 
Method Summary
 boolean awaitTermination(long arg0, TimeUnit arg1)
           
 void execute(Runnable arg0)
           
<T> List<Future<T>>
invokeAll(Collection<Callable<T>> callables)
           
<T> List<Future<T>>
invokeAll(Collection<Callable<T>> callables, long timeout, TimeUnit unit)
           
<T> T
invokeAny(Collection<Callable<T>> callables)
           
<T> T
invokeAny(Collection<Callable<T>> callables, long timeout, TimeUnit unit)
           
 boolean isShutdown()
           
 boolean isTerminated()
           
<T> ScheduledFuture<T>
schedule(Callable<T> c, long delay, TimeUnit unit)
          Process the given callable.
 ScheduledFuture<?> schedule(Runnable r, long delay, TimeUnit unit)
           
 ScheduledFuture<?> scheduleAtFixedRate(Runnable r, long arg1, long arg2, TimeUnit arg3)
           
 ScheduledFuture<?> scheduleWithFixedDelay(Runnable r, long arg1, long arg2, TimeUnit arg3)
           
 void shutdown()
           
 List<Runnable> shutdownNow()
           
<T> Future<T>
submit(Callable<T> c)
          Process the given callable.
 Future<?> submit(Runnable arg0)
           
<T> Future<T>
submit(Runnable arg0, T arg1)
           
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rescheduler

public Rescheduler(ScheduledExecutorService x)
Get an instance of Rescheduler with the given backing ScheduledExecutorService.

Parameters:
x - the ScheduledExecutorService that will be responsible execution
Method Detail

schedule

public ScheduledFuture<?> schedule(Runnable r,
                                   long delay,
                                   TimeUnit unit)
Specified by:
schedule in interface ScheduledExecutorService

schedule

public <T> ScheduledFuture<T> schedule(Callable<T> c,
                                       long delay,
                                       TimeUnit unit)
Process the given callable. If this is a RetryableCallable, it may be retried if execution fails.

Specified by:
schedule in interface ScheduledExecutorService

scheduleAtFixedRate

public ScheduledFuture<?> scheduleAtFixedRate(Runnable r,
                                              long arg1,
                                              long arg2,
                                              TimeUnit arg3)
Specified by:
scheduleAtFixedRate in interface ScheduledExecutorService

scheduleWithFixedDelay

public ScheduledFuture<?> scheduleWithFixedDelay(Runnable r,
                                                 long arg1,
                                                 long arg2,
                                                 TimeUnit arg3)
Specified by:
scheduleWithFixedDelay in interface ScheduledExecutorService

awaitTermination

public boolean awaitTermination(long arg0,
                                TimeUnit arg1)
                         throws InterruptedException
Specified by:
awaitTermination in interface ExecutorService
Throws:
InterruptedException

invokeAll

public <T> List<Future<T>> invokeAll(Collection<Callable<T>> callables)
                          throws InterruptedException
Specified by:
invokeAll in interface ExecutorService
Throws:
InterruptedException

invokeAll

public <T> List<Future<T>> invokeAll(Collection<Callable<T>> callables,
                                     long timeout,
                                     TimeUnit unit)
                          throws InterruptedException
Specified by:
invokeAll in interface ExecutorService
Throws:
InterruptedException

invokeAny

public <T> T invokeAny(Collection<Callable<T>> callables)
            throws InterruptedException,
                   ExecutionException
Specified by:
invokeAny in interface ExecutorService
Throws:
InterruptedException
ExecutionException

invokeAny

public <T> T invokeAny(Collection<Callable<T>> callables,
                       long timeout,
                       TimeUnit unit)
            throws InterruptedException,
                   ExecutionException,
                   TimeoutException
Specified by:
invokeAny in interface ExecutorService
Throws:
InterruptedException
ExecutionException
TimeoutException

shutdown

public void shutdown()
Specified by:
shutdown in interface ExecutorService

isShutdown

public boolean isShutdown()
Specified by:
isShutdown in interface ExecutorService

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface ExecutorService

shutdownNow

public List<Runnable> shutdownNow()
Specified by:
shutdownNow in interface ExecutorService

submit

public <T> Future<T> submit(Callable<T> c)
Process the given callable. If this is a RetryableCallable, it may be retried if execution fails.

Specified by:
submit in interface ExecutorService

submit

public Future<?> submit(Runnable arg0)
Specified by:
submit in interface ExecutorService

submit

public <T> Future<T> submit(Runnable arg0,
                            T arg1)
Specified by:
submit in interface ExecutorService

execute

public void execute(Runnable arg0)
Specified by:
execute in interface Executor


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.