Esempio n. 1
0
 /**
  * Adds a connection to some other message hub. Outgoing messages are forwarded to this
  * connection, and incoming messages are received from it.
  *
  * <p>Does not cleanup connections on stop or disconnect. It is the caller's responsibility to
  * manage the connection lifecycle.
  */
 public void addConnection(RemoteConnection<InterHubMessage> connection) {
   lock.lock();
   try {
     assertRunning("add connection");
     ConnectionState connectionState = connections.add(connection);
     workers.execute(new ConnectionDispatch(connectionState));
     workers.execute(new ConnectionReceive(connectionState));
   } finally {
     lock.unlock();
   }
 }