Search in sources :

Example 1 with SessionStatistics

use of org.apache.geode.modules.session.internal.jmx.SessionStatistics in project geode by apache.

the class GemfireSessionManager method registerMBean.

/**
   * Register a bean for statistic gathering purposes
   */
private void registerMBean() {
    mbean = new SessionStatistics();
    try {
        InitialContext ctx = new InitialContext();
        MBeanServer mbs = MBeanServer.class.cast(ctx.lookup("java:comp/env/jmx/runtime"));
        ObjectName oname = new ObjectName(Constants.SESSION_STATISTICS_MBEAN_NAME);
        mbs.registerMBean(mbean, oname);
    } catch (Exception ex) {
        LOG.warn("Unable to register statistics MBean. Error: {}", ex.getMessage());
    }
}
Also used : SessionStatistics(org.apache.geode.modules.session.internal.jmx.SessionStatistics) InitialContext(javax.naming.InitialContext) EntryNotFoundException(org.apache.geode.cache.EntryNotFoundException) CacheClosedException(org.apache.geode.cache.CacheClosedException) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName)

Aggregations

MBeanServer (javax.management.MBeanServer)1 ObjectName (javax.management.ObjectName)1 InitialContext (javax.naming.InitialContext)1 CacheClosedException (org.apache.geode.cache.CacheClosedException)1 EntryNotFoundException (org.apache.geode.cache.EntryNotFoundException)1 SessionStatistics (org.apache.geode.modules.session.internal.jmx.SessionStatistics)1