Package javax.management

Examples of javax.management.MBeanServer


    private void start(String props, String cluster_name,
                       long rpc_timeout, long caching_time, boolean migrate_data, boolean use_l1_cache,
                       int l1_max_entries, long l1_reaping_interval,
                       int l2_max_entries, long l2_reaping_interval) throws Exception {
        MBeanServer server=ManagementFactory.getPlatformMBeanServer();

        cache=new ReplCache<String,String>(props, cluster_name);
        cache.setCallTimeout(rpc_timeout);
        cache.setCachingTime(caching_time);
        cache.setMigrateData(migrate_data);
View Full Code Here


    @ManagedOperation(description="Lifecycle operation. Called after create(). When this method is called, "
            + "the managed attributes have already been set. Brings the Router into a fully functional state.")
    public void start() throws Exception {
        if(running.compareAndSet(false, true)) {          
            if(jmx && !registered) {
                MBeanServer server=Util.getMBeanServer();
                JmxConfigurator.register(this, server, "jgroups:name=GossipRouter");
                registered=true;
            }
   
            if(bindAddressString != null) {
View Full Code Here

    public static MBeanServer getMBeanServer() {
    ArrayList servers = MBeanServerFactory.findMBeanServer(null);
    if (servers != null && !servers.isEmpty()) {
      // return 'jboss' server if available
      for (int i = 0; i < servers.size(); i++) {
        MBeanServer srv = (MBeanServer) servers.get(i);
        if ("jboss".equalsIgnoreCase(srv.getDefaultDomain()))
          return srv;
      }

      // return first available server
      return (MBeanServer) servers.get(0);
View Full Code Here

    }
  }


    public static void registerChannel(JChannel channel, String name) {
        MBeanServer server=Util.getMBeanServer();
        if(server != null) {
            try {
                JmxConfigurator.registerChannel(channel,
                                                server,
                                                (name != null? name : "jgroups"),
View Full Code Here

            return acceptor;
        }
    }

    private static void setupMonitor(IoAcceptor service) {
        final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        try {
            server.registerMBean(new IoServiceMBean(service), new ObjectName("org.apache.mina:type=service,name="
                    + SRV_NAME));
        } catch (InstanceAlreadyExistsException iaee) {
            throw new IllegalStateException(iaee);
        } catch (MBeanRegistrationException mre) {
            throw new IllegalStateException(mre);
View Full Code Here

    protected Log logger = LogFactory.getLog(getClass());

    public MBeanServer getMBeanServer() {
        for (Iterator it = MBeanServerFactory.findMBeanServer(null).iterator(); it.hasNext();) {
            MBeanServer server = (MBeanServer) it.next();
            if ("jboss".equals(server.getDefaultDomain())) {
                return server;
            }
        }
        return null;
    }
View Full Code Here

    public List getApplicationResources() throws NamingException {

        List resources = new ArrayList();

        MBeanServer server = getMBeanServer();
        if (server != null) {
            try {
                Set dsNames = server.queryNames(new ObjectName("jboss.jca:service=ManagedConnectionPool,*"), null);
                for (Iterator it = dsNames.iterator(); it.hasNext();) {
                    ObjectName managedConnectionPoolOName = (ObjectName) it.next();

                    ApplicationResource resource = new ApplicationResource();
                    resource.setName(managedConnectionPoolOName.getKeyProperty("name"));
                    resource.setType("jboss");
                    String criteria = (String) server.getAttribute(managedConnectionPoolOName, "Criteria");
                    if ("ByApplication".equals(criteria)) {
                        resource.setAuth("Application");
                    } else if ("ByContainerAndApplication".equals(criteria)) {
                        resource.setAuth("Both");
                    } else {
                        resource.setAuth("Container");
                    }
                    DataSourceInfo dsInfo = new DataSourceInfo();
                    dsInfo.setMaxConnections(((Integer) server.getAttribute(managedConnectionPoolOName, "MaxSize")).intValue());
                    dsInfo.setEstablishedConnections(((Integer) server.getAttribute(managedConnectionPoolOName, "ConnectionCount")).intValue());
                    dsInfo.setBusyConnections(((Long) server.getAttribute(managedConnectionPoolOName, "InUseConnectionCount")).intValue());


                    ObjectName connectionFactoryOName = new ObjectName("jboss.jca:service=ManagedConnectionFactory,name=" + resource.getName());
                    Element elm = (Element) server.getAttribute(connectionFactoryOName, "ManagedConnectionFactoryProperties");

                    if (elm != null) {
                        NodeList nl = elm.getChildNodes();
                        for (int i = 0; i < nl.getLength(); i++) {
                            Node n = nl.item(i);
View Full Code Here

    }

    public boolean resetResource(Context context, String resourceName) throws NamingException {
        try {
            ObjectName poolOName = new ObjectName("jboss.jca:service=ManagedConnectionPool,name="+resourceName);
            MBeanServer server = getMBeanServer();
            if (server != null) {
                try {
                    server.invoke(poolOName, "stop", null, null);
                    server.invoke(poolOName, "start", null, null);
                    return true;
                } catch (Exception e) {
                    logger.error("Could not reset resource \""+resourceName+"\"", e);
                }
            }
View Full Code Here

  }
 
 
  private static Collection<ConfigPropertyMetaData> getRarProperties(String rarName){
    try {
      MBeanServer server = MBeanServerFactory.findMBeanServer(null).get(0);
      ObjectName on = new ObjectName("jboss.jca:service=RARDeployment,name='"+rarName+"'");//$NON-NLS-1$  //$NON-NLS-2$ 
      ConnectorMetaData obj = (ConnectorMetaData)server.getAttribute(on, "MetaData");//$NON-NLS-1$ 
      ConnectionDefinitionMetaData metadata = obj.getConnectionDefinition(ConnectionFactory.class.getName());
      if (metadata != null) {
        return metadata.getProperties();
      }
    } catch (MalformedObjectNameException e) {
View Full Code Here

 
  private boolean shutdownInProgress = false;
 
  public JBossLifeCycleListener() {
    try {
      MBeanServer server = MBeanServerFactory.findMBeanServer(null).get(0);
      ObjectName on = new ObjectName("jboss.system:type=Server"); //$NON-NLS-1$
      server.addNotificationListener(on, this, null, null);
    } catch (MalformedObjectNameException e) {
      //ignore
    } catch (InstanceNotFoundException e) {
      //ignore
    }
View Full Code Here

TOP

Related Classes of javax.management.MBeanServer

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.