org.apache.camel.util
Class ServiceHelper

java.lang.Object
  extended by org.apache.camel.util.ServiceHelper

public final class ServiceHelper
extends java.lang.Object

A collection of helper methods for working with Service objects

Version:

Method Summary
static boolean isStarted(java.lang.Object value)
          Is the given service starting or started?
static boolean isStopped(java.lang.Object value)
          Is the given service stopping or stopped?
static boolean resumeService(java.lang.Object service)
          Resumes the given service.
static void resumeServices(java.util.Collection<?> services)
           
static void startService(java.lang.Object value)
          Starts all of the given services
static void startServices(java.util.Collection<?> services)
          Starts all of the given services
static void startServices(java.lang.Object... services)
          Starts all of the given services
static void stopAndShutdownService(java.lang.Object value)
          Stops and shutdowns all of the given services, throwing the first exception caught
static void stopAndShutdownServices(java.util.Collection<?> services)
          Stops and shutdowns all of the given services, throwing the first exception caught
static void stopAndShutdownServices(java.lang.Object... services)
          Stops and shutdowns all of the given services, throwing the first exception caught
static void stopService(java.lang.Object value)
          Stops all of the given services, throwing the first exception caught
static void stopServices(java.util.Collection<?> services)
          Stops all of the given services, throwing the first exception caught
static void stopServices(java.lang.Object... services)
          Stops all of the given services, throwing the first exception caught
static boolean suspendService(Service service)
          Suspends the given service.
static void suspendServices(java.util.Collection<?> services)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

startService

public static void startService(java.lang.Object value)
                         throws java.lang.Exception
Starts all of the given services

Throws:
java.lang.Exception

startServices

public static void startServices(java.lang.Object... services)
                          throws java.lang.Exception
Starts all of the given services

Throws:
java.lang.Exception

startServices

public static void startServices(java.util.Collection<?> services)
                          throws java.lang.Exception
Starts all of the given services

Throws:
java.lang.Exception

stopServices

public static void stopServices(java.lang.Object... services)
                         throws java.lang.Exception
Stops all of the given services, throwing the first exception caught

Throws:
java.lang.Exception

stopService

public static void stopService(java.lang.Object value)
                        throws java.lang.Exception
Stops all of the given services, throwing the first exception caught

Throws:
java.lang.Exception

stopServices

public static void stopServices(java.util.Collection<?> services)
                         throws java.lang.Exception
Stops all of the given services, throwing the first exception caught

Throws:
java.lang.Exception

stopAndShutdownServices

public static void stopAndShutdownServices(java.lang.Object... services)
                                    throws java.lang.Exception
Stops and shutdowns all of the given services, throwing the first exception caught

Throws:
java.lang.Exception

stopAndShutdownService

public static void stopAndShutdownService(java.lang.Object value)
                                   throws java.lang.Exception
Stops and shutdowns all of the given services, throwing the first exception caught

Throws:
java.lang.Exception

stopAndShutdownServices

public static void stopAndShutdownServices(java.util.Collection<?> services)
                                    throws java.lang.Exception
Stops and shutdowns all of the given services, throwing the first exception caught

Throws:
java.lang.Exception

resumeServices

public static void resumeServices(java.util.Collection<?> services)
                           throws java.lang.Exception
Throws:
java.lang.Exception

resumeService

public static boolean resumeService(java.lang.Object service)
                             throws java.lang.Exception
Resumes the given service.

If the service is a SuspendableService then the resume operation is only invoked if the service is suspended.

If the service is a ServiceSupport then the start operation is only invoked if the service is startable.

Otherwise the service is started.

Parameters:
service - the service
Returns:
true if either resume or start was invoked, false if the service is already in the desired state.
Throws:
java.lang.Exception - is thrown if error occurred

suspendServices

public static void suspendServices(java.util.Collection<?> services)
                            throws java.lang.Exception
Throws:
java.lang.Exception

suspendService

public static boolean suspendService(Service service)
                              throws java.lang.Exception
Suspends the given service.

If the service is a SuspendableService then the suspend operation is only invoked if the service is not suspended.

If the service is a ServiceSupport then the stop operation is only invoked if the service is stoppable.

Otherwise the service is stopped.

Parameters:
service - the service
Returns:
true if either suspend or stop was invoked, false if the service is already in the desired state.
Throws:
java.lang.Exception - is thrown if error occurred

isStopped

public static boolean isStopped(java.lang.Object value)
Is the given service stopping or stopped?

Returns:
true if already stopped, otherwise false

isStarted

public static boolean isStarted(java.lang.Object value)
Is the given service starting or started?

Returns:
true if already started, otherwise false


Apache CAMEL