public class ServiceMethodAdaptor extends Object implements ServiceAdaptor
ServiceAdaptor
that uses a start and stop method.Constructor and Description |
---|
ServiceMethodAdaptor(Object component,
Method startMethod,
Method stopMethod)
Create a new instance.
|
ServiceMethodAdaptor(Object component,
Method startMethod,
Method stopMethod,
Method acceptExceptionListenerMethod)
Create a new instance with stop handle and exception listener.
|
Modifier and Type | Method and Description |
---|---|
void |
acceptExceptionListener(ExceptionListener exceptionListener)
Accept an exception listener.
|
Object |
getComponent()
Get the component being adapted.
|
void |
start() |
void |
stop()
Stop executing.
|
public ServiceMethodAdaptor(Object component, Method startMethod, Method stopMethod)
component
- startMethod
- stopMethod
- public ServiceMethodAdaptor(Object component, Method startMethod, Method stopMethod, Method acceptExceptionListenerMethod)
component
- startMethod
- stopMethod
- acceptStopHandleMethod
- acceptExceptionListenerMethod
- public void start() throws Exception
public void stop() throws FailedToStopException
Stoppable
stop
in interface Stoppable
FailedToStopException
public void acceptExceptionListener(ExceptionListener exceptionListener)
FallibleComponent
acceptExceptionListener
in interface FallibleComponent
public Object getComponent()
ComponentAdapter
getComponent
in interface ComponentAdapter