Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetmircik committed Jul 16, 2019
1 parent 36630b8 commit f60b052
Show file tree
Hide file tree
Showing 122 changed files with 520 additions and 5,528 deletions.
Expand Up @@ -143,8 +143,9 @@ public Config addMapConfig(MapConfig mapConfig) {
ClientMessage request = DynamicConfigAddMapConfigCodec.encodeRequest(mapConfig.getName(),
mapConfig.getBackupCount(), mapConfig.getAsyncBackupCount(), mapConfig.getTimeToLiveSeconds(),
mapConfig.getMaxIdleSeconds(), mapConfig.getEvictionPolicy().name(), mapConfig.isReadBackupData(),
mapConfig.getCacheDeserializedValues().name(), mapConfig.getMergePolicy(), mapConfig.getInMemoryFormat().name(),
listenerConfigs, partitionLostListenerConfigs, mapConfig.isStatisticsEnabled(), mapConfig.getQuorumName(),
mapConfig.getCacheDeserializedValues().name(), mapConfig.getMergePolicyConfig().getPolicy(),
mapConfig.getInMemoryFormat().name(), listenerConfigs, partitionLostListenerConfigs,
mapConfig.isStatisticsEnabled(), mapConfig.getQuorumName(),
serializationService.toData(mapConfig.getMapEvictionPolicy()),
mapConfig.getMaxSizeConfig().getMaxSizePolicy().name(), mapConfig.getMaxSizeConfig().getSize(),
MapStoreConfigHolder.of(mapConfig.getMapStoreConfig(), serializationService),
Expand Down
Expand Up @@ -18,49 +18,51 @@

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.test.TestHazelcastFactory;
import com.hazelcast.config.ListenerConfig;
import com.hazelcast.core.EntryAdapter;
import com.hazelcast.core.EntryEvent;
import com.hazelcast.core.EntryView;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.collection.IList;
import com.hazelcast.map.IMap;
import com.hazelcast.topic.ITopic;
import com.hazelcast.collection.IQueue;
import com.hazelcast.collection.ISet;
import com.hazelcast.collection.ItemEvent;
import com.hazelcast.collection.ItemListener;
import com.hazelcast.config.ListenerConfig;
import com.hazelcast.core.EntryAdapter;
import com.hazelcast.core.EntryEvent;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.LifecycleEvent;
import com.hazelcast.core.LifecycleListener;
import com.hazelcast.topic.Message;
import com.hazelcast.topic.MessageListener;
import com.hazelcast.instance.impl.Node;
import com.hazelcast.map.impl.EntryViews;
import com.hazelcast.map.IMap;
import com.hazelcast.map.impl.MapService;
import com.hazelcast.map.impl.operation.LegacyMergeOperation;
import com.hazelcast.map.impl.operation.MergeOperation;
import com.hazelcast.map.impl.record.Record;
import com.hazelcast.map.listener.EntryMergedListener;
import com.hazelcast.map.merge.PassThroughMergePolicy;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.nio.serialization.Portable;
import com.hazelcast.nio.serialization.PortableFactory;
import com.hazelcast.spi.impl.NodeEngineImpl;
import com.hazelcast.spi.impl.operationservice.Operation;
import com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl;
import com.hazelcast.spi.merge.PassThroughMergePolicy;
import com.hazelcast.spi.merge.SplitBrainMergeTypes;
import com.hazelcast.spi.serialization.SerializationService;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.annotation.ParallelJVMTest;
import com.hazelcast.test.annotation.QuickTest;
import com.hazelcast.topic.ITopic;
import com.hazelcast.topic.Message;
import com.hazelcast.topic.MessageListener;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.mockito.Mockito;

import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;

import static com.hazelcast.spi.impl.merge.MergingValueFactory.createMergingEntry;
import static org.junit.Assert.assertTrue;

@RunWith(HazelcastParallelClassRunner.class)
Expand Down Expand Up @@ -126,12 +128,13 @@ public void entryMerged(EntryEvent<Object, Object> event) {

Node node = getNode(server);
NodeEngineImpl nodeEngine = node.nodeEngine;
OperationServiceImpl operationService = (OperationServiceImpl) nodeEngine.getOperationService();
OperationServiceImpl operationService = nodeEngine.getOperationService();
SerializationService serializationService = getSerializationService(server);
Data key = serializationService.toData(1);
Data value = serializationService.toData(new ClientRegressionWithMockNetworkTest.SamplePortable(1));
EntryView entryView = EntryViews.createSimpleEntryView(key, value, Mockito.mock(Record.class));
LegacyMergeOperation op = new LegacyMergeOperation(map.getName(), entryView, new PassThroughMergePolicy(), false);
SplitBrainMergeTypes.MapMergeTypes mergingEntry = createMergingEntry(serializationService, key, value, Mockito.mock(Record.class));
Operation op = new MergeOperation(map.getName(), Collections.singletonList(mergingEntry),
new PassThroughMergePolicy<>(), false);
int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
operationService.invokeOnPartition(MapService.SERVICE_NAME, op, partitionId);

Expand Down
Expand Up @@ -23,7 +23,7 @@
import com.hazelcast.config.WanReplicationRef;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import com.hazelcast.map.merge.PassThroughMergePolicy;
import com.hazelcast.spi.merge.PassThroughMergePolicy;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.annotation.ParallelJVMTest;
Expand Down
11 changes: 9 additions & 2 deletions hazelcast-spring/pom.xml
Expand Up @@ -36,6 +36,7 @@
<org.springframework.version>4.3.23.RELEASE</org.springframework.version>
<jsr250.api.version>1.0</jsr250.api.version>
<hazelcast.latest.version>3.8</hazelcast.latest.version>
<hazelcast-hibernate5.version>1.3.2</hazelcast-hibernate5.version>
</properties>

<build>
Expand Down Expand Up @@ -148,7 +149,7 @@
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-hibernate5</artifactId>
<version>1.2.3</version>
<version>${hazelcast-hibernate5.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -186,7 +187,7 @@
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-hibernate3</artifactId>
<version>${hazelcast.latest.version}</version>
<version>3.8.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -256,5 +257,11 @@
<version>${http.components.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-hibernate5</artifactId>
<version>${hazelcast-hibernate5.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
22 changes: 0 additions & 22 deletions hazelcast-spring/src/main/resources/hazelcast-spring-4.0.xsd
Expand Up @@ -3768,28 +3768,6 @@
<xs:documentation>
Resolve conflicts that occurred when target cluster already has the replicated
entry key.

4 merge policy implementations for IMap and 2 merge policy implementations for
ICache are provided out-of-the-box.

IMap has the following merge policies:
com.hazelcast.map.merge.PutIfAbsentMapMergePolicy: Incoming entry merges from the
source map to the target map if it does not exist in the target map.
com.hazelcast.map.merge.HigherHitsMapMergePolicy: Incoming entry merges from the
source map to the target map if the source entry has more hits than the target one.
com.hazelcast.map.merge.PassThroughMergePolicy: Incoming entry merges from the
source map to the target map unless the incoming entry is not null.
com.hazelcast.map.merge.LatestUpdateMapMergePolicy: Incoming entry merges from the
source map to the target map if the source entry has been updated more recently
than the target entry. Please note that this merge policy can only be used when the
clusters' clocks are in sync.

ICache has the following merge policies:
com.hazelcast.cache.merge.HigherHitsCacheMergePolicy: Incoming entry merges from
the source cache to the target cache if the source entry has more hits than the
target one.
com.hazelcast.cache.merge.PassThroughCacheMergePolicy: Incoming entry merges from
the source cache to the target cache unless the incoming entry is not null.
</xs:documentation>
</xs:annotation>
</xs:attribute>
Expand Down

This file was deleted.

57 changes: 0 additions & 57 deletions hazelcast/src/main/java/com/hazelcast/cache/CacheMergePolicy.java

This file was deleted.

This file was deleted.

0 comments on commit f60b052

Please sign in to comment.