buffered connection creation helper
This commit is contained in:
@@ -83,4 +83,12 @@ public class BufferedConnection implements IConnection {
|
||||
}
|
||||
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) {
|
||||
disconnect();
|
||||
if (conn instanceof BufferedConnection) {
|
||||
this.conn = (BufferedConnection) conn;
|
||||
} else {
|
||||
this.conn = new BufferedConnection(conn);
|
||||
}
|
||||
this.conn = BufferedConnection.makeBuffered(conn);
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
|
||||
Reference in New Issue
Block a user