public final class ServiceHelper extends Object
Service
objects.Modifier and Type | Method and Description |
---|---|
static Set<Service> |
getChildServices(Service service)
Gathers all child services by navigating the service to recursively gather all child services.
|
static Set<Service> |
getChildServices(Service service,
boolean includeErrorHandler)
Gathers all child services by navigating the service to recursively gather all child services.
|
static boolean |
isStarted(Object value)
Is the given service starting or already started?
|
static boolean |
isStopped(Object value)
Is the given service stopping or already stopped?
|
static boolean |
isSuspended(Object value)
Is the given service suspending or already suspended?
|
static boolean |
resumeService(Object service)
Resumes the given
service . |
static void |
resumeServices(Collection<?> services)
Resumes each element of the given
services if services itself is
not null , otherwise this method would return immediately. |
static void |
startService(Object value)
Starts the given
value if it's a Service or a collection of it. |
static void |
startService(Service service)
Starts the given
service . |
static void |
startServices(Collection<?> services)
Starts each element of the given
services if services itself is
not null , otherwise this method would return immediately. |
static void |
startServices(Object... services)
Starts each element of the given
services if services itself is
not null , otherwise this method would return immediately. |
static void |
stopAndShutdownService(Object value)
Stops and shutdowns the given
service , rethrowing the first exception caught. |
static void |
stopAndShutdownServices(Collection<?> services)
Stops and shutdowns each element of the given
services if services
itself is not null , otherwise this method would return immediately. |
static void |
stopAndShutdownServices(Object... services)
Stops and shutdowns each element of the given
services if services itself is
not null , otherwise this method would return immediately. |
static void |
stopService(Object value)
Stops the given
value , rethrowing the first exception caught. |
static void |
stopServices(Collection<?> services)
Stops each element of the given
services if services itself is
not null , otherwise this method would return immediately. |
static void |
stopServices(Object... services)
Stops each element of the given
services if services itself is
not null , otherwise this method would return immediately. |
static boolean |
suspendService(Object service)
Suspends the given
service . |
static void |
suspendServices(Collection<?> services)
Suspends each element of the given
services if services itself is
not null , otherwise this method would return immediately. |
public static void startService(Object value) throws Exception
value
if it's a Service
or a collection of it.
Calling this method has no effect if value
is null
.Exception
startService(Service)
,
startServices(Collection)
public static void startService(Service service) throws Exception
service
.
Calling this method has no effect if service
is null
.Exception
Service.start()
public static void startServices(Object... services) throws Exception
services
if services
itself is
not null
, otherwise this method would return immediately.Exception
startServices(Collection)
public static void startServices(Collection<?> services) throws Exception
services
if services
itself is
not null
, otherwise this method would return immediately.Exception
startService(Object)
public static void stopServices(Object... services) throws Exception
services
if services
itself is
not null
, otherwise this method would return immediately.
If there's any exception being thrown while stopping the elements one after the
other this method would rethrow the first such exception being thrown.Exception
stopServices(Collection)
public static void stopService(Object value) throws Exception
value
, rethrowing the first exception caught.
Calling this method has no effect if value
is null
.Exception
Service.stop()
,
stopServices(Collection)
public static void stopServices(Collection<?> services) throws Exception
services
if services
itself is
not null
, otherwise this method would return immediately.
If there's any exception being thrown while stopping the elements one after the
other this method would rethrow the first such exception being thrown.Exception
stopService(Object)
public static void stopAndShutdownServices(Object... services) throws Exception
services
if services
itself is
not null
, otherwise this method would return immediately.
If there's any exception being thrown while stopping/shutting down the elements one after
the other this method would rethrow the first such exception being thrown.Exception
stopAndShutdownServices(Collection)
public static void stopAndShutdownService(Object value) throws Exception
service
, rethrowing the first exception caught.
Calling this method has no effect if value
is null
.Exception
stopService(Object)
,
ShutdownableService.shutdown()
public static void stopAndShutdownServices(Collection<?> services) throws Exception
services
if services
itself is not null
, otherwise this method would return immediately.
If there's any exception being thrown while stopping/shutting down the elements one after
the other this method would rethrow the first such exception being thrown.Exception
stopService(Object)
,
ShutdownableService.shutdown()
public static void resumeServices(Collection<?> services) throws Exception
services
if services
itself is
not null
, otherwise this method would return immediately.
If there's any exception being thrown while resuming the elements one after the
other this method would rethrow the first such exception being thrown.Exception
resumeService(Object)
public static boolean resumeService(Object service) throws Exception
service
.
If service
is both Suspendable
and SuspendableService
then
its SuspendableService.resume()
is called but
only if service
is already suspended
.
If service
is not a
Suspendable
and SuspendableService
then its
Service.start()
is called.
Calling this method has no effect if service
is null
.service
- the servicestartService(Service)
was called, false
otherwise.Exception
- is thrown if error occurredstartService(Service)
public static void suspendServices(Collection<?> services) throws Exception
services
if services
itself is
not null
, otherwise this method would return immediately.
If there's any exception being thrown while suspending the elements one after the
other this method would rethrow the first such exception being thrown.Exception
suspendService(Object)
public static boolean suspendService(Object service) throws Exception
service
.
If service
is both Suspendable
and SuspendableService
then
its SuspendableService.suspend()
is called but
only if service
is not already
suspended
.
If service
is not a
Suspendable
and SuspendableService
then its
Service.stop()
is called.
Calling this method has no effect if service
is null
.service
- the servicestopService(Object)
was called, false
otherwise.Exception
- is thrown if error occurredstopService(Object)
public static boolean isStopped(Object value)
StatefulService.isStopping()
,
StatefulService.isStopped()
public static boolean isStarted(Object value)
StatefulService.isStarting()
,
StatefulService.isStarted()
public static boolean isSuspended(Object value)
StatefulService.isSuspending()
,
SuspendableService.isSuspended()
public static Set<Service> getChildServices(Service service)
service
- the servicepublic static Set<Service> getChildServices(Service service, boolean includeErrorHandler)
service
- the serviceincludeErrorHandler
- whether to include error handlersApache Camel