Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GEOS-11103] Upgrade Hazelcast dependency to 5.3.1 #1155

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,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<String, TileObject> predicate =
(Predicate<String, TileObject>) e.get("layer_name").equal(layername);
// Creation of the processor
CacheEntryProcessor entryProcessor = new CacheEntryProcessor();
// Execution of the Processor
Expand Down Expand Up @@ -306,7 +307,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 +317,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
Loading