Package org.apache.jcs.engine.control

Examples of org.apache.jcs.engine.control.CompositeCacheManager


    // pronunDict = new PronunDict("data"+GFFinal.FILE_SEP+"pronun.txt");
    logger.info("Load dict is over");

    // init Segment Cache
    try {
      CompositeCacheManager ccm = CompositeCacheManager.getUnconfiguredInstance();
      StringBuffer sb = new StringBuffer();
      Properties props = new Properties();
      sb.append("conf").append(GFFinal.FILE_SEP).append("cache.ccf");
      props.load(new FileInputStream(new File(sb.toString())));
      ccm.configure(props);
      segCache = JCS.getInstance("segCache");
      logger.info("init index��info��seg cache");
    } catch (CacheException e) {
      logger.error("init segment cache is failed", e);
    } catch (IOException e) {
View Full Code Here


  public void testDestroyCacheManager() throws Exception {
    setUpAlternativeConfigurationProperties();
    cacheManagerFactoryBean.createCacheManager();

    CompositeCacheManager cacheManager = getCacheManager();

    assertTrue("There should be at least one cache in the cache manager",
        cacheManager.getCacheNames().length > 0);

    cacheManagerFactoryBean.destroyCacheManager();

    assertTrue("There should not be any cache in the cache manager",
        cacheManager.getCacheNames().length == 0);
  }
View Full Code Here

  }

  private void assertCacheManagerWasConfigured(String cacheName)
      throws Exception {
    // verify that the cache manager was configured.
    CompositeCacheManager cacheManager = getCacheManager();

    assertNotNull(cacheManager);

    // verify that the properties of the configuration file are the same as the
    // ones of the cache manager.
    String maxObjectsProperty = configProperties.getProperty("jcs.region."
        + cacheName + ".cacheattributes.MaxObjects");

    int expected = Integer.parseInt(maxObjectsProperty);

    CompositeCache cache = cacheManager.getCache(cacheName);
    ICompositeCacheAttributes cacheAttributes = cache.getCacheAttributes();
    int actual = cacheAttributes.getMaxObjects();

    assertEquals(expected, actual);
  }
View Full Code Here

      Properties cacheProps = new Properties();
      cacheProps.load(new FileInputStream(confpath));
      if (cacheProps.containsKey(USE_PORTAL_CACHE_KEY) && Boolean.parseBoolean(cacheProps.getProperty(USE_PORTAL_CACHE_KEY))) {
        logDebug("Will not initialize ContentConnector Cache - Using the " + "cache configured by portalnode instead.");
      } else {
        CompositeCacheManager cManager = CompositeCacheManager.getUnconfiguredInstance();
        cManager.configure(cacheProps);
      }
    } catch (NullPointerException e) {
      if (!cacheInitFailed) {
        logError(errorMessage.toString());
        cacheInitFailed = true;
View Full Code Here

    {
        if ( log.isDebugEnabled() )
        {
            log.debug( "handleDispose> cacheName=" + cacheName );
        }
        CompositeCacheManager cm = ( CompositeCacheManager ) cacheMgr;
        cm.freeCache( cacheName, true );
    }
View Full Code Here

    /**
     * Subclass can overrdie this method to create the specific cache manager.
     */
    protected CompositeCacheManager createCacheManager( String prop )
    {
        CompositeCacheManager hub = CompositeCacheManager.getUnconfiguredInstance();

        if ( prop == null )
        {
            hub.configure( "/remote.cache.properties" );
        }
        else
        {
            hub.configure( prop );
        }

        return hub;
    }
View Full Code Here

    }

    /** @see Initializable#initialize */
    public void initialize() throws Exception
    {
        CompositeCacheManager instance = GroupCacheHub.getUnconfiguredInstance();

        instance.configure(
            ConfigurationConverter.getProperties( configuration ) );
    }
View Full Code Here

     * @exception Exception If an error occurs
     */
    public void runTestForRegion( String region )
        throws Exception
    {
        CompositeCacheManager cacheMgr = CompositeCacheManager
            .getUnconfiguredInstance();
        cacheMgr.configure( "/TestDiskCache.ccf" );
        CompositeCache cache = cacheMgr.getCache( region );

        LRUMemoryCache lru = new LRUMemoryCache();
        lru.initialize(cache);

        // Add items to cache
View Full Code Here

    {
        if ( log.isDebugEnabled() )
        {
            log.debug( "handleDispose> cacheName=" + cacheName );
        }
        CompositeCacheManager cm = ( CompositeCacheManager ) cacheMgr;
        cm.freeCache( cacheName, CacheConstants.REMOTE_INVOKATION );
    }
View Full Code Here

    {
        if ( log.isDebugEnabled() )
        {
            log.debug( "handleDispose> cacheName=" + cacheName );
        }
        CompositeCacheManager cm = ( CompositeCacheManager ) cacheMgr;
        cm.freeCache( cacheName, true );
    }
View Full Code Here

TOP

Related Classes of org.apache.jcs.engine.control.CompositeCacheManager

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.