org.springframework.scheduling.support
Class MethodInvokingRunnable
java.lang.Object
org.springframework.util.MethodInvoker
org.springframework.beans.support.ArgumentConvertingMethodInvoker
org.springframework.scheduling.support.MethodInvokingRunnable
- All Implemented Interfaces:
- Runnable, InitializingBean
- Direct Known Subclasses:
- MethodInvokingTimerTaskFactoryBean
public class MethodInvokingRunnable
- extends ArgumentConvertingMethodInvoker
- implements Runnable, InitializingBean
Adapter that implements the Runnable interface as a configurable
method invocation based on Spring's MethodInvoker.
Derives from ArgumentConvertingMethodInvoker, inheriting common
configuration properties from MethodInvoker.
Useful to generically encapsulate a method invocation as timer task for
java.util.Timer
, in combination with a DelegatingTimerTask adapter.
Can also be used with JDK 1.5's java.util.concurrent.Executor
abstraction, which works with plain Runnables.
Extended by Spring's MethodInvokingTimerTaskFactoryBean adapter
for java.util.TimerTask
. Note that you can populate a
ScheduledTimerTask object with a plain MethodInvokingRunnable instance
as well, which will automatically get wrapped with a DelegatingTimerTask.
- Since:
- 1.2.4
- Author:
- Juergen Hoeller
- See Also:
MethodInvoker
,
ArgumentConvertingMethodInvoker
,
DelegatingTimerTask
,
ScheduledTimerTask.setRunnable(java.lang.Runnable)
,
MethodInvokingTimerTaskFactoryBean
,
Timer
,
Executor
Methods inherited from class org.springframework.util.MethodInvoker |
getArguments, getPreparedMethod, getTargetClass, getTargetMethod, getTargetObject, invoke, prepare, setArguments, setStaticMethod, setTargetClass, setTargetMethod, setTargetObject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final Log logger
MethodInvokingRunnable
public MethodInvokingRunnable()
afterPropertiesSet
public void afterPropertiesSet()
throws ClassNotFoundException,
NoSuchMethodException
- Description copied from interface:
InitializingBean
- Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
This method allows the bean instance to perform initialization only
possible when all bean properties have been set and to throw an
exception in the event of misconfiguration.
- Specified by:
afterPropertiesSet
in interface InitializingBean
- Throws:
ClassNotFoundException
NoSuchMethodException
run
public void run()
- Specified by:
run
in interface Runnable
getInvocationFailureMessage
protected String getInvocationFailureMessage()
Copyright (c) 2002-2007 The Spring Framework Project.