* <tt>false</tt> if the service is already in the desired state.
* @throws Exception is thrown if error occurred
*/
public static boolean suspendService(Service service) throws Exception {
if (service instanceof SuspendableService) {
SuspendableService ss = (SuspendableService) service;
if (!ss.isSuspended()) {
if (LOG.isTraceEnabled()) {
LOG.trace("Suspending service " + service);
}
ss.suspend();
return true;
} else {
return false;
}
} else if (service instanceof ServiceSupport) {
ServiceSupport ss = (ServiceSupport) service;
if (ss.getStatus().isStoppable()) {
stopServices(service);
return true;
} else {
return false;
}