|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@InterfaceAudience.Public @InterfaceStability.Stable public interface LifecycleAware
An interface implemented by any class that has a defined, stateful, lifecycle.
Implementations of LifecycleAware
conform to a standard method of
starting, stopping, and reporting their current state. Additionally, this
interface creates a standard method of communicating failure to perform a
lifecycle operation to the caller (i.e. via LifecycleException
). It
is never considered valid to call start()
or
stop()
more than once or to call them in the wrong order.
While this is not strictly enforced, it may be in the future.
Example services may include Flume nodes and the master, but also lower level components that can be controlled in a similar manner.
Example usage
public class MyService implements LifecycleAware {
private LifecycleState lifecycleState;
public MyService() {
lifecycleState = LifecycleState.IDLE;
}
Method Summary
LifecycleState
getLifecycleState()
Return the current state of the service or component.
void
start()
Starts a service or component.
void
stop()
Stops a service or component.
Method Detail
start
void start()
Starts a service or component.
Implementations should determine the result of any start logic and effect
the return value of getLifecycleState()
accordingly.
- Throws:
LifecycleException
InterruptedException
stop
void stop()
Stops a service or component.
Implementations should determine the result of any stop logic and effect
the return value of getLifecycleState()
accordingly.
- Throws:
LifecycleException
InterruptedException
getLifecycleState
LifecycleState getLifecycleState()
Return the current state of the service or component.
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
Copyright © 2009-2013 Apache Software Foundation. All Rights Reserved.