net.spy.concurrent
Class Rescheduler

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

public class Rescheduler
extends SpyObject
implements java.util.concurrent.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(java.util.concurrent.ScheduledExecutorService x)
          Get an instance of Rescheduler with the given backing ScheduledExecutorService.
 
Method Summary
 boolean awaitTermination(long arg0, java.util.concurrent.TimeUnit arg1)
           
 void execute(java.lang.Runnable arg0)
           
<T> java.util.List<java.util.concurrent.Future<T>>
invokeAll(java.util.Collection<java.util.concurrent.Callable<T>> callables)
           
<T> java.util.List<java.util.concurrent.Future<T>>
invokeAll(java.util.Collection<java.util.concurrent.Callable<T>> callables, long timeout, java.util.concurrent.TimeUnit unit)
           
<T> T
invokeAny(java.util.Collection<java.util.concurrent.Callable<T>> callables)
           
<T> T
invokeAny(java.util.Collection<java.util.concurrent.Callable<T>> callables, long timeout, java.util.concurrent.TimeUnit unit)
           
 boolean isShutdown()
           
 boolean isTerminated()
           
<T> java.util.concurrent.ScheduledFuture<T>
schedule(java.util.concurrent.Callable<T> c, long delay, java.util.concurrent.TimeUnit unit)
          Process the given callable.
 java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable r, long delay, java.util.concurrent.TimeUnit unit)
           
 java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable r, long arg1, long arg2, java.util.concurrent.TimeUnit arg3)
           
 java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable r, long arg1, long arg2, java.util.concurrent.TimeUnit arg3)
           
 void shutdown()
           
 java.util.List<java.lang.Runnable> shutdownNow()
           
<T> java.util.concurrent.Future<T>
submit(java.util.concurrent.Callable<T> c)
          Process the given callable.
 java.util.concurrent.Future<?> submit(java.lang.Runnable arg0)
           
<T> java.util.concurrent.Future<T>
submit(java.lang.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(java.util.concurrent.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 java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable r,
                                                        long delay,
                                                        java.util.concurrent.TimeUnit unit)
Specified by:
schedule in interface java.util.concurrent.ScheduledExecutorService

schedule

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

Specified by:
schedule in interface java.util.concurrent.ScheduledExecutorService

scheduleAtFixedRate

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

scheduleWithFixedDelay

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

awaitTermination

public boolean awaitTermination(long arg0,
                                java.util.concurrent.TimeUnit arg1)
                         throws java.lang.InterruptedException
Specified by:
awaitTermination in interface java.util.concurrent.ExecutorService
Throws:
java.lang.InterruptedException

invokeAll

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

invokeAll

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

invokeAny

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

invokeAny

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

shutdown

public void shutdown()
Specified by:
shutdown in interface java.util.concurrent.ExecutorService

isShutdown

public boolean isShutdown()
Specified by:
isShutdown in interface java.util.concurrent.ExecutorService

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface java.util.concurrent.ExecutorService

shutdownNow

public java.util.List<java.lang.Runnable> shutdownNow()
Specified by:
shutdownNow in interface java.util.concurrent.ExecutorService

submit

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

Specified by:
submit in interface java.util.concurrent.ExecutorService

submit

public java.util.concurrent.Future<?> submit(java.lang.Runnable arg0)
Specified by:
submit in interface java.util.concurrent.ExecutorService

submit

public <T> java.util.concurrent.Future<T> submit(java.lang.Runnable arg0,
                                                 T arg1)
Specified by:
submit in interface java.util.concurrent.ExecutorService

execute

public void execute(java.lang.Runnable arg0)
Specified by:
execute in interface java.util.concurrent.Executor


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