Class ServiceHelper
java.lang.Object
org.apache.camel.support.service.ServiceHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidbuildService(@Nullable Object value) Builds the givenvalueif it's aServiceor a collection of it.static voidbuildService(@Nullable Object @Nullable ... services) Builds each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.getChildServices(Service service) Gathers all child services by navigating the service to recursively gather all child services.getChildServices(Service service, boolean includeErrorHandler) Gathers all child services by navigating the service to recursively gather all child services.static voidinitService(@Nullable Object value) Initializes the givenvalueif it's aServiceor a collection of it.static voidinitService(@Nullable Object @Nullable ... services) Initializes each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.static booleanIs the given service starting or already started?static booleanisStarted(@Nullable StatefulService service) Is the given service starting or already started?static booleanIs the given service stopping or already stopped?static booleanisStopped(@Nullable StatefulService service) Is the given service stopping or already stopped?static booleanisSuspended(@Nullable Object value) Is the given service suspending or already suspended?static booleanisSuspended(@Nullable StatefulService service) Is the given service suspending or already suspended?static booleanresumeService(@Nullable Object service) Resumes the givenservice.static voidresumeServices(@Nullable Collection<?> services) Resumes each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.static voidstartService(@Nullable Iterable<?> value) Starts the givenvalueif it's aServiceor a collection of it.static voidstartService(@Nullable Object value) Starts the givenvalueif it's aServiceor a collection of it.static voidstartService(@Nullable Object @Nullable ... services) Starts each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.static voidstartService(@Nullable Service service) Starts the givenvalueif it's aServiceor a collection of it.static voidstopAndShutdownService(@Nullable Object value) Stops and shutdowns the givenservice, rethrowing the first exception caught.static voidstopAndShutdownService(@Nullable ShutdownableService service) Stops and shutdowns the givenservice, rethrowing the first exception caught.static voidstopAndShutdownServices(@Nullable Object @Nullable ... services) Stops and shutdowns each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.static voidstopAndShutdownServices(@Nullable Collection<?> services) Stops and shutdowns each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.static voidstopService(@Nullable Iterable<?> value) Stops the givenvalue, rethrowing the first exception caught.static voidstopService(@Nullable Object value) Stops the givenvalue, rethrowing the first exception caught.static voidstopService(@Nullable Object @Nullable ... services) Stops each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.static voidstopService(@Nullable Collection<?> services) Stops each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.static voidstopService(@Nullable Service service) Stops the givenvalue, rethrowing the first exception caught.static booleansuspendService(@Nullable Object service) Suspends the givenservice.static voidsuspendServices(@Nullable Collection<?> services) Suspends each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.
-
Method Details
-
buildService
-
buildService
Builds each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.- See Also:
-
initService
-
initService
Initializes each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.- See Also:
-
startService
-
startService
-
startService
-
startService
Starts each element of the givenservicesifservicesitself is notnull, otherwise this method would return immediately.- See Also:
-
stopService
Stops each element of the givenservicesifservicesitself is notnull, 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.- See Also:
-
stopService
Stops the givenvalue, rethrowing the first exception caught. Calling this method has no effect ifvalueisnull.- See Also:
-
stopService
Stops the givenvalue, rethrowing the first exception caught. Calling this method has no effect ifvalueisnull.- See Also:
-
stopService
Stops the givenvalue, rethrowing the first exception caught. Calling this method has no effect ifvalueisnull.- See Also:
-
stopService
Stops each element of the givenservicesifservicesitself is notnull, 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.- See Also:
-
stopAndShutdownServices
Stops and shutdowns each element of the givenservicesifservicesitself is notnull, 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.- See Also:
-
stopAndShutdownService
Stops and shutdowns the givenservice, rethrowing the first exception caught. Calling this method has no effect ifvalueisnull.- See Also:
-
stopAndShutdownService
Stops and shutdowns the givenservice, rethrowing the first exception caught. Calling this method has no effect ifvalueisnull.- See Also:
-
stopAndShutdownServices
Stops and shutdowns each element of the givenservicesifservicesitself is notnull, 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.- See Also:
-
resumeServices
Resumes each element of the givenservicesifservicesitself is notnull, 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.- See Also:
-
resumeService
Resumes the givenservice. Ifserviceis bothSuspendableandSuspendableServicethen itsSuspendableService.resume()is called but only ifserviceis alreadysuspended. Ifserviceis not aSuspendableandSuspendableServicethen itsService.start()is called. Calling this method has no effect ifserviceisnull.- Parameters:
service- the service- Returns:
- true if either resume method or
startService(Object)was called, false otherwise. - Throws:
Exception- is thrown if error occurred- See Also:
-
suspendServices
Suspends each element of the givenservicesifservicesitself is notnull, 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.- See Also:
-
suspendService
Suspends the givenservice. Ifserviceis bothSuspendableandSuspendableServicethen itsSuspendableService.suspend()is called but only ifserviceis not alreadysuspended. Ifserviceis not aSuspendableandSuspendableServicethen itsService.stop()is called. Calling this method has no effect ifserviceisnull.- Parameters:
service- the service- Returns:
- true if either the suspend method or
stopService(Object)was called, false otherwise. - Throws:
Exception- is thrown if error occurred- See Also:
-
isStopped
Is the given service stopping or already stopped?- Returns:
- true if stopping or already stopped, false otherwise
- See Also:
-
isStopped
Is the given service stopping or already stopped?- Returns:
- true if stopping or already stopped, false otherwise
- See Also:
-
isStarted
Is the given service starting or already started?- Returns:
- true if starting or already started, false otherwise
- See Also:
-
isStarted
Is the given service starting or already started?- Returns:
- true if starting or already started, false otherwise
- See Also:
-
isSuspended
Is the given service suspending or already suspended?- Returns:
- true if suspending or already suspended, false otherwise
- See Also:
-
isSuspended
Is the given service suspending or already suspended?- Returns:
- true if suspending or already suspended, false otherwise
- See Also:
-
getChildServices
Gathers all child services by navigating the service to recursively gather all child services. The returned set does not include the children being error handler.- Parameters:
service- the service- Returns:
- the services, including the parent service, and all its children
-
getChildServices
Gathers all child services by navigating the service to recursively gather all child services.- Parameters:
service- the serviceincludeErrorHandler- whether to include error handlers- Returns:
- the services, including the parent service, and all its children
-