Package com.hazelcast.hibernate.local

Examples of com.hazelcast.hibernate.local.LocalRegionCache


    public CollectionRegion buildCollectionRegion(final String regionName, final Properties properties,
                                                  final CacheDataDescription metadata) throws CacheException {

        HazelcastCollectionRegion<LocalRegionCache> region = new HazelcastCollectionRegion<>(hazelcastInstance,
                regionName, properties, metadata, new LocalRegionCache(regionName, hazelcastInstance, metadata));

        cleanupService.registerCache(region.getCache());
        return region;
    }
View Full Code Here


    public EntityRegion buildEntityRegion(final String regionName, final Properties properties,
                                          final CacheDataDescription metadata) throws CacheException {

        HazelcastEntityRegion<LocalRegionCache> region = new HazelcastEntityRegion<>(hazelcastInstance,
                regionName, properties, metadata, new LocalRegionCache(regionName, hazelcastInstance, metadata));

        cleanupService.registerCache(region.getCache());
        return region;
    }
View Full Code Here

    }

    public CollectionRegion buildCollectionRegion(final String regionName, final Properties properties,
                                                  final CacheDataDescription metadata) throws CacheException {
        final HazelcastCollectionRegion<LocalRegionCache> region = new HazelcastCollectionRegion<LocalRegionCache>(instance,
                regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
        cleanupService.registerCache(region.getCache());
        return region;
    }
View Full Code Here

    }

    public EntityRegion buildEntityRegion(final String regionName, final Properties properties,
                                          final CacheDataDescription metadata) throws CacheException {
        final HazelcastEntityRegion<LocalRegionCache> region = new HazelcastEntityRegion<LocalRegionCache>(instance,
                regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
        cleanupService.registerCache(region.getCache());
        return region;
    }
View Full Code Here

    public HazelcastQueryResultsRegion(final HazelcastInstance instance, final String name, final Properties props) {
        // Note: The HazelcastInstance _must_ be passed down here. Otherwise query caches
        // cannot be configured and will always use defaults. However, even though we're
        // passing the HazelcastInstance, we don't want to use an ITopic for invalidation
        // because the timestamps cache can take care of outdated queries
        super(instance, name, props, new LocalRegionCache(name, instance, null, false));
    }
View Full Code Here

    }

    public CollectionRegion buildCollectionRegion(final String regionName, final Properties properties,
                                                  final CacheDataDescription metadata) throws CacheException {
        final HazelcastCollectionRegion<LocalRegionCache> region = new HazelcastCollectionRegion<LocalRegionCache>(instance,
                regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
        cleanupService.registerCache(region.getCache());
        return region;
    }
View Full Code Here

    }

    public EntityRegion buildEntityRegion(final String regionName, final Properties properties,
                                          final CacheDataDescription metadata) throws CacheException {
        final HazelcastEntityRegion<LocalRegionCache> region = new HazelcastEntityRegion<LocalRegionCache>(instance,
                regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
        cleanupService.registerCache(region.getCache());
        return region;
    }
View Full Code Here

    public HazelcastQueryResultsRegion(final HazelcastInstance instance, final String name, final Properties props) {
        // Note: The HazelcastInstance _must_ be passed down here. Otherwise query caches
        // cannot be configured and will always use defaults. However, even though we're
        // passing the HazelcastInstance, we don't want to use an ITopic for invalidation
        // because the timestamps cache can take care of outdated queries
        super(instance, name, props, new LocalRegionCache(name, instance, null, false));
    }
View Full Code Here

        verify(instance, never()).getTopic(anyString()); // Ensure a topic is not requested
        verify(config, atLeastOnce()).findMapConfig(eq(REGION_NAME));
        verify(mapConfig, times(2)).getTimeToLiveSeconds(); // Should have been retrieved by the region itself

        // Next, load the cache with more entries than the configured max size
        LocalRegionCache regionCache = region.getCache();
        assertNotNull(regionCache);

        int oversized = maxSize * 2;
        for (int i = 0; i < oversized; ++i) {
            regionCache.put(i, i, i);
        }
        assertEquals(oversized, regionCache.size());

        // Lastly run cleanup to apply the configured limits. Note that the TTL is not tested here
        // simply for simplicity (and for the speed of this test)
        LocalRegionCacheTest.runCleanup(regionCache);
        // The default size is 100,000, so if the configuration is ignored no elements will be removed. But
        // if the configuration is applied as expected
        assertTrue(regionCache.size() <= 50);
        verify(mapConfig).getMaxSizeConfig();
        verify(mapConfig, times(3)).getTimeToLiveSeconds(); // Should have been retrieved a second time by the cache
    }
View Full Code Here

    }

    public CollectionRegion buildCollectionRegion(final String regionName, final Properties properties,
                                                  final CacheDataDescription metadata) throws CacheException {
        final HazelcastCollectionRegion<LocalRegionCache> region = new HazelcastCollectionRegion<LocalRegionCache>(instance,
                regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
        cleanupService.registerCache(region.getCache());
        return region;
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.hibernate.local.LocalRegionCache

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.