org.apache.flume.lifecycle
Interface LifecycleAware

All Known Subinterfaces:
Channel, ConfigurationProvider, EventDrivenSource, LoadBalancingSinkProcessor.SinkSelector, NodeManager, PollableSource, Sink, SinkProcessor, Source
All Known Implementing Classes:
AbstractChannel, AbstractFileConfigurationProvider, AbstractLogicalNodeManager, AbstractSink, AbstractSinkProcessor, AbstractSinkSelector, AbstractSource, AsyncHBaseSink, AvroLegacySource, AvroSink, AvroSource, BasicChannelSemantics, DefaultLogicalNodeManager, DefaultSinkProcessor, ElasticSearchSink, EventDrivenSourceRunner, ExecSource, FailoverSinkProcessor, FileChannel, FlumeNode, HBaseSink, HDFSEventSink, HTTPSource, IRCSink, JdbcChannel, LifecycleSupervisor, LoadBalancingSinkProcessor, LoggerSink, MemoryChannel, MultiportSyslogTCPSource, NetcatSource, NullSink, PollableSourceRunner, PropertiesFileConfigurationProvider, PseudoTxnMemoryChannel, RecoverableMemoryChannel, RollingFileSink, ScribeSource, SequenceGeneratorSource, SinkRunner, SourceRunner, SpoolDirectorySource, StressSource, SyslogTcpSource, SyslogUDPSource, ThriftLegacySource

@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.



Copyright © 2009-2012 Apache Software Foundation. All Rights Reserved.