org.apache.camel.util
Class ServiceHelper

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

public final class ServiceHelper
extends Object

A collection of helper methods for working with Service objects

Version:
$Revision: 895918 $

Method Summary
static boolean resumeService(Service service)
          Resumes the given service.
static void startService(Object value)
           
static void startServices(Collection<?> services)
          Starts all of the given services
static void startServices(Object... services)
          Starts all of the given services
static void stopService(Object value)
           
static void stopServices(Collection<?> services)
          Stops all of the given services, throwing the first exception caught
static void stopServices(Object... services)
          Stops all of the given services, throwing the first exception caught
static boolean suspendService(Service service)
          Suspends the given service.
 
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(Object value)
                         throws Exception
Throws:
Exception

startServices

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

Throws:
Exception

startServices

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

Throws:
Exception

stopServices

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

Throws:
Exception

stopService

public static void stopService(Object value)
                        throws Exception
Throws:
Exception

stopServices

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

Throws:
Exception

resumeService

public static boolean resumeService(Service service)
                             throws 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:
Exception - is thrown if error occurred

suspendService

public static boolean suspendService(Service service)
                              throws 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 stopable.

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:
Exception - is thrown if error occurred


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.