mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 22:29:53 +01:00
ExceptionHandler interface.
This commit is contained in:
6
api/net/sf/briar/api/ExceptionHandler.java
Normal file
6
api/net/sf/briar/api/ExceptionHandler.java
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package net.sf.briar.api;
|
||||||
|
|
||||||
|
public interface ExceptionHandler<E extends Exception> {
|
||||||
|
|
||||||
|
void handleException(E exception);
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.sf.briar.api.transport;
|
package net.sf.briar.api.transport;
|
||||||
|
|
||||||
|
import net.sf.briar.api.ExceptionHandler;
|
||||||
import net.sf.briar.api.db.DbException;
|
import net.sf.briar.api.db.DbException;
|
||||||
import net.sf.briar.api.protocol.TransportId;
|
import net.sf.briar.api.protocol.TransportId;
|
||||||
|
|
||||||
@@ -15,12 +16,10 @@ public interface ConnectionRecogniser {
|
|||||||
*/
|
*/
|
||||||
void acceptConnection(TransportId t, byte[] tag, Callback c);
|
void acceptConnection(TransportId t, byte[] tag, Callback c);
|
||||||
|
|
||||||
interface Callback {
|
interface Callback extends ExceptionHandler<DbException> {
|
||||||
|
|
||||||
void connectionAccepted(ConnectionContext ctx);
|
void connectionAccepted(ConnectionContext ctx);
|
||||||
|
|
||||||
void connectionRejected();
|
void connectionRejected();
|
||||||
|
|
||||||
void handleException(DbException e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class ConnectionDispatcherImpl implements ConnectionDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void connectionRejected() {
|
public void connectionRejected() {
|
||||||
r.dispose(false);
|
r.dispose(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleException(DbException e) {
|
public void handleException(DbException e) {
|
||||||
@@ -103,7 +103,7 @@ class ConnectionDispatcherImpl implements ConnectionDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void connectionRejected() {
|
public void connectionRejected() {
|
||||||
s.dispose(false);
|
s.dispose(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleException(DbException e) {
|
public void handleException(DbException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user