Package javax.management

Examples of javax.management.MBeanServerConnection.addNotificationListener()


        throws Exception {

        JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/testApp");
        JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
        MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
        mbsc.addNotificationListener(
                new ObjectName("jmanage:name=TimeNotificationBroadcaster"),
                new MyNotificationListener(), null, null);

        while(true){
            try {
View Full Code Here


      ObjectName dsService = new ObjectName("jboss.test:service=DistributedStateTestCase");
      IDistributedState ds0 = (IDistributedState)
         MBeanServerInvocationHandler.newProxyInstance(server0, dsService,
         IDistributedState.class, true);
      TestListener listener0 = new TestListener();
      server0.addNotificationListener(dsService, listener0, null, null);
      ds0.put("key0", "value0");
      String value = (String) ds0.get("key0");
      log.info("server0: get(key0): "+value);
      assertEquals("server0: value == value0", "value0", value);
View Full Code Here

      log.info("server1: CurrentView, "+view1);
      IDistributedState ds1 = (IDistributedState)
         MBeanServerInvocationHandler.newProxyInstance(server1, dsService,
         IDistributedState.class, true);
      TestListener listener1 = new TestListener();
      server1.addNotificationListener(dsService, listener1, null, null);
      value = (String) ds1.get("key0");
      log.info("server1: get(key0): "+value);
      assertEquals("server1: value == value0", "value0", value);
      ds1.put("key0", "value1");
      value = (String) ds1.get("key0");
View Full Code Here

         MBeanServerInvocationHandler.newProxyInstance(server0, drmService,
         IReplicants.class, true);
      log.debug("+++ testStateReplication 2");
      log.info(MBeanServerInvocationHandler.class.getProtectionDomain());
      TestListener listener = new TestListener(log);
      server0.addNotificationListener(drmService, listener, null, null);
      log.info("server0 addNotificationListener");
      log.debug("+++ testStateReplication 3");
      String address = (String) drm0.lookupLocalReplicant();
      log.debug("+++ testStateReplication 4");
      log.info("server0: lookupLocalReplicant: "+address);
View Full Code Here

      Vector<?> view1 = (Vector<?>) server1.getAttribute(clusterService, "CurrentView");
      log.info("server1: CurrentView, "+view1);
      IReplicants drm1 = (IReplicants)
         MBeanServerInvocationHandler.newProxyInstance(server1, drmService,
         IReplicants.class, true);
      server1.addNotificationListener(drmService, listener, null, null);
      log.info("server1 addNotificationListener");
      address = (String) drm1.lookupLocalReplicant();
      log.info("server1: lookupLocalReplicant: "+address);
      assertTrue("server1: address("+address+") == server1("+servers[1]+")",
         address.equals(servers[1]));
View Full Code Here

      createMO(jmxFactory);
     
      scalarSupport.addAll(CONNECTOR_MANAGER, CONNECTOR_MANAGER_ATTR);
      scalarSupport.addAll(SERVER, SERVER_ATTR);
         
      server.addNotificationListener(JMX_EVENT_LOGGER, this, null, JMX_EVENT_LOGGER);
         
    }
    catch (Exception e)
    {
      Log.warn(e);
View Full Code Here

                              new MBeanNotificationInfo(jvmLowMemoryPoolUsageNotif,
          new JMXAttributeNotificationIndexSupport(
          new TypedAttribute("poolName", String.class),
          jvmMemManagerIndexSupport)));
      try {
        server.addNotificationListener(onameJvmMem,
                                       notificationSupport, null,
                                       JvmManagementMib.
                                       oidJvmLowMemoryPoolUsageNotif);
      }
      catch (Exception ex) {
View Full Code Here

                              new MBeanNotificationInfo(jvmLowMemoryPoolCollectNotif,
          new JMXAttributeNotificationIndexSupport(
          new TypedAttribute("poolName", String.class),
          jvmMemManagerIndexSupport)));
      try {
        server.addNotificationListener(onameJvmMem,
                                       notificationSupport, null,
                                       JvmManagementMib.
                                       oidJvmLowMemoryPoolCollectNotif);
      }
      catch (Exception ex) {
View Full Code Here

    if (e.getPropertyName().equals(Plugin.NEW_NODE_CONNECTION)){
      try {
        MBeanServerConnection mbsc=(MBeanServerConnection)e.getNewValue();
  if ( !ht_connectedGateway.containsValue(mbsc) ) {
    String jmxsurl = (String) e.getOldValue();
    mbsc.addNotificationListener(Activator.REMOTE_LOGGER_ON, this, null, jmxsurl);
    // At gateway connection time : add into the tree a "port/profileName" node under an "ip" node
    String ref = jmxsurl.substring(jmxsurl.lastIndexOf(":")+1);
    String ip_tmp = jmxsurl.substring(0, jmxsurl.lastIndexOf(":"));
    String ip = ip_tmp.substring(ip_tmp.lastIndexOf("/")+1);
    String connString = jmxsurl.substring(ip_tmp.lastIndexOf("/")+1);
View Full Code Here

            JMX.newMBeanProxy(mbsc, mbeanName, HelloMBean.class, true);

        // Add notification listener on Hello MBean
        //
        echo("\nAdd notification listener...");
  mbsc.addNotificationListener(mbeanName, listener, null, null);

        // Get CacheSize attribute in Hello MBean
        //
        echo("\nCacheSize = " + mbeanProxy.getCacheSize());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.