Example #1
0
 public void connectionRemoved(Connection connection) {
   logger.log(Level.FINEST, "Connection is removed " + connection.getEndPoint());
   if (!node.joined()) {
     if (getMasterAddress() != null) {
       if (getMasterAddress().equals(connection.getEndPoint())) {
         node.setMasterAddress(null);
       }
     }
   }
 }
  @Override
  public void upgrade(Connection newConnection) {
    Connection old_connection = getConnection();

    if (LOG.isDebugEnabled())
      LOG.debug("{} upgrading from {} to {}", this, old_connection, newConnection);

    ByteBuffer prefilled =
        (old_connection instanceof Connection.UpgradeFrom)
            ? ((Connection.UpgradeFrom) old_connection).onUpgradeFrom()
            : null;
    old_connection.onClose();
    old_connection.getEndPoint().setConnection(newConnection);

    if (newConnection instanceof Connection.UpgradeTo)
      ((Connection.UpgradeTo) newConnection).onUpgradeTo(prefilled);
    else if (BufferUtil.hasContent(prefilled)) throw new IllegalStateException();

    newConnection.onOpen();
  }
Example #3
0
 public ClientEndpoint createNew(Connection conn) {
   return new ClientEndpoint(
       ClientEngineImpl.this, conn, UuidUtil.createClientUuid(conn.getEndPoint()));
 }