Beispiel #1
0
 /**
  * Connects the specified table network node to the table network defined by the specified
  * configuration.
  *
  * @param configuration The table network configuration.
  * @param nodeController The control interface of the table network node.
  * @throws java.lang.InterruptedException If this thread is interrupted while waiting for the
  *     table network to connect.
  * @throws org.gamegineer.table.net.TableNetworkException If the connection cannot be established
  *     or the table network is already connected.
  */
 private void connect(
     final TableNetworkConfiguration configuration, final INodeController nodeController)
     throws TableNetworkException, InterruptedException {
   if (connectionStateRef_.compareAndSet(
       ConnectionState.DISCONNECTED, ConnectionState.CONNECTING)) {
     try {
       nodeController.endConnect(nodeController.beginConnect(configuration));
       nodeControllerRef_.set(nodeController);
       connectionStateRef_.set(ConnectionState.CONNECTED);
       fireTableNetworkConnected();
     } catch (final TableNetworkException e) {
       connectionStateRef_.set(ConnectionState.DISCONNECTED);
       throw e;
     } catch (final InterruptedException e) {
       connectionStateRef_.set(ConnectionState.DISCONNECTED);
       throw e;
     }
   } else {
     throw new TableNetworkException(TableNetworkError.ILLEGAL_CONNECTION_STATE);
   }
 }