Examples of PojoCacheJmxWrapperMBean


Examples of org.jboss.cache.pojo.jmx.PojoCacheJmxWrapperMBean

    */
   private void initializePojoCache() throws Exception
   {
      if (pojoCache == null) {
        
         PojoCacheJmxWrapperMBean pcWrapper = null;
         MBeanServer server = tomcatConfig.getMBeanServer();
         String cfgName = tomcatConfig.getCacheObjectName();
         ObjectName objName = cfgName == null ? null : new ObjectName(tomcatConfig.getCacheObjectName());
         if (server != null && objName != null && server.isRegistered(objName))
         {
            // Get a proxy to the existing TreeCache
            pcWrapper = ((PojoCacheJmxWrapperMBean)
                           MBeanServerInvocationHandler.newProxyInstance(server, objName, PojoCacheJmxWrapperMBean.class, false));
         }
         else
         {
            // See if there is an XML descriptor file to configure the cache
            File configFile = tomcatConfig.getCacheConfigFile();
            String clusterName = tomcatConfig.getClusterName();
           
            if (configFile != null)
            {
               pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(configFile.getAbsolutePath(), false));
               Configuration config = pojoCache.getCache().getConfiguration();
                             
               if (clusterName != null)
               {
                  // Override the XML config with the name provided in
                  // server.xml.  Method setClusterName is specified in the
                  // Cluster interface, otherwise we would not do this
                  config.setClusterName(clusterName);
               }
            }
            else
            {
               // User did not try to configure the cache.
               // Configure it using defaults.  Only exception
               // is the clusterName, which user can specify in server.xml.
               Configuration config = new Configuration();
               String channelName = (clusterName == null) ? DEFAULT_CLUSTER_NAME
                                                          : clusterName;
               config.setClusterName(channelName);
               config.setIsolationLevel(DEFAULT_ISOLATION_LEVEL);
               config.setCacheMode(DEFAULT_CACHE_MODE);
               config.setLockAcquisitionTimeout(DEFAULT_LOCK_TIMEOUT);
               config.setTransactionManagerLookupClass(DEFAULT_TM_LOOKUP);
              
               pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(config, false));
            }
           
            if (server != null && objName != null)
            {
               server.registerMBean(pcWrapper, objName);
            }
           
            pojoCacheLocal = true;
         }
        
         setPojoCache(pcWrapper.getPojoCache());
      }
   }
View Full Code Here

Examples of org.jboss.cache.pojo.jmx.PojoCacheJmxWrapperMBean

    */
   private void initializePojoCache() throws Exception
   {
      if (pojoCache == null) {
        
         PojoCacheJmxWrapperMBean pcWrapper = null;
         MBeanServer server = tomcatConfig.getMBeanServer();
         String cfgName = tomcatConfig.getCacheObjectName();
         ObjectName objName = cfgName == null ? null : new ObjectName(tomcatConfig.getCacheObjectName());
         if (server != null && objName != null && server.isRegistered(objName))
         {
            // Get a proxy to the existing TreeCache
            pcWrapper = ((PojoCacheJmxWrapperMBean)
                           MBeanServerInvocationHandler.newProxyInstance(server, objName, PojoCacheJmxWrapperMBean.class, false));
         }
         else
         {
            // See if there is an XML descriptor file to configure the cache
            File configFile = tomcatConfig.getCacheConfigFile();
            String clusterName = tomcatConfig.getClusterName();
           
            if (configFile != null)
            {
               pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(configFile.getAbsolutePath(), false));
               Configuration config = pojoCache.getCache().getConfiguration();
                             
               if (clusterName != null)
               {
                  // Override the XML config with the name provided in
                  // server.xml.  Method setClusterName is specified in the
                  // Cluster interface, otherwise we would not do this
                  config.setClusterName(clusterName);
               }
            }
            else
            {
               // User did not try to configure the cache.
               // Configure it using defaults.  Only exception
               // is the clusterName, which user can specify in server.xml.
               Configuration config = new Configuration();
               String channelName = (clusterName == null) ? DEFAULT_CLUSTER_NAME
                                                          : clusterName;
               config.setClusterName(channelName);
               config.setIsolationLevel(DEFAULT_ISOLATION_LEVEL);
               config.setCacheMode(DEFAULT_CACHE_MODE);
               config.setLockAcquisitionTimeout(DEFAULT_LOCK_TIMEOUT);
               config.setTransactionManagerLookupClass(DEFAULT_TM_LOOKUP);
              
               pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(config, false));
            }
           
            if (server != null && objName != null)
            {
               server.registerMBean(pcWrapper, objName);
            }
           
            pojoCacheLocal = true;
         }
        
         setPojoCache(pcWrapper.getPojoCache());
      }
   }
View Full Code Here

Examples of org.jboss.cache.pojo.jmx.PojoCacheJmxWrapperMBean

    */
   private void initializePojoCache() throws Exception
   {
      if (pojoCache == null) {
        
         PojoCacheJmxWrapperMBean pcWrapper = null;
         MBeanServer server = tomcatConfig.getMBeanServer();
         String cfgName = tomcatConfig.getCacheObjectName();
         ObjectName objName = cfgName == null ? null : new ObjectName(tomcatConfig.getCacheObjectName());
         if (server != null && objName != null && server.isRegistered(objName))
         {
            // Get a proxy to the existing TreeCache
            pcWrapper = ((PojoCacheJmxWrapperMBean)
                           MBeanServerInvocationHandler.newProxyInstance(server, objName, PojoCacheJmxWrapperMBean.class, false));
         }
         else
         {
            // See if there is an XML descriptor file to configure the cache
            File configFile = tomcatConfig.getCacheConfigFile();
            String clusterName = tomcatConfig.getClusterName();
           
            if (configFile != null)
            {
               pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(configFile.getAbsolutePath(), false));
                             
               if (clusterName != null)
               {
                  // Override the XML config with the name provided in
                  // server.xml.  Method setClusterName is specified in the
                  // Cluster interface, otherwise we would not do this
                  pcWrapper.getPojoCache().getCache().getConfiguration().setClusterName(clusterName);
               }
            }
            else
            {
               // User did not try to configure the cache.
               // Configure it using defaults.  Only exception
               // is the clusterName, which user can specify in server.xml.
               Configuration config = new Configuration();
               String channelName = (clusterName == null) ? DEFAULT_CLUSTER_NAME
                                                          : clusterName;
               config.setClusterName(channelName);
               config.setIsolationLevel(DEFAULT_ISOLATION_LEVEL);
               config.setCacheMode(DEFAULT_CACHE_MODE);
               config.setLockAcquisitionTimeout(DEFAULT_LOCK_TIMEOUT);
               config.setTransactionManagerLookupClass(DEFAULT_TM_LOOKUP);
              
               pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(config, false));
            }
           
            if (server != null && objName != null)
            {
               server.registerMBean(pcWrapper, objName);
            }
           
            pojoCacheLocal = true;
         }
        
         setPojoCache(pcWrapper.getPojoCache());
      }
   }
View Full Code Here

Examples of org.jboss.cache.pojo.jmx.PojoCacheJmxWrapperMBean

    */
   private void initializePojoCache() throws Exception
   {
      if (pojoCache == null) {
        
         PojoCacheJmxWrapperMBean pcWrapper = null;
         MBeanServer server = tomcatConfig.getMBeanServer();
         String cfgName = tomcatConfig.getCacheObjectName();
         ObjectName objName = cfgName == null ? null : new ObjectName(tomcatConfig.getCacheObjectName());
         if (server != null && objName != null && server.isRegistered(objName))
         {
            // Get a proxy to the existing TreeCache
            pcWrapper = ((PojoCacheJmxWrapperMBean)
                           MBeanServerInvocationHandler.newProxyInstance(server, objName, PojoCacheJmxWrapperMBean.class, false));
         }
         else
         {
            // See if there is an XML descriptor file to configure the cache
            File configFile = tomcatConfig.getCacheConfigFile();
            String clusterName = tomcatConfig.getClusterName();
           
            if (configFile != null)
            {
               pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(configFile.getAbsolutePath(), false));
               Configuration config = pojoCache.getCache().getConfiguration();
                             
               if (clusterName != null)
               {
                  // Override the XML config with the name provided in
                  // server.xml.  Method setClusterName is specified in the
                  // Cluster interface, otherwise we would not do this
                  config.setClusterName(clusterName);
               }
            }
            else
            {
               // User did not try to configure the cache.
               // Configure it using defaults.  Only exception
               // is the clusterName, which user can specify in server.xml.
               Configuration config = new Configuration();
               String channelName = (clusterName == null) ? DEFAULT_CLUSTER_NAME
                                                          : clusterName;
               config.setClusterName(channelName);
               config.setIsolationLevel(DEFAULT_ISOLATION_LEVEL);
               config.setCacheMode(DEFAULT_CACHE_MODE);
               config.setLockAcquisitionTimeout(DEFAULT_LOCK_TIMEOUT);
               config.setTransactionManagerLookupClass(DEFAULT_TM_LOOKUP);
              
               pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(config, false));
            }
           
            if (server != null && objName != null)
            {
               server.registerMBean(pcWrapper, objName);
            }
           
            pojoCacheLocal = true;
         }
        
         setPojoCache(pcWrapper.getPojoCache());
      }
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.