diff --git a/geowebcache/distributed/src/main/java/org/geowebcache/storage/blobstore/memory/distributed/HazelcastCacheProvider.java b/geowebcache/distributed/src/main/java/org/geowebcache/storage/blobstore/memory/distributed/HazelcastCacheProvider.java index 3d52b51b3..afdfa092c 100644 --- a/geowebcache/distributed/src/main/java/org/geowebcache/storage/blobstore/memory/distributed/HazelcastCacheProvider.java +++ b/geowebcache/distributed/src/main/java/org/geowebcache/storage/blobstore/memory/distributed/HazelcastCacheProvider.java @@ -14,13 +14,12 @@ */ package org.geowebcache.storage.blobstore.memory.distributed; -import com.hazelcast.core.IMap; -import com.hazelcast.map.EntryBackupProcessor; import com.hazelcast.map.EntryProcessor; -import com.hazelcast.monitor.LocalMapStats; -import com.hazelcast.query.EntryObject; +import com.hazelcast.map.IMap; +import com.hazelcast.map.LocalMapStats; import com.hazelcast.query.Predicate; import com.hazelcast.query.PredicateBuilder; +import com.hazelcast.query.impl.PredicateBuilderImpl; import java.util.Collections; import java.util.List; import java.util.Map.Entry; @@ -81,7 +80,7 @@ public HazelcastCacheProvider(HazelcastLoader loader) { loader.getInstance() .getConfig() .getMapConfig(HAZELCAST_MAP_DEFINITION) - .getMaxSizeConfig() + .getEvictionConfig() .getSize() * MB_TO_BYTES; if (LOGGER.isLoggable(Level.FINE)) { @@ -155,8 +154,10 @@ public void removeLayer(String layername) { LOGGER.fine("Removing Layer:" + layername); } // Creation of the Predicate - EntryObject e = new PredicateBuilder().getEntryObject(); - Predicate predicate = e.get("layer_name").equal(layername); + PredicateBuilder.EntryObject e = new PredicateBuilderImpl().getEntryObject(); + @SuppressWarnings("unchecked") + Predicate predicate = + (Predicate) e.get("layer_name").equal(layername); // Creation of the processor CacheEntryProcessor entryProcessor = new CacheEntryProcessor(); // Execution of the Processor @@ -306,7 +307,7 @@ public HazelcastCacheStatistics(LocalMapStats localMapStats, long totalSize) { * * @author Nicola Lagomarsini Geosolutions */ - static class CacheEntryProcessor implements EntryProcessor { + static class CacheEntryProcessor implements EntryProcessor { @Override public Object process(Entry entry) { @@ -316,7 +317,7 @@ public Object process(Entry entry) { } @Override - public EntryBackupProcessor getBackupProcessor() { + public EntryProcessor getBackupProcessor() { return null; } } diff --git a/geowebcache/distributed/src/main/java/org/geowebcache/storage/blobstore/memory/distributed/HazelcastLoader.java b/geowebcache/distributed/src/main/java/org/geowebcache/storage/blobstore/memory/distributed/HazelcastLoader.java index 65dcda906..f20246cff 100644 --- a/geowebcache/distributed/src/main/java/org/geowebcache/storage/blobstore/memory/distributed/HazelcastLoader.java +++ b/geowebcache/distributed/src/main/java/org/geowebcache/storage/blobstore/memory/distributed/HazelcastLoader.java @@ -16,7 +16,7 @@ import com.hazelcast.config.Config; import com.hazelcast.config.MapConfig; -import com.hazelcast.config.MaxSizeConfig; +import com.hazelcast.config.MaxSizePolicy; import com.hazelcast.config.NearCacheConfig; import com.hazelcast.config.XmlConfigBuilder; import com.hazelcast.core.Hazelcast; @@ -134,12 +134,13 @@ private boolean configAccepted(Config config) { MapConfig mapConfig = config.getMapConfig(HazelcastCacheProvider.HAZELCAST_MAP_DEFINITION); // Check size policy - boolean sizeDefined = mapConfig.getMaxSizeConfig().getSize() > 0; + boolean sizeDefined = mapConfig.getEvictionConfig().getSize() > 0; boolean policyExists = - mapConfig.getEvictionPolicy() != MapConfig.DEFAULT_EVICTION_POLICY; + mapConfig.getEvictionConfig().getEvictionPolicy() + != MapConfig.DEFAULT_EVICTION_POLICY; boolean sizeFromHeap = - mapConfig.getMaxSizeConfig().getMaxSizePolicy() - == MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE; + mapConfig.getEvictionConfig().getMaxSizePolicy() + == MaxSizePolicy.USED_HEAP_SIZE; // Check Near Cache size boolean nearCacheAccepted = true; diff --git a/geowebcache/distributed/src/test/java/org/geowebcache/blobstore/memory/distributed/HazelcastCacheProviderTest.java b/geowebcache/distributed/src/test/java/org/geowebcache/blobstore/memory/distributed/HazelcastCacheProviderTest.java index 51b729d24..971ed0f62 100644 --- a/geowebcache/distributed/src/test/java/org/geowebcache/blobstore/memory/distributed/HazelcastCacheProviderTest.java +++ b/geowebcache/distributed/src/test/java/org/geowebcache/blobstore/memory/distributed/HazelcastCacheProviderTest.java @@ -20,9 +20,9 @@ import static org.junit.Assert.fail; import com.hazelcast.config.Config; +import com.hazelcast.config.TcpIpConfig; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; -import com.hazelcast.instance.HazelcastInstanceFactory; import java.io.IOException; import java.io.InputStream; import java.net.UnknownHostException; @@ -77,9 +77,12 @@ public class HazelcastCacheProviderTest { public static void initialSetup() throws UnknownHostException { Config config = new Config(); config.getMapConfig("default").setBackupCount(1).setAsyncBackupCount(0); - HazelcastInstance h1 = HazelcastInstanceFactory.newHazelcastInstance(new Config()); - HazelcastInstance h2 = HazelcastInstanceFactory.newHazelcastInstance(new Config()); - + config.setClusterName("gwc"); + TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig(); + tcpIpConfig.setEnabled(true); + tcpIpConfig.getMembers().add("localhost"); + HazelcastInstance h1 = Hazelcast.newHazelcastInstance(config); + HazelcastInstance h2 = Hazelcast.newHazelcastInstance(config); // Create a nullblobstore to add to the memory blobstore NullBlobStore nbs = new NullBlobStore(); diff --git a/geowebcache/pom.xml b/geowebcache/pom.xml index b2ed59c13..de578e3ab 100644 --- a/geowebcache/pom.xml +++ b/geowebcache/pom.xml @@ -76,7 +76,7 @@ 64M 1.4.7 - 3.11-BETA-1 + 5.3.1 2.8.1 apply false