mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
28 lines
621 B
Java
28 lines
621 B
Java
package net.sf.briar.plugins;
|
|
|
|
import java.io.IOException;
|
|
import java.util.concurrent.Executor;
|
|
|
|
import net.sf.briar.api.plugins.Plugin;
|
|
|
|
public abstract class AbstractPlugin implements Plugin {
|
|
|
|
protected final Executor executor;
|
|
|
|
protected boolean started = false; // Locking: this
|
|
|
|
protected AbstractPlugin(Executor executor) {
|
|
this.executor = executor;
|
|
}
|
|
|
|
public synchronized void start() throws IOException {
|
|
if(started) throw new IllegalStateException();
|
|
started = true;
|
|
}
|
|
|
|
public synchronized void stop() throws IOException {
|
|
if(!started) throw new IllegalStateException();
|
|
started = false;
|
|
}
|
|
}
|