Exemplo n.º 1
0
    public void handleNotification(Notification n, Object h) {
      if (n instanceof JMXConnectionNotification) {
        JMXConnectionNotification jcn = (JMXConnectionNotification) n;
        final String type = jcn.getType();
        System.out.println(">>> The listener receives notif with the type:" + type);

        if (JMXConnectionNotification.CLOSED.equals(type)
            || JMXConnectionNotification.FAILED.equals(type)) {

          synchronized (this) {
            done = false;
          }

          try {
            conn.getDefaultDomain();
          } catch (IOException ioe) {
            // Greate !
          }

          synchronized (this) {
            done = true;
          }

          System.out.println(">>> The listener is not blocked!");
        }
      }
    }
Exemplo n.º 2
0
 public void handleNotification(Notification n, Object hb) {
   if (n instanceof JMXConnectionNotification) {
     if (JMXConnectionNotification.FAILED.equals(n.getType())
         || JMXConnectionNotification.CLOSED.equals(n.getType())) {
       markAsDead();
     }
   }
 }