mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Merge branch '273-service-exceptions' into 'master'
Services should throw exceptions for startup errors Fixes #273 See merge request !134
This commit is contained in:
@@ -19,7 +19,6 @@ import org.briarproject.api.sync.Offer;
|
||||
import org.briarproject.api.sync.Request;
|
||||
import org.briarproject.api.transport.TransportKeys;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -37,7 +36,7 @@ public interface DatabaseComponent {
|
||||
/**
|
||||
* Waits for any open transactions to finish and closes the database.
|
||||
*/
|
||||
void close() throws DbException, IOException;
|
||||
void close() throws DbException;
|
||||
|
||||
/**
|
||||
* Starts a new transaction and returns an object representing it.
|
||||
|
||||
@@ -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