mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Services should throw exceptions for startup errors.
This commit is contained in:
@@ -3,14 +3,14 @@ package org.briarproject.api.lifecycle;
|
||||
public interface Service {
|
||||
|
||||
/**
|
||||
* Starts the service and returns true if it started successfully.
|
||||
* This method must not be called concurrently with {@link #stop()}.
|
||||
* Starts the service.This method must not be called concurrently with
|
||||
* {@link #stopService()}.
|
||||
*/
|
||||
public boolean start();
|
||||
void startService() throws ServiceException;
|
||||
|
||||
/**
|
||||
* Stops the service and returns true if it stopped successfully.
|
||||
* This method must not be called concurrently with {@link #start()}.
|
||||
* Stops the service. This method must not be called concurrently with
|
||||
* {@link #startService()}.
|
||||
*/
|
||||
public boolean stop();
|
||||
void stopService() throws ServiceException;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.briarproject.api.lifecycle;
|
||||
|
||||
/**
|
||||
* An exception that indicates an error starting or stopping a {@link Service}.
|
||||
*/
|
||||
public class ServiceException extends Exception {
|
||||
|
||||
public ServiceException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ServiceException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user