Java 类net.sf.ehcache.management.ManagementService 实例源码

项目:shindig-1.1-BETA5-incubating    文件:EhCacheCacheProvider.java   
public void create(boolean jmxEnabled, boolean withCacheStats) {
  /*
   * Add in a shutdown hook
   */
  Runtime.getRuntime().addShutdownHook(new Thread() {
    @Override
    public void run() {
      try {
        shutdown();
      } catch (Throwable t) {
        // I really do want to swallow this, and make the shutdown clean for
        // others
      }
    }
  });

  // register the cache manager with JMX
  if (jmxEnabled) {
    MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
    ManagementService.registerMBeans(cacheManager, mBeanServer, true, true, true, withCacheStats);
  }
}
项目:FinanceAnalytics    文件:CacheManagerComponentFactory.java   
@Override
public void start() {
  MBeanServer mbeanServer = _repo.findInstance(MBeanServer.class);
  if (mbeanServer != null) {
    _jmxService = new ManagementService(_cacheManager, mbeanServer, true, true, true, true);
    try {
      _jmxService.init();
    } catch (CacheException ex) {
      if (ex.getCause() instanceof InstanceAlreadyExistsException == false) {
        throw ex;
      }
    }
  }
}
项目:FinanceAnalytics    文件:SpringInfrastructureComponentFactory.java   
protected void registerJmxCacheManager(ComponentRepository repo) {
  MBeanServer jmx = repo.findInstance(MBeanServer.class);
  if (jmx != null) {
    Set<CacheManager> set = Collections.newSetFromMap(new IdentityHashMap<CacheManager, Boolean>());
    set.addAll(repo.getInstances(CacheManager.class));
    for (CacheManager mgr : set) {
      ManagementService jmxService = new ManagementService(mgr, jmx, true, true, true, true);
      repo.registerLifecycle(new CacheManagerLifecycle(jmxService));
    }
  }
}
项目:eHMP    文件:CacheMgr.java   
public synchronized static CacheManager getEHCacheManager() {
    // lazy-init
    if (MANAGER == null) {
        MANAGER = CacheManager.create();

        // register MBean
        MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        ManagementService.registerMBeans(MANAGER, mBeanServer, true, true, true, true);
    }
    return MANAGER;
}
项目:eHMP    文件:CacheMgr.java   
public synchronized static CacheManager getEHCacheManager() {
    // lazy-init
    if (MANAGER == null) {
        MANAGER = CacheManager.create();

        // register MBean
        MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        ManagementService.registerMBeans(MANAGER, mBeanServer, true, true, true, true);
    }
    return MANAGER;
}
项目:iris    文件:CacheMBeanConfiguration.java   
@Bean
public String dummyBean(MBeanServer mBeanServer, CacheManager cacheManager) {

    // This check is only relevant for running integration tests which reuse a application context
    if (!Arrays.asList(mBeanServer.getDomains()).contains("net.sf.ehcache")) {
        ManagementService.registerMBeans(cacheManager, mBeanServer, true, true, true, true, true);
    }

    return "dummyBean";
}
项目:stability-utils    文件:EhcacheJmxBootstrapper.java   
@PostConstruct
public void init()
{
    // The CacheManager has a static List of all CM instances.
    for(CacheManager cacheMgr : CacheManager.ALL_CACHE_MANAGERS)
    {
        ManagementService.registerMBeans(cacheMgr, mbeanServer, registerManager, registerCaches, registerConfigurations, registerStatistics);
        logger.info("Registering EhCache CacheManager with MBean server " + cacheMgr.getName());
    }
}
项目:wicket-spring-jpa-bootstrap-boilerplate    文件:PersistenceApplicationConfiguration.java   
@Bean(destroyMethod="dispose",initMethod="init")
//@Lazy(value=false) 
//-- also enable statistics in ehcache.xml
@DependsOn(value = {"ehCacheManagerFactoryBean","mbeanServer"})
public ManagementService ehCacheManagementService() {
    ManagementService managementService = new ManagementService(cacheManager, mbeanServer, true, true, true, true);
    return managementService;
}
项目:lutece-core    文件:CacheService.java   
/**
 * Init JMX monitoring configuration
 */
private void initJmxMonitoring( )
{
    MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer( );

    boolean bRegisterCacheManager = AppPropertiesService.getProperty( PROPERTY_MONITOR_CACHE_MANAGER, FALSE ).equals( TRUE );
    boolean bRegisterCaches = AppPropertiesService.getProperty( PROPERTY_MONITOR_CACHES, FALSE ).equals( TRUE );
    boolean bRegisterCacheConfigurations = AppPropertiesService.getProperty( PROPERTY_MONITOR_CACHE_CONFIGURATIONS, FALSE ).equals( TRUE );
    boolean bRegisterCacheStatistics = AppPropertiesService.getProperty( PROPERTY_MONITOR_CACHE_STATISTICS, FALSE ).equals( TRUE );
    ManagementService
            .registerMBeans( _manager, mBeanServer, bRegisterCacheManager, bRegisterCaches, bRegisterCacheConfigurations, bRegisterCacheStatistics );
}
项目:otus_java_2017_06    文件:DBServiceImpl.java   
private void registerCacheMBean() {
    CacheManager manager = CacheManager.getCacheManager(CacheManager.DEFAULT_NAME);
    MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
    ManagementService.registerMBeans(manager, mBeanServer, false, false, true, true);
}
项目:otus_java_2017_04    文件:DBServiceImpl.java   
private void registerCacheMBean() {
    CacheManager manager = CacheManager.getCacheManager(CacheManager.DEFAULT_NAME);
    MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
    ManagementService.registerMBeans(manager, mBeanServer, false, false, true, true);
}
项目:FinanceAnalytics    文件:SpringInfrastructureComponentFactory.java   
CacheManagerLifecycle(ManagementService jmxService) {
  _jmxService = jmxService;
}
项目:sakai    文件:EhCacheJmxRegistration.java   
public void register(CacheManager cacheManager)
{
    log.info("Registering Cache Provider with JMXBeanServer "+mBeanServer);
    ManagementService.registerMBeans(cacheManager, mBeanServer, registerCacheManager,
            registerCaches, registerCacheConfigurations, registerCacheStatistics);
}
项目:olat    文件:CacheInitMBean.java   
private void register() {
    // register ehcache as MBean
    ManagementService.registerMBeans(CacheManager.getInstance(), server, true, true, true, true);
}
项目:olat    文件:CacheInitMBean.java   
private void register() {
    // register ehcache as MBean
    ManagementService.registerMBeans(CacheManager.getInstance(), server, true, true, true, true);
}
项目:sakai    文件:EhCacheJmxRegistration.java   
public void register(CacheManager cacheManager)
{
    log.info("Registering Cache Provider with JMXBeanServer "+mBeanServer);
    ManagementService.registerMBeans(cacheManager, mBeanServer, registerCacheManager,
            registerCaches, registerCacheConfigurations, registerCacheStatistics);
}