org.apache.camel.impl
Class ServiceSupport

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
All Implemented Interfaces:
Service
Direct Known Subclasses:
BatchProcessor, BeanProcessor, ChoiceProcessor, CompositeProcessor, ConsumerCache, DefaultCamelContext, DefaultChannel, DefaultComponent, DefaultConsumer, DefaultInstrumentationAgent, DefaultProducer, DefaultProducerTemplate, DefaultServicePool, DelegateProcessor, Enricher, ErrorHandlerSupport, IdempotentConsumer, LoadBalancerSupport, MainSupport, MulticastProcessor, OnCompletionProcessor, PollEnricher, PollingConsumerSupport, ProducerCache, RecipientList, RouteService, RoutingSlip, SedaConsumer, SendProcessor, StreamResequencer, TryProcessor

public abstract class ServiceSupport
extends Object
implements Service

A useful base class which ensures that a service is only initialized once and provides some helper methods for enquiring of its status

Version:
$Revision: 772276 $

Constructor Summary
ServiceSupport()
           
 
Method Summary
protected  void addChildService(Object childService)
           
protected abstract  void doStart()
           
protected abstract  void doStop()
           
 ServiceStatus getStatus()
          Returns the current status
 String getVersion()
          Returns the version of this service
protected  boolean isRunAllowed()
          Helper methods so the service knows if it should keep running.
 boolean isStarted()
           
 boolean isStarting()
           
 boolean isStopped()
           
 boolean isStopping()
           
protected  boolean removeChildService(Object childService)
           
 void start()
          Starts the service
 void stop()
          Stops the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceSupport

public ServiceSupport()
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Service
Starts the service

Specified by:
start in interface Service
Throws:
Exception

stop

public void stop()
          throws Exception
Description copied from interface: Service
Stops the service

Specified by:
stop in interface Service
Throws:
Exception

getStatus

public ServiceStatus getStatus()
Returns the current status


isStarted

public boolean isStarted()
Returns:
true if this service has been started

isStarting

public boolean isStarting()
Returns:
true if this service is

isStopping

public boolean isStopping()
Returns:
true if this service is in the process of closing

isStopped

public boolean isStopped()
Returns:
true if this service is closed

isRunAllowed

protected boolean isRunAllowed()
Helper methods so the service knows if it should keep running. Returns false if the service is being stopped or is stopped.

Returns:
true if the service should continue to run.

doStart

protected abstract void doStart()
                         throws Exception
Throws:
Exception

doStop

protected abstract void doStop()
                        throws Exception
Throws:
Exception

addChildService

protected void addChildService(Object childService)

removeChildService

protected boolean removeChildService(Object childService)

getVersion

public String getVersion()
Returns the version of this service



Apache CAMEL