org.apache.activemq.apollo.util
Class ServiceSupport

java.lang.Object
  extended by org.apache.activemq.apollo.util.ServiceSupport
All Implemented Interfaces:
Service

public abstract class ServiceSupport
extends java.lang.Object
implements Service

A helper class for working with services together with a useful base class for service implementations.

Version:
$Revision: 1.1 $

Constructor Summary
ServiceSupport()
           
 
Method Summary
 void addServiceListener(ServiceListener l)
           
static void dispose(Service service)
           
protected abstract  void doStart()
           
protected abstract  void doStop(ServiceStopper stopper)
           
 boolean isStarted()
           
 boolean isStopped()
           
 boolean isStopping()
           
 void removeServiceListener(ServiceListener l)
           
 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
 
Methods inherited from interface org.apache.activemq.apollo.util.Service
start, stop
 

Constructor Detail

ServiceSupport

public ServiceSupport()
Method Detail

dispose

public static void dispose(Service service)

start

public void start()
           throws java.lang.Exception
Description copied from interface: Service
Starts the service. No guarantee is given that the service has fully started by the time this method returns.

Specified by:
start in interface Service
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Description copied from interface: Service
Stops the service. No guarantee is given that the service has fully stopped by the time this method returns.

Specified by:
stop in interface Service
Throws:
java.lang.Exception

isStarted

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

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

addServiceListener

public void addServiceListener(ServiceListener l)

removeServiceListener

public void removeServiceListener(ServiceListener l)

doStop

protected abstract void doStop(ServiceStopper stopper)
                        throws java.lang.Exception
Throws:
java.lang.Exception

doStart

protected abstract void doStart()
                         throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2005-2011 The Apache Software Foundation. All Rights Reserved.