org.springframework.scheduling.support
Class DelegatingExceptionProofRunnable

java.lang.Object
  extended by org.springframework.scheduling.support.DelegatingExceptionProofRunnable
All Implemented Interfaces:
java.lang.Runnable

public class DelegatingExceptionProofRunnable
extends java.lang.Object
implements java.lang.Runnable

Runnable wrapper that catches any exception or error thrown from its delegate Runnable. Used for continuing scheduled execution even after an exception thrown from a task's Runnable.

Since:
2.0.5
Author:
Juergen Hoeller

Constructor Summary
DelegatingExceptionProofRunnable(java.lang.Runnable delegate)
          Create a new DelegatingExceptionProofRunnable that logs the exception but isn't propagating it (in order to continue scheduled execution).
DelegatingExceptionProofRunnable(java.lang.Runnable delegate, boolean propagateException)
          Create a new DelegatingExceptionProofRunnable.
 
Method Summary
 java.lang.Runnable getDelegate()
          Return the wrapped Runnable implementation.
 void run()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DelegatingExceptionProofRunnable

public DelegatingExceptionProofRunnable(java.lang.Runnable delegate)
Create a new DelegatingExceptionProofRunnable that logs the exception but isn't propagating it (in order to continue scheduled execution).

Parameters:
delegate - the Runnable implementation to delegate to

DelegatingExceptionProofRunnable

public DelegatingExceptionProofRunnable(java.lang.Runnable delegate,
                                        boolean propagateException)
Create a new DelegatingExceptionProofRunnable.

Parameters:
delegate - the Runnable implementation to delegate to
propagateException - whether to propagate the exception after logging (note: this will typically cancel scheduled execution of the runnable)
Method Detail

getDelegate

public final java.lang.Runnable getDelegate()
Return the wrapped Runnable implementation.


run

public void run()
Specified by:
run in interface java.lang.Runnable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object