Package javax.util.jcache

Examples of javax.util.jcache.Cache


    public void testResetCache() throws Exception {
        CacheAccessFactory factory = CacheAccessFactory.getInstance();
        CacheAttributes catt = CacheAttributes.getDefaultCacheAttributes();
        catt.setLocal();
        catt.setCleanInterval(1);
        Cache cache = factory.getCache(false);
        //
        cache.init(catt);
        //        CacheSweeper.startSweeper executes
        //        within CacheSweeper.getInstance
        //
        CacheSweeper instance = CacheSweeper.getInstance();
       
        cache.close();
        //        CacheSweeper.stopSweeper executes
        //
        cache = factory.getCache(false);
        //
        cache.init(catt);
        CacheSweeper instance2= CacheSweeper.getInstance();
        assertNotSame(instance, instance2);
        //        CacheSweeper.startSweeper does not
        //        execute within CacheSweeper.getInstance
        //        because CacheSweeper instance is not null
View Full Code Here


    final public void testSetMaxObjects() throws Exception {
        CacheAttributes ca = CacheAttributes.getDefaultCacheAttributes();
        ca.setMaxObjects(5);
        ca.setLocal();
        CacheAccessFactory factory = CacheAccessFactory.getInstance();
        Cache cache = factory.getCache();
        cache.close();
        cache.init(ca);
        Map map = factory.getMapAccess();
        int max=5;
        for(int i=0; i<max; i++) {
            map.put(""+i, new Object());
        }
View Full Code Here

    }

    private void initJCacheMap()  {
        try {
            CacheAccessFactory factory = CacheAccessFactory.getInstance();
            Cache cache = factory.getCache(false);
            CacheAttributes attributes = CacheAttributes.getDefaultCacheAttributes();
            attributes.setLocal();
            attributes.setMaxObjects(100000000);
            cache.init(attributes);
            this.jcache= factory.getMapAccess();
        } catch (CacheNotAvailableException e) {
            throw new IllegalStateException(e.getMessage());
        } catch (CacheException e) {
            throw new IllegalStateException(e.getMessage());
View Full Code Here

TOP

Related Classes of javax.util.jcache.Cache

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.