Package javax.management

Examples of javax.management.ObjectName


      if (useJmx > 0 && this.mbeanServer != null) {
         // display some statistics ...
         try {
            // javap com.sun.management.UnixOperatingSystem
            ObjectName name = new ObjectName("java.lang:type=OperatingSystem");
            Object obj = this.mbeanServer.getAttribute(name, "TotalPhysicalMemorySize");
            Global.totalPhysicalMemorySize = (obj instanceof Long) ? ((Long)obj).longValue() : 0;
            obj = this.mbeanServer.getAttribute(name, "CommittedVirtualMemorySize");
            //long committed = (obj instanceof Long) ? ((Long)obj).longValue() : 0;
            obj = this.mbeanServer.getAttribute(name, "MaxFileDescriptorCount");
            Global.maxFileDescriptorCount = (obj instanceof Long) ? ((Long)obj).longValue() : 0;


            name = new ObjectName("java.lang:type=Memory");
            obj = this.mbeanServer.getAttribute(name, "HeapMemoryUsage");
            if (obj instanceof javax.management.openmbean.CompositeDataSupport) {
               //java.lang.management.MemoryUsage.getMax()
               javax.management.openmbean.CompositeDataSupport comp =
                 (javax.management.openmbean.CompositeDataSupport)obj;
View Full Code Here


            }
            else {
               this.html = new HtmlAdaptorServer(port);
            }

            ObjectName html_name = new ObjectName("Adaptor:name=html,port="+port);

            ObjectInstance objectInstance = this.mbeanServer.registerMBean(this.html, html_name);
            JmxMBeanHandle handle = new JmxMBeanHandle(objectInstance, null, this.html);
            this.mbeanMap.put(html_name.toString(), handle);

            if (loginName == null) {
               log.info("Registered JMX HTML adaptor on http://"+hostname+":"+port +
                        ". No authentication is configured with 'xmlBlaster/jmx/HtmlAdaptor/loginName=...'");
            }
View Full Code Here

      String newRootName = newRootNode.getAbsoluteName(ContextNode.SCHEMA_JMX);
      int count = 0;
      if (log.isLoggable(Level.FINER)) log.finer("JMX rename registration from '" + oldName + "' to new root '" + newRootName + "'");
      try {
         // e.g. "org.xmlBlaster:nodeClass=node,node=clientSUB1,*"
         ObjectName query = new ObjectName(oldName+",*");
         QueryExp queryExp = null;
         Set mbeanSet = this.mbeanServer.queryMBeans(query, queryExp);
         if (mbeanSet.size() == 0) {
            if (log.isLoggable(Level.FINE)) log.fine("JMX rename registration from '" + oldName + "' to '" + newRootName + "', nothing found for '" + query + "'");
            return count;
         }
         Iterator it = mbeanSet.iterator();
         while (it.hasNext()) {
            ObjectInstance instance = (ObjectInstance)it.next();
            ObjectName tmp = instance.getObjectName();
            JmxMBeanHandle mbeanHandle = (JmxMBeanHandle)this.mbeanMap.get(tmp.toString());
            if (mbeanHandle == null) {
               log.severe("Internal problem: Can't find registration of MBean '" + tmp.toString() + "'");
               continue;
            }
            // /node/heron/connection/joe/session/2
            ContextNode newRoot = ContextNode.valueOf(newRootName);

            // /node/clientjoe1/service/Pop3Driver
            ContextNode current = ContextNode.valueOf(tmp.toString());
            if (current == null) continue;

            // /node/clientjoe1
            ContextNode parent = current.getParent(oldRootClassname);
            if (parent == null) continue;

            // service/Pop3Driver
            ContextNode[] childs = parent.getChildren();
            if (childs.length != 1) continue;

            this.mbeanServer.unregisterMBean(tmp);
            this.mbeanMap.remove(tmp.toString());

            // take this leg and attach it to the newRoot
            ContextNode result = newRoot.mergeChildTree(childs[0]);
            if (log.isLoggable(Level.FINE)) log.fine("Renamed '" + oldName + "' to '" + result.getAbsoluteName(ContextNode.SCHEMA_JMX) + "'");
            if (result != null) {
View Full Code Here

      if (oldName == null || classNameToChange == null) return 0;
      int count = 0;
      if (log.isLoggable(Level.FINER)) log.finer("JMX rename registration from '" + oldName + "' to '" + classNameToChange + "=" + instanceName + "'");
      try {
         // e.g. "org.xmlBlaster:nodeClass=node,node=clientSUB1,*"
         ObjectName query = new ObjectName(oldName+",*");
         QueryExp queryExp = null;
         Set mbeanSet = this.mbeanServer.queryMBeans(query, queryExp);
         if (mbeanSet.size() == 0) {
            if (log.isLoggable(Level.FINE)) log.fine("JMX rename registration from '" + oldName + "' to '" + classNameToChange + "=" + instanceName + "', nothing found for '" + query + "'");
            return count;
         }
         Iterator it = mbeanSet.iterator();
         while (it.hasNext()) {
            ObjectInstance instance = (ObjectInstance)it.next();
            ObjectName tmp = instance.getObjectName();
            JmxMBeanHandle mbeanHandle = (JmxMBeanHandle)this.mbeanMap.get(tmp.toString());
            if (mbeanHandle == null) {
               log.severe("Internal problem: Can't find registration of MBean '" + tmp.toString() + "'");
               continue;
            }
            this.mbeanServer.unregisterMBean(tmp);
            this.mbeanMap.remove(tmp.toString());
            ContextNode renamed = ContextNode.valueOf(tmp.toString());
            renamed.changeParentName(classNameToChange, instanceName);
            if (log.isLoggable(Level.FINE)) log.fine("Renamed '" + oldName + "' to '" + renamed.getAbsoluteName(ContextNode.SCHEMA_JMX) + "'");
            registerMBean(renamed, mbeanHandle.getMBean(), mbeanHandle, true);
            this.mbeanMap.put(mbeanHandle.getObjectInstance().getObjectName().toString(), mbeanHandle);
            count++;
View Full Code Here

      if (useJmx == 0) return null;
      if (contextNode == null) return null; // Remove? code below handles a null
      if (log.isLoggable(Level.FINER)) log.finer("registerMBean(" + contextNode.getAbsoluteName(ContextNode.SCHEMA_JMX) + ")");

      String hierarchy = getObjectNameLiteral(this.glob, contextNode);
      ObjectName objectName = null;
      try {
         objectName = new ObjectName( getObjectNameLiteral(this.glob, contextNode));
         ObjectInstance objectInstance = this.mbeanServer.registerMBean(mbean, objectName);
         if (mbeanHandle == null) {
            mbeanHandle = new JmxMBeanHandle(objectInstance, contextNode, mbean);
            this.mbeanMap.put(objectName.toString(), mbeanHandle);
         }
         else {
             // Update the mbeanHandle of the registrar wit the new ObjectName:
                 mbeanHandle.setObjectInstance(objectInstance);
         }
         if (log.isLoggable(Level.FINE)) log.fine("Registered MBean '" + objectName.toString() +
                                      "' for JMX monitoring and control");
         return mbeanHandle;
      }
      catch (javax.management.InstanceAlreadyExistsException e) {
         if (objectName != null) {
            if (isRename) {
               if (log.isLoggable(Level.FINE)) log.fine("JMX entry exists already, we replace it with new one: " + e.toString());
            }
            else {
               log.warning("JMX entry exists already, we replace it with new one: " + e.toString());
            }
            // this.mbeanMap.remove(objectName.toString()); is done in unregisterMBean
            unregisterMBean(objectName);
            return registerMBean(contextNode, mbean);
         }
         log.warning("Ignoring JMX registration problem for '" + ((objectName==null)?hierarchy:objectName.toString()) + "': " + e.toString());
         return null;
      }
      catch (Exception e) {
         log.severe("JMX registration problem for '" + ((objectName==null)?hierarchy:objectName.toString()) + "': " + e.toString());
         e.printStackTrace();
         return null;
      }
   }
View Full Code Here

      ArrayList s = new ArrayList();

      Object[] params = getParams(s, callString.substring(k+1));
      String[] signature = (String[]) s.toArray(new String[s.size()]);

      ObjectName objectName = null;
      Object returnObject = null;

      try {
         if (log.isLoggable(Level.FINE)) log.fine("get object: '" + callString.substring(0, j));
         objectName = new ObjectName(callString.substring(0, j));
         Set set = mbeanServer.queryNames(objectName, null);
         if(set.size() <= 0)
         {
             log.severe("Instance Not Found");
             return returnObject;
View Full Code Here

   public void startXmlBlasterConnector(MBeanServer mbeanServer) throws XmlBlasterException {
      try {
         if (log.isLoggable(Level.FINER)) log.finer("Registering embedded xmlBlasterConnector for JMX...");

         int port = glob.getProperty().get("xmlBlaster/jmx/XmlBlasterAdaptor/port", 3424);
         ObjectName xmlBlasterConnector_name = new ObjectName("Adaptor:transport=xmlBlaster,port="+port);
         mbeanServer.createMBean("org.xmlBlaster.util.admin.extern.XmlBlasterConnector", xmlBlasterConnector_name, null);
         log.info("Registered JMX xmlBlaster adaptor on port " + port + ", try to start swing GUI 'org.xmlBlaster.jmxgui.Main'");

         // Start the adaptor:
         try {
View Full Code Here

   public boolean isRegistered(ContextNode contextNode) throws XmlBlasterException {
      if (contextNode == null) {
         throw new XmlBlasterException(this.glob, ErrorCode.USER_ILLEGALARGUMENT, "JmxWrapper.isRegistered", "The context node was null");
      }
      try {
         ObjectName objectName = new ObjectName( getObjectNameLiteral(this.glob, contextNode));
         if (this.mbeanServer == null)
            return false;
         return this.mbeanServer.isRegistered(objectName);
      }
      catch (MalformedObjectNameException ex) {
View Full Code Here

          "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi");
      JMXConnector jmxc = JMXConnectorFactory.connect(url, null);

      MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

      ObjectName adaptor = new ObjectName("xBus:mbean=Administrator");

      AdministratorMBean mbeanProxy = JMX.newMBeanProxy(mbsc, adaptor,
          AdministratorMBean.class, true);

      return mbeanProxy;
View Full Code Here

        connector.setThreaded(false);
        connector.setJMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9913/jmxrmi");
        manager.init(policy);
        // setup the fack instrumentation
        AnnotationTestInstrumentation im = new AnnotationTestInstrumentation();
        ObjectName name = JMXUtils.getObjectName(im.getInstrumentationName(),
                                                 im.getUniqueInstrumentationName(),
                                                 BUS_ID);
      
        im.setName("John Smith");         
        manager.processEvent(new InstrumentationCreatedEvent(im));
View Full Code Here

TOP

Related Classes of javax.management.ObjectName

Copyright © 2018 www.massapicom. 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.