Search in sources :

Example 1 with AllAccountsMBeanImpl

use of org.ow2.proactive.scheduler.core.jmx.mbean.AllAccountsMBeanImpl in project scheduling by ow2-proactive.

the class RMJMXHelper method registerMBeans.

/**
 * {@inheritDoc}
 */
@Override
public void registerMBeans(final MBeanServer mbs) {
    // Register all mbeans into the server
    try {
        final RuntimeDataMBean anonymMBean = new RuntimeDataMBeanImpl(RMMonitoringImpl.rmStatistics);
        // Uniquely identify the MBean and register it to the MBeanServer
        final ObjectName name = new ObjectName(RMJMXBeans.RUNTIMEDATA_MBEAN_NAME);
        mbs.registerMBean(anonymMBean, name);
        String dataBaseName = PAResourceManagerProperties.RM_HOME.getValueAsString() + System.getProperty("file.separator") + PAResourceManagerProperties.RM_RRD_DATABASE_NAME.getValueAsString();
        FileUtils.forceMkdir(new File(dataBaseName).getParentFile());
        setDataStore(new RRDDataStore((StandardMBean) anonymMBean, dataBaseName, PAResourceManagerProperties.RM_RRD_STEP.getValueAsInt(), Logger.getLogger(RMJMXHelper.class)));
    } catch (Exception e) {
        LOGGER.error("Unable to register the ResourceManagerRuntimeMBean", e);
    }
    // Register the MyAccount MBean into the MBean server
    try {
        final MyAccountMBeanImpl myAccountMBean = new MyAccountMBeanImpl(this.accountsManager);
        final ObjectName name = new ObjectName(RMJMXBeans.MYACCOUNT_MBEAN_NAME);
        mbs.registerMBean(myAccountMBean, name);
    } catch (Exception e) {
        LOGGER.error("Unable to register the MyAccountMBean", e);
    }
    // Register the ViewAccount MBean into the MBean server
    try {
        final AllAccountsMBeanImpl viewAccountMBean = new AllAccountsMBeanImpl(this.accountsManager);
        final ObjectName name = new ObjectName(RMJMXBeans.ALLACCOUNTS_MBEAN_NAME);
        mbs.registerMBean(viewAccountMBean, name);
    } catch (Exception e) {
        LOGGER.error("Unable to register the AllAccountsMBean", e);
    }
    // Register the Management MBean into the MBean server
    try {
        final ManagementMBeanImpl managementMBean = new ManagementMBeanImpl(this.accountsManager);
        final ObjectName name = new ObjectName(RMJMXBeans.MANAGEMENT_MBEAN_NAME);
        mbs.registerMBean(managementMBean, name);
    } catch (Exception e) {
        LOGGER.error("Unable to register the ManagementMBean", e);
    }
}
Also used : AllAccountsMBeanImpl(org.ow2.proactive.resourcemanager.core.jmx.mbean.AllAccountsMBeanImpl) MyAccountMBeanImpl(org.ow2.proactive.resourcemanager.core.jmx.mbean.MyAccountMBeanImpl) RuntimeDataMBeanImpl(org.ow2.proactive.resourcemanager.core.jmx.mbean.RuntimeDataMBeanImpl) StandardMBean(javax.management.StandardMBean) ManagementMBeanImpl(org.ow2.proactive.resourcemanager.core.jmx.mbean.ManagementMBeanImpl) RRDDataStore(org.ow2.proactive.jmx.RRDDataStore) RuntimeDataMBean(org.ow2.proactive.resourcemanager.core.jmx.mbean.RuntimeDataMBean) File(java.io.File) ObjectName(javax.management.ObjectName)

Example 2 with AllAccountsMBeanImpl

use of org.ow2.proactive.scheduler.core.jmx.mbean.AllAccountsMBeanImpl in project scheduling by ow2-proactive.

the class SchedulerJMXHelper method registerMBeans.

/**
 * {@inheritDoc}
 */
@Override
public void registerMBeans(final MBeanServer mbs) {
    // Register the Scheduler runtime MBean into the MBean server
    try {
        this.schedulerRuntimeMBean = new RuntimeDataMBeanImpl(dbManager);
        final ObjectName name = new ObjectName(RUNTIMEDATA_MBEAN_NAME);
        mbs.registerMBean(this.schedulerRuntimeMBean, name);
        String dataBaseName = PASchedulerProperties.SCHEDULER_HOME.getValueAsString() + System.getProperty("file.separator") + PASchedulerProperties.SCHEDULER_RRD_DATABASE_NAME.getValueAsString();
        FileUtils.forceMkdir(new File(dataBaseName).getParentFile());
        if (PASchedulerProperties.SCHEDULER_DB_HIBERNATE_DROPDB.getValueAsBoolean()) {
            // dropping the RDD data base
            File rrdDataBase = new File(dataBaseName);
            if (rrdDataBase.exists()) {
                rrdDataBase.delete();
            }
        }
        setDataStore(new RRDDataStore((StandardMBean) schedulerRuntimeMBean, dataBaseName, PASchedulerProperties.SCHEDULER_RRD_STEP.getValueAsInt(), Logger.getLogger(SchedulerJMXHelper.class)));
    } catch (Exception e) {
        LOGGER.error("Unable to register the RuntimeDataMBean", e);
    }
    // Register the MyAccount MBean into the MBean server
    try {
        final MyAccountMBeanImpl myAccountMBean = new MyAccountMBeanImpl(this.accountsManager);
        final ObjectName name = new ObjectName(MYACCOUNT_MBEAN_NAME);
        mbs.registerMBean(myAccountMBean, name);
    } catch (Exception e) {
        LOGGER.error("Unable to register the MyAccountMBean", e);
    }
    // Register the ViewAccount MBean into the MBean server
    try {
        final AllAccountsMBeanImpl viewAccountMBean = new AllAccountsMBeanImpl(this.accountsManager);
        final ObjectName name = new ObjectName(ALLACCOUNTS_MBEAN_NAME);
        mbs.registerMBean(viewAccountMBean, name);
    } catch (Exception e) {
        LOGGER.error("Unable to register the AllAccountsMBean", e);
    }
    // Register the Management MBean into the MBean server
    try {
        final ManagementMBeanImpl managementMBean = new ManagementMBeanImpl(this.accountsManager);
        final ObjectName name = new ObjectName(MANAGEMENT_MBEAN_NAME);
        mbs.registerMBean(managementMBean, name);
    } catch (Exception e) {
        LOGGER.error("Unable to register the ManagementMBean", e);
    }
}
Also used : AllAccountsMBeanImpl(org.ow2.proactive.scheduler.core.jmx.mbean.AllAccountsMBeanImpl) MyAccountMBeanImpl(org.ow2.proactive.scheduler.core.jmx.mbean.MyAccountMBeanImpl) RuntimeDataMBeanImpl(org.ow2.proactive.scheduler.core.jmx.mbean.RuntimeDataMBeanImpl) StandardMBean(javax.management.StandardMBean) ManagementMBeanImpl(org.ow2.proactive.scheduler.core.jmx.mbean.ManagementMBeanImpl) RRDDataStore(org.ow2.proactive.jmx.RRDDataStore) File(java.io.File) ObjectName(javax.management.ObjectName)

Aggregations

File (java.io.File)2 ObjectName (javax.management.ObjectName)2 StandardMBean (javax.management.StandardMBean)2 RRDDataStore (org.ow2.proactive.jmx.RRDDataStore)2 AllAccountsMBeanImpl (org.ow2.proactive.resourcemanager.core.jmx.mbean.AllAccountsMBeanImpl)1 ManagementMBeanImpl (org.ow2.proactive.resourcemanager.core.jmx.mbean.ManagementMBeanImpl)1 MyAccountMBeanImpl (org.ow2.proactive.resourcemanager.core.jmx.mbean.MyAccountMBeanImpl)1 RuntimeDataMBean (org.ow2.proactive.resourcemanager.core.jmx.mbean.RuntimeDataMBean)1 RuntimeDataMBeanImpl (org.ow2.proactive.resourcemanager.core.jmx.mbean.RuntimeDataMBeanImpl)1 AllAccountsMBeanImpl (org.ow2.proactive.scheduler.core.jmx.mbean.AllAccountsMBeanImpl)1 ManagementMBeanImpl (org.ow2.proactive.scheduler.core.jmx.mbean.ManagementMBeanImpl)1 MyAccountMBeanImpl (org.ow2.proactive.scheduler.core.jmx.mbean.MyAccountMBeanImpl)1 RuntimeDataMBeanImpl (org.ow2.proactive.scheduler.core.jmx.mbean.RuntimeDataMBeanImpl)1