예제 #1
0
 /**
  * Federation destroying is a bit of a catch-22. We need to connect to the channel that the
  * federation is operating on in order to determine whether a federation is even active at all
  * (which it may well not be). So in this case we connect to the channel and then if there is a
  * federation running in there, we ask that it be destroyed by removing the contained FOM.
  *
  * <p>If there are members of the channel who are still currently federates, then this call will
  * fail and thrown an exception.
  *
  * <p>**NOTE** If we ever ask to destroy a federation, we will automatically disconnect from the
  * channel when done. Fair chance we don't care about it any more once we try a destroy.
  */
 public void destroyFederation(DestroyFederation destroyMessage) throws Exception {
   // connect to the channel if we are not already
   Federation federation = findFederation(destroyMessage.getFederationName());
   try {
     federation.sendDestroyFederation();
   } finally {
     // We put this here because the above call may throw an exception if there
     // are federates still connected (and thus it can't destroy the federation).
     // That exception would in turn cascade out and prevent us from disconnecting
     // unless we did something about it!
     federation.disconnect();
     federations.remove(federation);
   }
 }
예제 #2
0
  /**
   * <i>This method is called by the Portico infrastructure during shutdown.</i>
   *
   * <p>When the kernel is ready to shutdown, it will call this method, signalling to the connection
   * that it should disconnect and do any shutdown and cleanup necessary.
   */
  public void disconnect() throws JRTIinternalError {
    if (this.running == false) {
      logger.info("jgroups connection is already disconnected");
      return;
    }

    logger.info("jgroups connection is disconnecting...");

    // for each federation we're connected to, disconnect from it
    for (Federation federation : federations.values()) federation.disconnect();

    federations.clear();
    logger.info("jgroups connection has disconnected");
  }