buffered connection creation helper
This commit is contained in:
@@ -83,4 +83,12 @@ public class BufferedConnection implements IConnection {
|
|||||||
}
|
}
|
||||||
return msgs;
|
return msgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BufferedConnection makeBuffered(IConnection conn) {
|
||||||
|
if (conn instanceof BufferedConnection) {
|
||||||
|
return (BufferedConnection) conn;
|
||||||
|
} else {
|
||||||
|
return new BufferedConnection(conn);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,11 +106,7 @@ public class ControllerBehavior extends Behavior implements IMessageListener {
|
|||||||
|
|
||||||
public void connectTo(IConnection conn) {
|
public void connectTo(IConnection conn) {
|
||||||
disconnect();
|
disconnect();
|
||||||
if (conn instanceof BufferedConnection) {
|
this.conn = BufferedConnection.makeBuffered(conn);
|
||||||
this.conn = (BufferedConnection) conn;
|
|
||||||
} else {
|
|
||||||
this.conn = new BufferedConnection(conn);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnect() {
|
public void disconnect() {
|
||||||
|
|||||||
Reference in New Issue
Block a user