diff --git a/spring-integration-hazelcast/README.md b/spring-integration-hazelcast/README.md
index 42bf802..4eed970 100644
--- a/spring-integration-hazelcast/README.md
+++ b/spring-integration-hazelcast/README.md
@@ -535,4 +535,6 @@ public LockRegistry lockRegistry() {
}
```
-When used with a shared `MessageGroupStore` (e.g. `Aggregator` store management), the `HazelcastLockRegistry` can be use to provide this functionality across multiple application instances, such that only one instance can manipulate the group at a time.
+When used with a shared `MessageGroupStore` (e.g. `Aggregator` store management), the `HazelcastLockRegistry` can be use to provide this functionality across multiple application instances, such that only one instance can manipulate the group at a time.
+
+NOTE: For all the distributed operations the CP Subsystem must be enabled on `HazelcastInstance`.
diff --git a/spring-integration-hazelcast/build.gradle b/spring-integration-hazelcast/build.gradle
index e69bb7f..9b282bf 100644
--- a/spring-integration-hazelcast/build.gradle
+++ b/spring-integration-hazelcast/build.gradle
@@ -1,22 +1,13 @@
-buildscript {
- repositories {
- maven { url 'https://repo.spring.io/plugins-release' }
- }
- dependencies {
- classpath 'io.spring.gradle:dependency-management-plugin:1.0.2.RELEASE'
- classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE'
- }
-}
-
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'jacoco'
+ id 'org.sonarqube' version '2.8'
id 'checkstyle'
- id 'org.sonarqube' version '2.5'
+ id 'org.ajoberstar.grgit' version '3.1.1'
+ id "io.spring.dependency-management" version '1.0.8.RELEASE'
}
-
description = 'Spring Integration Hazelcast Support'
apply from: "${rootProject.projectDir}/publish-maven.gradle"
@@ -30,32 +21,15 @@ repositories {
maven { url 'https://repo.spring.io/libs-milestone' }
}
-if (project.hasProperty('platformVersion')) {
- apply plugin: 'spring-io'
-
- dependencyManagement {
- springIoTestRuntime {
- imports {
- mavenBom "io.spring.platform:platform-bom:${platformVersion}"
- }
- }
- }
-}
-
compileJava {
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
-}
-
-compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
ext {
- hazelcastVersion = '3.8.9'
- slf4jVersion = '1.7.25'
- springIntegrationVersion = '4.3.20.BUILD-SNAPSHOT'
+ hazelcastVersion = '3.12.4'
+ slf4jVersion = '1.7.28'
+ springIntegrationVersion = '5.2.1.RELEASE'
idPrefix = 'hazelcast'
@@ -78,12 +52,12 @@ sourceSets {
}
jacoco {
- toolVersion = "0.7.9"
+ toolVersion = '0.8.4'
}
checkstyle {
configFile = file("$rootDir/src/checkstyle/checkstyle.xml")
- toolVersion = "8.0"
+ toolVersion = '8.25'
}
// enable all compiler warnings; individual projects may customize further
@@ -103,9 +77,9 @@ dependencies {
test {
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
- jvmArgs "-Dhazelcast.logging.type=slf4j"
+ jvmArgs '-Dhazelcast.logging.type=slf4j'
- maxHeapSize = "1024m"
+ maxHeapSize = '1024m'
jacoco {
append = false
destinationFile = file("$buildDir/jacoco.exec")
@@ -121,12 +95,12 @@ jacocoTestReport {
}
task sourcesJar(type: Jar) {
- classifier = 'sources'
+ archiveClassifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
- classifier = 'javadoc'
+ archiveClassifier = 'javadoc'
from javadoc
}
@@ -137,13 +111,13 @@ artifacts {
sonarqube {
properties {
- property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
- property "sonar.links.homepage", linkHomepage
- property "sonar.links.ci", linkCi
- property "sonar.links.issue", linkIssue
- property "sonar.links.scm", linkScmUrl
- property "sonar.links.scm_dev", linkScmDevConnection
- property "sonar.java.coveragePlugin", "jacoco"
+ property 'sonar.jacoco.reportPath', "${buildDir.name}/jacoco.exec"
+ property 'sonar.links.homepage', linkHomepage
+ property 'sonar.links.ci', linkCi
+ property 'sonar.links.issue', linkIssue
+ property 'sonar.links.scm', linkScmUrl
+ property 'sonar.links.scm_dev', linkScmDevConnection
+ property 'sonar.java.coveragePlugin', 'jacoco'
}
}
@@ -155,17 +129,17 @@ task api(type: Javadoc) {
options.author = true
options.header = rootProject.description
options.overview = 'src/api/overview.html'
- options.stylesheetFile = file("src/api/stylesheet.css")
+ options.stylesheetFile = file('src/api/stylesheet.css')
source = sourceSets.main.allJava
classpath = project.sourceSets.main.compileClasspath
- destinationDir = new File(buildDir, "api")
+ destinationDir = new File(buildDir, 'api')
}
task schemaZip(type: Zip) {
group = 'Distribution'
- classifier = 'schema'
- description = "Builds -${classifier} archive containing all " +
+ archiveClassifier = 'schema'
+ description = "Builds -${archiveClassifier} archive containing all " +
"XSDs for deployment at static.springframework.org/schema."
duplicatesStrategy = 'exclude'
@@ -190,8 +164,8 @@ task schemaZip(type: Zip) {
task docsZip(type: Zip) {
group = 'Distribution'
- classifier = 'docs'
- description = "Builds -${classifier} archive containing api " +
+ archiveClassifier = 'docs'
+ description = "Builds -${archiveClassifier} archive containing api " +
"for deployment at static.spring.io/spring-integration/docs."
from('src/dist') {
@@ -205,8 +179,8 @@ task docsZip(type: Zip) {
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
group = 'Distribution'
- classifier = 'dist'
- description = "Builds -${classifier} archive, containing all jars and docs, " +
+ archiveClassifier = 'dist'
+ description = "Builds -${archiveClassifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "${project.name}-${project.version}";
@@ -218,11 +192,11 @@ task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
into "${baseDir}"
}
- from(zipTree(docsZip.archivePath)) {
+ from(zipTree(docsZip.archiveFile)) {
into "${baseDir}/docs"
}
- from(zipTree(schemaZip.archivePath)) {
+ from(zipTree(schemaZip.archiveFile)) {
into "${baseDir}/schema"
}
@@ -237,11 +211,11 @@ task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
// Not published by default; only for use when building from source.
task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
group = 'Distribution'
- classifier = 'dist-with-deps'
- description = "Builds -${classifier} archive, containing everything " +
- "in the -${distZip.classifier} archive plus all dependencies."
+ archiveClassifier = 'dist-with-deps'
+ description = "Builds -${archiveClassifier} archive, containing everything " +
+ "in the -${distZip.archiveClassifier} archive plus all dependencies."
- from zipTree(distZip.archivePath)
+ from zipTree(distZip.archiveFile)
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":${zipTask.name}")) {
diff --git a/spring-integration-hazelcast/gradle.properties b/spring-integration-hazelcast/gradle.properties
index 9733f28..dfe1192 100644
--- a/spring-integration-hazelcast/gradle.properties
+++ b/spring-integration-hazelcast/gradle.properties
@@ -1,2 +1 @@
-version=1.0.1.BUILD-SNAPSHOT
-org.gradle.daemon=true
+version=2.0.0.BUILD-SNAPSHOT
diff --git a/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.jar b/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.jar
index e27d71c..5c2d1cf 100644
Binary files a/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.jar and b/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.properties b/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.properties
index e5af7b4..5028f28 100644
--- a/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.properties
+++ b/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Fri Jul 07 17:27:53 EDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
diff --git a/spring-integration-hazelcast/gradlew b/spring-integration-hazelcast/gradlew
index cccdd3d..83f2acf 100755
--- a/spring-integration-hazelcast/gradlew
+++ b/spring-integration-hazelcast/gradlew
@@ -1,5 +1,21 @@
#!/usr/bin/env sh
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
diff --git a/spring-integration-hazelcast/gradlew.bat b/spring-integration-hazelcast/gradlew.bat
index e95643d..24467a1 100644
--- a/spring-integration-hazelcast/gradlew.bat
+++ b/spring-integration-hazelcast/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
diff --git a/spring-integration-hazelcast/publish-maven.gradle b/spring-integration-hazelcast/publish-maven.gradle
index f1444f0..72a61b1 100644
--- a/spring-integration-hazelcast/publish-maven.gradle
+++ b/spring-integration-hazelcast/publish-maven.gradle
@@ -14,6 +14,17 @@ install {
def customizePom(pom, gradleProject) {
pom.whenConfigured { generatedPom ->
+
+ // sort to make pom dependencies order consistent to ease comparison of older poms
+ generatedPom.dependencies = generatedPom.dependencies.sort { dep ->
+ "$dep.scope:$dep.groupId:$dep.artifactId"
+ }
+
+ def managedVersions = dependencyManagement.managedVersions
+ generatedPom.dependencies.findAll{dep -> !dep.version }.each { dep ->
+ dep.version = managedVersions["${dep.groupId}:${dep.artifactId}"]
+ }
+
// respect 'optional' and 'provided' dependencies
gradleProject.optionalDeps.each { dep ->
generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true
@@ -31,7 +42,7 @@ def customizePom(pom, gradleProject) {
generatedPom.project {
name = gradleProject.description
description = gradleProject.description
- url = linkHomepage
+ url = 'https://github.com/spring-projects/spring-integration-aws'
organization {
name = 'SpringIO'
url = 'https://spring.io'
@@ -43,18 +54,27 @@ def customizePom(pom, gradleProject) {
distribution 'repo'
}
}
-
scm {
- url = linkScmUrl
- connection = 'scm:git:' + linkScmConnection
- developerConnection = 'scm:git:' + linkScmDevConnection
+ url = 'https://github.com/spring-projects/spring-integration-aws'
+ connection = 'scm:git:git://github.com/spring-projects/spring-integration-aws'
+ developerConnection = 'scm:git:git://github.com/spring-projects/spring-integration-aws'
}
developers {
developer {
- id = 'erenavsarogullari'
- name = 'Eren Avsarogullari'
- email = 'erenavsarogullari@gmail.com'
+ id = 'amolnayak311'
+ name = 'Amol Nayak'
+ email = 'amolnayak311@gmail.com'
+ }
+ developer {
+ id = 'ghillert'
+ name = 'Gunnar Hillert'
+ email = 'ghillert@pivotal.io'
+ }
+ developer {
+ id = 'abilan'
+ name = 'Artem Bilan'
+ email = 'abilan@pivotal.io'
}
}
}
diff --git a/spring-integration-hazelcast/src/checkstyle/checkstyle.xml b/spring-integration-hazelcast/src/checkstyle/checkstyle.xml
index 4b7a81e..c262bf5 100644
--- a/spring-integration-hazelcast/src/checkstyle/checkstyle.xml
+++ b/spring-integration-hazelcast/src/checkstyle/checkstyle.xml
@@ -103,9 +103,7 @@
-
-
-
+
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastLocalInstanceRegistrar.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastLocalInstanceRegistrar.java
index 03d104b..b1e6ad4 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastLocalInstanceRegistrar.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastLocalInstanceRegistrar.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2017 the original author or authors.
+ * Copyright 2015-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -96,7 +96,7 @@ public class HazelcastLocalInstanceRegistrar implements SmartInitializingSinglet
}
private void syncConfigurationMultiMap(HazelcastInstance hazelcastInstance) {
- Lock lock = hazelcastInstance.getLock(SPRING_INTEGRATION_INTERNAL_CLUSTER_LOCK);
+ Lock lock = hazelcastInstance.getCPSubsystem().getLock(SPRING_INTEGRATION_INTERNAL_CLUSTER_LOCK);
lock.lock();
try {
MultiMap multiMap = hazelcastInstance
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/AbstractHazelcastMessageProducer.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/AbstractHazelcastMessageProducer.java
index cf79723..009cd54 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/AbstractHazelcastMessageProducer.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/AbstractHazelcastMessageProducer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2017 the original author or authors.
+ * Copyright 2015-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@ import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.MapEvent;
import com.hazelcast.core.MultiMap;
+import com.hazelcast.instance.EndpointQualifier;
/**
* Hazelcast Base Event-Driven Message Producer.
@@ -118,10 +119,9 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
final Set hazelcastInstanceSet = Hazelcast.getAllHazelcastInstances();
final Set localSocketAddressesSet = getLocalSocketAddresses(hazelcastInstanceSet);
return localSocketAddressesSet.isEmpty() ||
- (!localSocketAddressesSet.isEmpty()
- && (localSocketAddressesSet.contains(socketAddress) ||
- isEventComingFromNonRegisteredHazelcastInstance(hazelcastInstanceSet.iterator().next(),
- localSocketAddressesSet, socketAddress)));
+ localSocketAddressesSet.contains(socketAddress)
+ || isEventComingFromNonRegisteredHazelcastInstance(hazelcastInstanceSet.iterator().next(),
+ localSocketAddressesSet, socketAddress);
}
@@ -193,19 +193,20 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
if (AbstractHazelcastMessageProducer.this.logger.isDebugEnabled()) {
AbstractHazelcastMessageProducer.this.logger.debug("Received Event : " + event);
}
- sendMessage(event, event.getMember().getSocketAddress(), getCacheListeningPolicy());
+ sendMessage(event,
+ event.getMember().getSocketAddress(EndpointQualifier.MEMBER), getCacheListeningPolicy());
}
}
@Override
- @SuppressWarnings("unchecked")
protected Message> toMessage(AbstractIMapEvent event) {
- final Map headers = new HashMap();
+ final Map headers = new HashMap<>();
headers.put(HazelcastHeaders.EVENT_TYPE, event.getEventType().name());
- headers.put(HazelcastHeaders.MEMBER, event.getMember().getSocketAddress());
+ headers.put(HazelcastHeaders.MEMBER, event.getMember().getSocketAddress(EndpointQualifier.MEMBER));
headers.put(HazelcastHeaders.CACHE_NAME, event.getName());
if (event instanceof EntryEvent) {
+ @SuppressWarnings("unchecked")
EntryEvent entryEvent = (EntryEvent) event;
EntryEventMessagePayload messagePayload = new EntryEventMessagePayload<>(entryEvent.getKey(),
entryEvent.getValue(), entryEvent.getOldValue());
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/HazelcastEventDrivenMessageProducer.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/HazelcastEventDrivenMessageProducer.java
index 3dcc11e..f873b5b 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/HazelcastEventDrivenMessageProducer.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/HazelcastEventDrivenMessageProducer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2018 the original author or authors.
+ * Copyright 2015-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ import com.hazelcast.core.Message;
import com.hazelcast.core.MessageListener;
import com.hazelcast.core.MultiMap;
import com.hazelcast.core.ReplicatedMap;
+import com.hazelcast.instance.EndpointQualifier;
import com.hazelcast.map.listener.MapListener;
/**
@@ -140,7 +141,8 @@ public class HazelcastEventDrivenMessageProducer extends AbstractHazelcastMessag
@Override
protected void processEvent(ItemEvent event) {
if (getCacheEvents().contains(event.getEventType().toString())) {
- sendMessage(event, event.getMember().getSocketAddress(), getCacheListeningPolicy());
+ sendMessage(event,
+ event.getMember().getSocketAddress(EndpointQualifier.MEMBER), getCacheListeningPolicy());
}
if (logger.isDebugEnabled()) {
@@ -152,7 +154,7 @@ public class HazelcastEventDrivenMessageProducer extends AbstractHazelcastMessag
protected org.springframework.messaging.Message> toMessage(ItemEvent event) {
final Map headers = new HashMap<>();
headers.put(HazelcastHeaders.EVENT_TYPE, event.getEventType().name());
- headers.put(HazelcastHeaders.MEMBER, event.getMember().getSocketAddress());
+ headers.put(HazelcastHeaders.MEMBER, event.getMember().getSocketAddress(EndpointQualifier.MEMBER));
return getMessageBuilderFactory().withPayload(event.getItem()).copyHeaders(headers).build();
}
@@ -169,7 +171,8 @@ public class HazelcastEventDrivenMessageProducer extends AbstractHazelcastMessag
@Override
protected void processEvent(Message event) {
- sendMessage(event, event.getPublishingMember().getSocketAddress(), getCacheListeningPolicy());
+ sendMessage(event,
+ event.getPublishingMember().getSocketAddress(EndpointQualifier.MEMBER), getCacheListeningPolicy());
if (logger.isDebugEnabled()) {
logger.debug("Received Message : " + event);
@@ -181,7 +184,8 @@ public class HazelcastEventDrivenMessageProducer extends AbstractHazelcastMessag
Assert.notNull(event.getMessageObject(), "message must not be null");
final Map headers = new HashMap<>();
- headers.put(HazelcastHeaders.MEMBER, event.getPublishingMember().getSocketAddress());
+ headers.put(HazelcastHeaders.MEMBER,
+ event.getPublishingMember().getSocketAddress(EndpointQualifier.MEMBER));
headers.put(HazelcastHeaders.CACHE_NAME, event.getSource());
headers.put(HazelcastHeaders.PUBLISHING_TIME, event.getPublishTime());
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/leader/LeaderInitiator.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/leader/LeaderInitiator.java
index 674bd2a..54f5dc8 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/leader/LeaderInitiator.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/leader/LeaderInitiator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2018 the original author or authors.
+ * Copyright 2015-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ import org.springframework.integration.support.leader.LockRegistryLeaderInitiato
import org.springframework.util.Assert;
import com.hazelcast.core.HazelcastInstance;
-import com.hazelcast.core.ILock;
+import com.hazelcast.cp.lock.FencedLock;
/**
* Bootstrap leadership {@link org.springframework.integration.leader.Candidate candidates}
@@ -106,7 +106,7 @@ public class LeaderInitiator implements SmartLifecycle, DisposableBean, Applicat
/**
* Hazelcast distributed lock.
*/
- private volatile ILock lock;
+ private volatile FencedLock lock;
private boolean customPublisher = false;
@@ -210,7 +210,7 @@ public class LeaderInitiator implements SmartLifecycle, DisposableBean, Applicat
@Override
public synchronized void start() {
if (!this.running) {
- this.lock = this.client.getLock(this.candidate.getRole());
+ this.lock = this.client.getCPSubsystem().getLock(this.candidate.getRole());
this.leaderSelector = new LeaderSelector();
this.running = true;
this.future = this.executorService.submit(this.leaderSelector);
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/listener/HazelcastMembershipListener.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/listener/HazelcastMembershipListener.java
index 3db4061..4630bd9 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/listener/HazelcastMembershipListener.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/listener/HazelcastMembershipListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,23 +27,28 @@ import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.MembershipAdapter;
import com.hazelcast.core.MembershipEvent;
import com.hazelcast.core.MultiMap;
+import com.hazelcast.instance.EndpointQualifier;
/**
* Hazelcast {@link MembershipAdapter} in order to listen for membership updates in the cluster.
*
* @author Eren Avsarogullari
+ * @author Artem Bilan
+ *
* @since 1.0.0
*/
public class HazelcastMembershipListener extends MembershipAdapter {
@Override
public void memberRemoved(MembershipEvent membershipEvent) {
- SocketAddress removedMemberSocketAddress = membershipEvent.getMember().getSocketAddress();
+ SocketAddress removedMemberSocketAddress =
+ membershipEvent.getMember().getSocketAddress(EndpointQualifier.MEMBER);
Set hazelcastLocalInstanceSet = Hazelcast.getAllHazelcastInstances();
if (!hazelcastLocalInstanceSet.isEmpty()) {
HazelcastInstance hazelcastInstance = hazelcastLocalInstanceSet.iterator().next();
- Lock lock = hazelcastInstance
- .getLock(HazelcastLocalInstanceRegistrar.SPRING_INTEGRATION_INTERNAL_CLUSTER_LOCK);
+ Lock lock =
+ hazelcastInstance.getCPSubsystem()
+ .getLock(HazelcastLocalInstanceRegistrar.SPRING_INTEGRATION_INTERNAL_CLUSTER_LOCK);
lock.lock();
try {
MultiMap configMultiMap = hazelcastInstance
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/lock/HazelcastLockRegistry.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/lock/HazelcastLockRegistry.java
index 559a635..d010947 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/lock/HazelcastLockRegistry.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/lock/HazelcastLockRegistry.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ public class HazelcastLockRegistry implements LockRegistry {
@Override
public Lock obtain(Object lockKey) {
Assert.isInstanceOf(String.class, lockKey);
- return this.client.getLock((String) lockKey);
+ return this.client.getCPSubsystem().getLock((String) lockKey);
}
}
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/outbound/HazelcastCacheWritingMessageHandler.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/outbound/HazelcastCacheWritingMessageHandler.java
index adb5276..3262c39 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/outbound/HazelcastCacheWritingMessageHandler.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/outbound/HazelcastCacheWritingMessageHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ import com.hazelcast.core.MultiMap;
*
* @author Eren Avsarogullari
* @author Artem Bilan
+ *
* @since 1.0.0
*/
public class HazelcastCacheWritingMessageHandler extends AbstractMessageHandler {
@@ -71,14 +72,14 @@ public class HazelcastCacheWritingMessageHandler extends AbstractMessageHandler
}
@Override
- protected void onInit() throws Exception {
+ protected void onInit() {
super.onInit();
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
}
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
- protected void handleMessageInternal(final Message> message) throws Exception {
+ protected void handleMessageInternal(final Message> message) {
Object objectToStore = message;
if (this.extractPayload) {
objectToStore = message.getPayload();
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/store/HazelcastMessageStore.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/store/HazelcastMessageStore.java
index 7428d85..3022653 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/store/HazelcastMessageStore.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/store/HazelcastMessageStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,6 +57,16 @@ public class HazelcastMessageStore extends AbstractKeyValueMessageStore {
this.map.put(id, objectToStore);
}
+ @Override
+ protected void doStoreIfAbsent(Object id, Object objectToStore) {
+ this.map.putIfAbsent(id, objectToStore);
+ }
+
+ @Override
+ protected void doRemoveAll(Collection