예제 #1
0
 /**
  * Remove message listener and deregister Cluster from listener.
  *
  * @see
  *     org.apache.catalina.ha.CatalinaCluster#removeClusterListener(org.apache.catalina.ha.ClusterListener)
  */
 @Override
 public void removeClusterListener(ClusterListener listener) {
   if (listener != null) {
     clusterListeners.remove(listener);
     listener.setCluster(null);
   }
 }
예제 #2
0
 /**
  * Add cluster message listener and register cluster to this listener.
  *
  * @see
  *     org.apache.catalina.ha.CatalinaCluster#addClusterListener(org.apache.catalina.ha.ClusterListener)
  */
 @Override
 public void addClusterListener(ClusterListener listener) {
   if (listener != null && !clusterListeners.contains(listener)) {
     clusterListeners.add(listener);
     listener.setCluster(this);
   }
 }
예제 #3
0
  public void messageReceived(ClusterMessage message) {

    if (log.isDebugEnabled() && message != null)
      log.debug(
          "Assuming clocks are synched: Replication for "
              + message.getUniqueId()
              + " took="
              + (System.currentTimeMillis() - (message).getTimestamp())
              + " ms.");

    // invoke all the listeners
    boolean accepted = false;
    if (message != null) {
      for (Iterator<ClusterListener> iter = clusterListeners.iterator(); iter.hasNext(); ) {
        ClusterListener listener = iter.next();
        if (listener.accept(message)) {
          accepted = true;
          listener.messageReceived(message);
        }
      }
      if (!accepted && notifyLifecycleListenerOnFailure) {
        Member dest = message.getAddress();
        // Notify our interested LifecycleListeners
        fireLifecycleEvent(RECEIVE_MESSAGE_FAILURE_EVENT, new SendMessageData(message, dest, null));
        if (log.isDebugEnabled()) {
          log.debug(
              "Message "
                  + message.toString()
                  + " from type "
                  + message.getClass().getName()
                  + " transfered but no listener registered");
        }
      }
    }
    return;
  }
 public static void startManagers() {
   ClusterListener.startManagers();
   try {
     if (gerenciadornuvem0 == null)
       gerenciadornuvem0 =
           (Gerenciadornuvem0Interface) Naming.lookup("rmi://0:1099/gerenciadornuvem0");
     if (gerenciadornuvem1 == null)
       gerenciadornuvem1 =
           (Gerenciadornuvem1Interface) Naming.lookup("rmi://1:1099/gerenciadornuvem1");
   } catch (RemoteException e) {
     e.printStackTrace();
   } catch (NotBoundException e) {
     e.printStackTrace();
   } catch (MalformedURLException e) {
     e.printStackTrace();
   }
 }