org.apache.flume.lifecycle
Interface LifecycleAware

All Known Subinterfaces:
Channel, EventDrivenSource, LoadBalancingSinkProcessor.SinkSelector, PollableSource, Sink, SinkProcessor, Source
All Known Implementing Classes:
AbstractChannel, AbstractEventDrivenSource, AbstractPollableSource, AbstractRpcSink, AbstractSink, AbstractSinkProcessor, AbstractSinkSelector, AbstractSource, AsyncHBaseSink, AvroLegacySource, AvroSink, AvroSource, BasicChannelSemantics, BasicSourceSemantics, DatasetSink, DefaultSinkProcessor, ElasticSearchSink, EmbeddedSource, EventDrivenSourceRunner, ExecSource, FailoverSinkProcessor, FileChannel, HBaseSink, HDFSEventSink, HiveSink, HTTPSource, IRCSink, JdbcChannel, JMSSource, KafkaChannel, KafkaSink, KafkaSource, LifecycleSupervisor, LoadBalancingSinkProcessor, LoggerSink, MemoryChannel, MorphlineSink, MorphlineSolrSink, MultiportSyslogTCPSource, NetcatSource, NullSink, PollableSourceRunner, PollingPropertiesFileConfigurationProvider, PollingZooKeeperConfigurationProvider, PseudoTxnMemoryChannel, RollingFileSink, ScribeSource, SequenceGeneratorSource, SinkRunner, SourceRunner, SpillableMemoryChannel, SpoolDirectorySource, StressSource, SyslogTcpSource, SyslogUDPSource, ThriftLegacySource, ThriftSink, ThriftSource, TwitterSource

@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-2015 Apache Software Foundation. All Rights Reserved.