Skip to content

Commit

Permalink
[GEOS-11103] Upgrade Hazelcast dependency to 5.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandor777 committed Aug 23, 2023
1 parent 4c28db4 commit 9913b5a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -155,7 +154,7 @@ public void removeLayer(String layername) {
LOGGER.fine("Removing Layer:" + layername);
}
// Creation of the Predicate
EntryObject e = new PredicateBuilder().getEntryObject();
PredicateBuilder.EntryObject e = new PredicateBuilderImpl().getEntryObject();
Predicate predicate = e.get("layer_name").equal(layername);
// Creation of the processor
CacheEntryProcessor entryProcessor = new CacheEntryProcessor();
Expand Down Expand Up @@ -306,7 +305,7 @@ public HazelcastCacheStatistics(LocalMapStats localMapStats, long totalSize) {
*
* @author Nicola Lagomarsini Geosolutions
*/
static class CacheEntryProcessor implements EntryProcessor<String, TileObject> {
static class CacheEntryProcessor implements EntryProcessor<String, TileObject, Object> {

@Override
public Object process(Entry<String, TileObject> entry) {
Expand All @@ -316,7 +315,7 @@ public Object process(Entry<String, TileObject> entry) {
}

@Override
public EntryBackupProcessor<String, TileObject> getBackupProcessor() {
public EntryProcessor<String, TileObject, Object> getBackupProcessor() {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion geowebcache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<test.maxHeapSize>64M</test.maxHeapSize>
<maven.test.jvmargs></maven.test.jvmargs>
<imageio-ext.version>1.4.7</imageio-ext.version>
<hazelcast.version>3.11-BETA-1</hazelcast.version>
<hazelcast.version>5.3.1</hazelcast.version>
<joda-time.version>2.8.1</joda-time.version>
<spotless.action>apply</spotless.action>
<spotless.apply.skip>false</spotless.apply.skip>
Expand Down

0 comments on commit 9913b5a

Please sign in to comment.