Exemplo n.º 1
0
  public synchronized void start() {
    if (!started) {
      HornetQJMSLogger.LOGGER.debug("Starting RecoveryDiscovery on " + config);
      started = true;

      locator = config.createServerLocator();
      locator.disableFinalizeCheck();
      locator.addClusterTopologyListener(new InternalListener(config));
      try {
        sessionFactory = (ClientSessionFactoryInternal) locator.createSessionFactory();
        // We are using the SessionFactoryInternal here directly as we don't have information to
        // connect with an user and password
        // on the session as all we want here is to get the topology
        // in case of failure we will retry
        sessionFactory.addFailureListener(this);

        HornetQJMSLogger.LOGGER.debug("RecoveryDiscovery started fine on " + config);
      } catch (Exception startupError) {
        HornetQJMSLogger.LOGGER.warn(
            "Couldn't start recovery discovery on "
                + config
                + ", we will retry this on the next recovery scan");
        stop();
        HornetQRecoveryRegistry.getInstance().failedDiscovery(this);
      }
    }
  }
Exemplo n.º 2
0
 /* (non-Javadoc)
  * @see org.hornetq.core.remoting.FailureListener#connectionFailed(org.hornetq.api.core.HornetQException, boolean)
  */
 public void connectionFailed(HornetQException exception, boolean failedOver) {
   if (exception.getType() == HornetQExceptionType.DISCONNECTED) {
     HornetQJMSLogger.LOGGER.warn("being disconnected for server shutdown", exception);
   } else {
     HornetQJMSLogger.LOGGER.warn(
         "Notified of connection failure in xa discovery, we will retry on the next recovery",
         exception);
   }
   internalStop();
   HornetQRecoveryRegistry.getInstance().failedDiscovery(this);
 }
Exemplo n.º 3
0
 public void nodeUP(TopologyMember topologyMember, boolean last) {
   // There is a case where the backup announce itself,
   // we need to ignore a case where getLive is null
   if (topologyMember.getLive() != null) {
     Pair<TransportConfiguration, TransportConfiguration> connector =
         new Pair<TransportConfiguration, TransportConfiguration>(
             topologyMember.getLive(), topologyMember.getBackup());
     HornetQRecoveryRegistry.getInstance()
         .nodeUp(
             topologyMember.getNodeId(), connector, config.getUsername(), config.getPassword());
   }
 }