diff --git a/.github/workflows/branch-ci.yml b/.github/workflows/branch-ci.yml
index 603791e5..5787348a 100644
--- a/.github/workflows/branch-ci.yml
+++ b/.github/workflows/branch-ci.yml
@@ -14,25 +14,24 @@ jobs:
name: Branch CI
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - uses: actions/cache@v1
+ - uses: actions/checkout@v4
+ - uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- - name: Set up JDK 1.8
- uses: actions/setup-java@v1
+ - name: Set up JDK
+ uses: actions/setup-java@v4
with:
- java-version: 1.8
+ java-version: 17
+ distribution: zulu
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Maven Build
- run: mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true -Ddockerfile.skip=true -B -V
+ run: mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
env:
GITHUB_TOKEN: ${{ secrets.ORGANIZATION_TOKEN }}
- name: Maven Verify
- run: |
- sudo echo "127.0.0.1 $(eval hostname)" | sudo tee -a /etc/hosts
- mvn verify -B
+ run: mvn verify -B
diff --git a/.github/workflows/pre-release-ci.yml b/.github/workflows/pre-release-ci.yml
index 4948f5bc..245e4d48 100644
--- a/.github/workflows/pre-release-ci.yml
+++ b/.github/workflows/pre-release-ci.yml
@@ -9,23 +9,23 @@ jobs:
name: Pre-release CI
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - uses: actions/cache@v1
+ - uses: actions/checkout@v4
+ - uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java for publishing to GitHub Packages
- uses: actions/setup-java@v1
+ uses: actions/setup-java@v4
with:
- java-version: 1.8
+ java-version: 17
+ distribution: zulu
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Deploy pre-release version to GitHub Packages
run: |
- sudo echo "127.0.0.1 $(eval hostname)" | sudo tee -a /etc/hosts
pre_release_version=${{ github.event.release.tag_name }}
echo Pre-release version $pre_release_version
mvn versions:set -DnewVersion=$pre_release_version -DgenerateBackupPoms=false
@@ -34,9 +34,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.ORGANIZATION_TOKEN }}
- name: Set up Java for publishing to Maven Central Repository
- uses: actions/setup-java@v1
+ uses: actions/setup-java@v4
with:
- java-version: 1.8
+ java-version: 17
+ distribution: zulu
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml
index 32e3623a..4924f526 100644
--- a/.github/workflows/release-ci.yml
+++ b/.github/workflows/release-ci.yml
@@ -9,31 +9,30 @@ jobs:
name: Release CI
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git checkout ${{ github.event.release.target_commitish }}
- - uses: actions/cache@v1
+ - uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java for publishing to GitHub Packages
- uses: actions/setup-java@v1
+ uses: actions/setup-java@v4
with:
- java-version: 1.8
+ java-version: 17
+ distribution: zulu
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Maven Build
- run: mvn clean install -DskipTests=true -Ddockerfile.skip=true -B -V
+ run: mvn clean install -DskipTests=true -B -V
env:
GITHUB_TOKEN: ${{ secrets.ORGANIZATION_TOKEN }}
- name: Maven Verify
- run: |
- sudo echo "127.0.0.1 $(eval hostname)" | sudo tee -a /etc/hosts
- mvn verify -B
+ run: mvn verify -B
- name: Configure git
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
@@ -43,17 +42,18 @@ jobs:
run: |
mvn -B build-helper:parse-version release:prepare \
-DreleaseVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion} \
- -Darguments="-DskipTests=true -Ddockerfile.skip=true"
+ -Darguments="-DskipTests=true"
echo release_tag=$(git describe --tags --abbrev=0) >> $GITHUB_OUTPUT
- name: Perform release
- run: mvn -B release:perform -Pdeploy2Github -Darguments="-DskipTests=true -Ddockerfile.skip=true -Pdeploy2Github"
+ run: mvn -B release:perform -Pdeploy2Github -Darguments="-DskipTests=true -Pdeploy2Github"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
- name: Set up Java for publishing to Maven Central Repository
- uses: actions/setup-java@v1
+ uses: actions/setup-java@v4
with:
- java-version: 1.8
+ java-version: 17
+ distribution: zulu
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
new file mode 100644
index 00000000..dbd0fdb1
--- /dev/null
+++ b/checkstyle-suppressions.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cluster-testlib/src/main/java/io/scalecube/cluster/utils/NetworkEmulator.java b/cluster-testlib/src/main/java/io/scalecube/cluster/utils/NetworkEmulator.java
index 552c10bc..030081e3 100644
--- a/cluster-testlib/src/main/java/io/scalecube/cluster/utils/NetworkEmulator.java
+++ b/cluster-testlib/src/main/java/io/scalecube/cluster/utils/NetworkEmulator.java
@@ -1,6 +1,8 @@
package io.scalecube.cluster.utils;
import io.scalecube.cluster.transport.api.Message;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collection;
@@ -9,8 +11,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicLong;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import reactor.core.publisher.Mono;
/**
@@ -24,7 +24,7 @@
*/
public final class NetworkEmulator {
- private static final Logger LOGGER = LoggerFactory.getLogger(NetworkEmulator.class);
+ private static final Logger LOGGER = System.getLogger(NetworkEmulator.class.getName());
private volatile OutboundSettings defaultOutboundSettings = new OutboundSettings(0, 0);
private volatile InboundSettings defaultInboundSettings = new InboundSettings(true);
@@ -69,7 +69,8 @@ public OutboundSettings outboundSettings(String destination) {
public void outboundSettings(String destination, int lossPercent, int meanDelay) {
OutboundSettings settings = new OutboundSettings(lossPercent, meanDelay);
outboundSettings.put(destination, settings);
- LOGGER.debug("[{}] Set outbound settings {} to {}", address, settings, destination);
+ LOGGER.log(
+ Level.DEBUG, "[{0}] Set outbound settings {1} to {2}", address, settings, destination);
}
/**
@@ -80,21 +81,22 @@ public void outboundSettings(String destination, int lossPercent, int meanDelay)
*/
public void setDefaultOutboundSettings(int lossPercent, int meanDelay) {
defaultOutboundSettings = new OutboundSettings(lossPercent, meanDelay);
- LOGGER.debug("[{}] Set default outbound settings {}", address, defaultOutboundSettings);
+ LOGGER.log(
+ Level.DEBUG, "[{0}] Set default outbound settings {1}", address, defaultOutboundSettings);
}
/** Blocks outbound messages to all destinations. */
public void blockAllOutbound() {
outboundSettings.clear();
setDefaultOutboundSettings(100, 0);
- LOGGER.debug("[{}] Blocked outbound to all destinations", address);
+ LOGGER.log(Level.DEBUG, "[{0}] Blocked outbound to all destinations", address);
}
/** Unblocks outbound messages to all destinations. */
public void unblockAllOutbound() {
outboundSettings.clear();
setDefaultOutboundSettings(0, 0);
- LOGGER.debug("[{}] Unblocked outbound to all destinations", address);
+ LOGGER.log(Level.DEBUG, "[{0}] Unblocked outbound to all destinations", address);
}
/**
@@ -115,7 +117,7 @@ public void blockOutbound(Collection destinations) {
for (String destination : destinations) {
outboundSettings.put(destination, new OutboundSettings(100, 0));
}
- LOGGER.debug("[{}] Blocked outbound to {}", address, destinations);
+ LOGGER.log(Level.DEBUG, "[{0}] Blocked outbound to {1}", address, destinations);
}
/**
@@ -134,7 +136,7 @@ public void unblockOutbound(String... destinations) {
*/
public void unblockOutbound(Collection destinations) {
destinations.forEach(outboundSettings::remove);
- LOGGER.debug("[{}] Unblocked outbound {}", address, destinations);
+ LOGGER.log(Level.DEBUG, "[{0}] Unblocked outbound {1}", address, destinations);
}
/**
@@ -220,7 +222,8 @@ public InboundSettings inboundSettings(String destination) {
public void inboundSettings(String destination, boolean shallPass) {
InboundSettings settings = new InboundSettings(shallPass);
inboundSettings.put(destination, settings);
- LOGGER.debug("[{}] Set inbound settings {} to {}", address, settings, destination);
+ LOGGER.log(
+ Level.DEBUG, "[{0}] Set inbound settings {1} to {2}", address, settings, destination);
}
/**
@@ -230,21 +233,22 @@ public void inboundSettings(String destination, boolean shallPass) {
*/
public void setDefaultInboundSettings(boolean shallPass) {
defaultInboundSettings = new InboundSettings(shallPass);
- LOGGER.debug("[{}] Set default inbound settings {}", address, defaultInboundSettings);
+ LOGGER.log(
+ Level.DEBUG, "[{0}] Set default inbound settings {1}", address, defaultInboundSettings);
}
/** Blocks inbound messages from all destinations. */
public void blockAllInbound() {
inboundSettings.clear();
setDefaultInboundSettings(false);
- LOGGER.debug("[{}] Blocked inbound from all destinations", address);
+ LOGGER.log(Level.DEBUG, "[{0}] Blocked inbound from all destinations", address);
}
/** Unblocks inbound messages to all destinations. */
public void unblockAllInbound() {
inboundSettings.clear();
setDefaultInboundSettings(true);
- LOGGER.debug("[{}] Unblocked inbound from all destinations", address);
+ LOGGER.log(Level.DEBUG, "[{0}] Unblocked inbound from all destinations", address);
}
/**
@@ -265,7 +269,7 @@ public void blockInbound(Collection destinations) {
for (String destination : destinations) {
inboundSettings.put(destination, new InboundSettings(false));
}
- LOGGER.debug("[{}] Blocked inbound from {}", address, destinations);
+ LOGGER.log(Level.DEBUG, "[{0}] Blocked inbound from {1}", address, destinations);
}
/**
@@ -284,7 +288,7 @@ public void unblockInbound(String... destinations) {
*/
public void unblockInbound(Collection destinations) {
destinations.forEach(inboundSettings::remove);
- LOGGER.debug("[{}] Unblocked inbound from {}", address, destinations);
+ LOGGER.log(Level.DEBUG, "[{0}] Unblocked inbound from {1}", address, destinations);
}
/**
diff --git a/cluster-testlib/src/test/java/io/scalecube/cluster/utils/BaseTest.java b/cluster-testlib/src/test/java/io/scalecube/cluster/utils/BaseTest.java
index 4519b3ba..610c017b 100644
--- a/cluster-testlib/src/test/java/io/scalecube/cluster/utils/BaseTest.java
+++ b/cluster-testlib/src/test/java/io/scalecube/cluster/utils/BaseTest.java
@@ -1,23 +1,23 @@
package io.scalecube.cluster.utils;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/** Base test class. */
public class BaseTest {
- protected static final Logger LOGGER = LoggerFactory.getLogger(BaseTest.class);
+ protected static final Logger LOGGER = System.getLogger(BaseTest.class.getName());
@BeforeEach
public final void baseSetUp(TestInfo testInfo) {
- LOGGER.info("***** Test started : " + testInfo.getDisplayName() + " *****");
+ LOGGER.log(Level.INFO, "***** Test started : " + testInfo.getDisplayName() + " *****");
}
@AfterEach
public final void baseTearDown(TestInfo testInfo) {
- LOGGER.info("***** Test finished : " + testInfo.getDisplayName() + " *****");
+ LOGGER.log(Level.INFO, "***** Test finished : " + testInfo.getDisplayName() + " *****");
}
}
diff --git a/cluster/pom.xml b/cluster/pom.xml
index 8b9287ed..d9666d18 100644
--- a/cluster/pom.xml
+++ b/cluster/pom.xml
@@ -38,16 +38,6 @@
${project.version}
test
-
- org.apache.logging.log4j
- log4j-slf4j-impl
- test
-
-
- org.apache.logging.log4j
- log4j-core
- test
-
diff --git a/cluster/src/main/java/io/scalecube/cluster/ClusterImpl.java b/cluster/src/main/java/io/scalecube/cluster/ClusterImpl.java
index 27309586..566cfe03 100644
--- a/cluster/src/main/java/io/scalecube/cluster/ClusterImpl.java
+++ b/cluster/src/main/java/io/scalecube/cluster/ClusterImpl.java
@@ -19,6 +19,8 @@
import io.scalecube.cluster.transport.api.TransportConfig;
import io.scalecube.cluster.transport.api.TransportFactory;
import java.io.Serializable;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
import java.nio.ByteBuffer;
import java.time.Duration;
import java.util.Collection;
@@ -35,8 +37,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import reactor.core.Disposable;
import reactor.core.Disposables;
import reactor.core.publisher.Flux;
@@ -48,7 +48,7 @@
/** Cluster implementation. */
public final class ClusterImpl implements Cluster {
- private static final Logger LOGGER = LoggerFactory.getLogger(Cluster.class);
+ private static final Logger LOGGER = System.getLogger(Cluster.class.getName());
private static final Pattern NAMESPACE_PATTERN = Pattern.compile("^(\\w+[\\w\\-./]*\\w)+");
@@ -115,7 +115,9 @@ private void initLifecycle() {
.then(doStart())
.doOnSuccess(avoid -> onStart.emitEmpty(busyLooping(Duration.ofSeconds(3))))
.doOnError(th -> onStart.emitError(th, busyLooping(Duration.ofSeconds(3))))
- .subscribe(null, th -> LOGGER.error("[{}][doStart] Exception occurred:", localMember, th));
+ .subscribe(
+ null,
+ th -> LOGGER.log(Level.ERROR, "[{0}][doStart] Exception occurred:", localMember, th));
shutdown
.asMono()
@@ -124,7 +126,11 @@ private void initLifecycle() {
.subscribe(
null,
th ->
- LOGGER.warn("[{}][doShutdown] Exception occurred: {}", localMember, th.toString()));
+ LOGGER.log(
+ Level.WARNING,
+ "[{0}][doShutdown] Exception occurred: {1}",
+ localMember,
+ th.toString()));
}
/**
@@ -287,7 +293,9 @@ private Mono doStart0() {
.subscribe(
event ->
membershipSink.emitNext(event, busyLooping(Duration.ofSeconds(3))),
- ex -> LOGGER.error("[{}][membership][error] cause:", localMember, ex),
+ ex ->
+ LOGGER.log(
+ Level.ERROR, "[{0}][membership][error] cause:", localMember, ex),
() -> membershipSink.emitComplete(busyLooping(Duration.ofSeconds(3)))));
return Mono.fromRunnable(() -> failureDetector.start())
@@ -297,8 +305,10 @@ private Mono doStart0() {
.then(membership.start())
.then();
})
- .doOnSubscribe(s -> LOGGER.info("[{}][doStart] Starting, config: {}", localMember, config))
- .doOnSuccess(avoid -> LOGGER.info("[{}][doStart] Started", localMember))
+ .doOnSubscribe(
+ s ->
+ LOGGER.log(Level.INFO, "[{0}][doStart] Starting, config: {1}", localMember, config))
+ .doOnSuccess(avoid -> LOGGER.log(Level.INFO, "[{0}][doStart] Started", localMember))
.thenReturn(this);
}
@@ -339,17 +349,19 @@ private void startHandler() {
listenMessage()
.subscribe(
handler::onMessage,
- ex -> LOGGER.error("[{}][onMessage][error] cause:", localMember, ex)));
+ ex -> LOGGER.log(Level.ERROR, "[{0}][onMessage][error] cause:", localMember, ex)));
actionsDisposables.add(
listenMembership()
.subscribe(
handler::onMembershipEvent,
- ex -> LOGGER.error("[{}][onMembershipEvent][error] cause:", localMember, ex)));
+ ex ->
+ LOGGER.log(
+ Level.ERROR, "[{0}][onMembershipEvent][error] cause:", localMember, ex)));
actionsDisposables.add(
listenGossip()
.subscribe(
handler::onGossip,
- ex -> LOGGER.error("[{}][onGossip][error] cause:", localMember, ex)));
+ ex -> LOGGER.log(Level.ERROR, "[{0}][onGossip][error] cause:", localMember, ex)));
}
private Flux listenMessage() {
@@ -457,11 +469,12 @@ public void shutdown() {
private Mono doShutdown() {
return Mono.defer(
() -> {
- LOGGER.info("[{}][doShutdown] Shutting down", localMember);
+ LOGGER.log(Level.INFO, "[{0}][doShutdown] Shutting down", localMember);
return Flux.concatDelayError(leaveCluster(), dispose(), transport.stop())
.then()
.doFinally(s -> scheduler.dispose())
- .doOnSuccess(avoid -> LOGGER.info("[{}][doShutdown] Shutdown", localMember));
+ .doOnSuccess(
+ avoid -> LOGGER.log(Level.INFO, "[{0}][doShutdown] Shutdown", localMember));
});
}
@@ -469,12 +482,16 @@ private Mono leaveCluster() {
return membership
.leaveCluster()
.subscribeOn(scheduler)
- .doOnSubscribe(s -> LOGGER.info("[{}][leaveCluster] Leaving cluster", localMember))
- .doOnSuccess(s -> LOGGER.info("[{}][leaveCluster] Left cluster", localMember))
+ .doOnSubscribe(
+ s -> LOGGER.log(Level.INFO, "[{0}][leaveCluster] Leaving cluster", localMember))
+ .doOnSuccess(s -> LOGGER.log(Level.INFO, "[{0}][leaveCluster] Left cluster", localMember))
.doOnError(
ex ->
- LOGGER.warn(
- "[{}][leaveCluster] Exception occurred: {}", localMember, ex.toString()))
+ LOGGER.log(
+ Level.WARNING,
+ "[{0}][leaveCluster] Exception occurred: {1}",
+ localMember,
+ ex.toString()))
.then();
}
diff --git a/cluster/src/main/java/io/scalecube/cluster/fdetector/FailureDetectorImpl.java b/cluster/src/main/java/io/scalecube/cluster/fdetector/FailureDetectorImpl.java
index 274f5a08..a85b4b3c 100644
--- a/cluster/src/main/java/io/scalecube/cluster/fdetector/FailureDetectorImpl.java
+++ b/cluster/src/main/java/io/scalecube/cluster/fdetector/FailureDetectorImpl.java
@@ -8,6 +8,8 @@
import io.scalecube.cluster.membership.MembershipEvent;
import io.scalecube.cluster.transport.api.Message;
import io.scalecube.cluster.transport.api.Transport;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
@@ -17,8 +19,6 @@
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import reactor.core.Disposable;
import reactor.core.Disposables;
import reactor.core.publisher.Flux;
@@ -27,7 +27,7 @@
public final class FailureDetectorImpl implements FailureDetector {
- private static final Logger LOGGER = LoggerFactory.getLogger(FailureDetector.class);
+ private static final Logger LOGGER = System.getLogger(FailureDetector.class.getName());
// Qualifiers
@@ -89,15 +89,20 @@ public FailureDetectorImpl(
.subscribe(
this::onMessage,
ex ->
- LOGGER.error(
- "[{}][{}][onMessage][error] cause:", localMember, currentPeriod, ex)),
+ LOGGER.log(
+ Level.ERROR,
+ "[{0}][{1}][onMessage][error] cause:",
+ localMember,
+ currentPeriod,
+ ex)),
membershipProcessor // Listen membership events to update remoteMembers
.publishOn(scheduler)
.subscribe(
this::onMembershipEvent,
ex ->
- LOGGER.error(
- "[{}][{}][onMembershipEvent][error] cause:",
+ LOGGER.log(
+ Level.ERROR,
+ "[{0}][{1}][onMembershipEvent][error] cause:",
localMember,
currentPeriod,
ex))));
@@ -143,7 +148,7 @@ private void doPing() {
PingData pingData = new PingData(localMember, pingMember);
Message pingMsg = Message.withData(pingData).qualifier(PING).correlationId(cid).build();
- LOGGER.debug("[{}][{}] Send Ping to {}", localMember, period, pingMember);
+ LOGGER.log(Level.DEBUG, "[{0}][{1}] Send Ping to {2}", localMember, period, pingMember);
String address = pingMember.address();
transport
.requestResponse(address, pingMsg)
@@ -151,13 +156,18 @@ private void doPing() {
.publishOn(scheduler)
.subscribe(
message -> {
- LOGGER.debug(
- "[{}][{}] Received PingAck from {}", localMember, period, message.sender());
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Received PingAck from {2}",
+ localMember,
+ period,
+ message.sender());
publishPingResult(period, pingMember, computeMemberStatus(message, period));
},
ex -> {
- LOGGER.debug(
- "[{}][{}] Failed to get PingAck from {} within {} ms",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Failed to get PingAck from {2} within {3} ms",
localMember,
period,
pingMember,
@@ -167,7 +177,7 @@ private void doPing() {
final List pingReqMembers = selectPingReqMembers(pingMember);
if (timeLeft <= 0 || pingReqMembers.isEmpty()) {
- LOGGER.debug("[{}][{}] No PingReq occurred", localMember, period);
+ LOGGER.log(Level.DEBUG, "[{0}][{1}] No PingReq occurred", localMember, period);
publishPingResult(period, pingMember, MemberStatus.SUSPECT);
} else {
doPingReq(currentPeriod, pingMember, pingReqMembers, cid);
@@ -182,8 +192,13 @@ private void doPingReq(
.qualifier(PING_REQ)
.correlationId(cid)
.build();
- LOGGER.debug(
- "[{}][{}] Send PingReq to {} for {}", localMember, period, pingReqMembers, pingMember);
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Send PingReq to {2} for {3}",
+ localMember,
+ period,
+ pingReqMembers,
+ pingMember);
Duration timeout = Duration.ofMillis(config.pingInterval() - config.pingTimeout());
pingReqMembers.forEach(
@@ -194,8 +209,9 @@ private void doPingReq(
.publishOn(scheduler)
.subscribe(
message -> {
- LOGGER.debug(
- "[{}][{}] Received transit PingAck from {} to {}",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Received transit PingAck from {2} to {3}",
localMember,
period,
message.sender(),
@@ -203,8 +219,10 @@ private void doPingReq(
publishPingResult(period, pingMember, computeMemberStatus(message, period));
},
throwable -> {
- LOGGER.debug(
- "[{}][{}] Timeout getting transit PingAck from {} to {} within {} ms",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] "
+ + "Timeout getting transit PingAck from {2} to {3} within {4} ms",
localMember,
period,
member,
@@ -232,12 +250,13 @@ private void onMessage(Message message) {
private void onPing(Message message) {
long period = this.currentPeriod;
String sender = message.sender();
- LOGGER.debug("[{}][{}] Received Ping from {}", localMember, period, sender);
+ LOGGER.log(Level.DEBUG, "[{0}][{1}] Received Ping from {2}", localMember, period, sender);
PingData data = message.data();
data = data.withAckType(AckType.DEST_OK);
if (!data.getTo().id().equals(localMember.id())) {
- LOGGER.debug(
- "[{}][{}] Received Ping from {} to {}, but local member is {}",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Received Ping from {2} to {3}, but local member is {4}",
localMember,
period,
sender,
@@ -249,14 +268,15 @@ private void onPing(Message message) {
Message ackMessage =
Message.withData(data).qualifier(PING_ACK).correlationId(correlationId).build();
String address = data.getFrom().address();
- LOGGER.debug("[{}][{}] Send PingAck to {}", localMember, period, address);
+ LOGGER.log(Level.DEBUG, "[{0}][{1}] Send PingAck to {2}", localMember, period, address);
transport
.send(address, ackMessage)
.subscribe(
null,
ex ->
- LOGGER.debug(
- "[{}][{}] Failed to send PingAck to {}, cause: {}",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Failed to send PingAck to {2}, cause: {3}",
localMember,
period,
address,
@@ -266,7 +286,8 @@ private void onPing(Message message) {
/** Listens to PING_REQ message and sends PING to requested cluster member. */
private void onPingReq(Message message) {
long period = this.currentPeriod;
- LOGGER.debug("[{}][{}] Received PingReq from {}", localMember, period, message.sender());
+ LOGGER.log(
+ Level.DEBUG, "[{0}][{1}] Received PingReq from {2}", localMember, period, message.sender());
PingData data = message.data();
Member target = data.getTo();
Member originalIssuer = data.getFrom();
@@ -275,14 +296,15 @@ private void onPingReq(Message message) {
Message pingMessage =
Message.withData(pingReqData).qualifier(PING).correlationId(correlationId).build();
String address = target.address();
- LOGGER.debug("[{}][{}] Send transit Ping to {}", localMember, period, address);
+ LOGGER.log(Level.DEBUG, "[{0}][{1}] Send transit Ping to {2}", localMember, period, address);
transport
.send(address, pingMessage)
.subscribe(
null,
ex ->
- LOGGER.debug(
- "[{}][{}] Failed to send transit Ping to {}, cause: {}",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Failed to send transit Ping to {2}, cause: {3}",
localMember,
period,
address,
@@ -295,8 +317,12 @@ private void onPingReq(Message message) {
*/
private void onTransitPingAck(Message message) {
long period = this.currentPeriod;
- LOGGER.debug(
- "[{}][{}] Received transit PingAck from {}", localMember, period, message.sender());
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Received transit PingAck from {2}",
+ localMember,
+ period,
+ message.sender());
PingData data = message.data();
AckType ackType = data.getAckType();
Member target = data.getOriginalIssuer();
@@ -305,14 +331,16 @@ private void onTransitPingAck(Message message) {
Message originalAckMessage =
Message.withData(originalAckData).qualifier(PING_ACK).correlationId(correlationId).build();
String address = target.address();
- LOGGER.debug("[{}][{}] Resend transit PingAck to {}", localMember, period, address);
+ LOGGER.log(
+ Level.DEBUG, "[{0}][{1}] Resend transit PingAck to {2}", localMember, period, address);
transport
.send(address, originalAckMessage)
.subscribe(
null,
ex ->
- LOGGER.debug(
- "[{}][{}] Failed to resend transit PingAck to {}, cause: {}",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Failed to resend transit PingAck to {2}, cause: {3}",
localMember,
period,
address,
@@ -324,8 +352,9 @@ private void onMembershipEvent(MembershipEvent event) {
if (event.isRemoved()) {
boolean removed = pingMembers.remove(member);
if (removed) {
- LOGGER.debug(
- "[{}][{}] Removed {} from pingMembers list (size={})",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Removed {2} from pingMembers list (size={3})",
localMember,
currentPeriod,
member,
@@ -337,8 +366,9 @@ private void onMembershipEvent(MembershipEvent event) {
int size = pingMembers.size();
int index = size > 0 ? ThreadLocalRandom.current().nextInt(size) : 0;
pingMembers.add(index, member);
- LOGGER.debug(
- "[{}][{}] Added {} to pingMembers list (size={})",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Added {2} to pingMembers list (size={3})",
localMember,
currentPeriod,
member,
@@ -376,7 +406,8 @@ private List selectPingReqMembers(Member pingMember) {
}
private void publishPingResult(long period, Member member, MemberStatus status) {
- LOGGER.debug("[{}][{}] Member {} detected as {}", localMember, period, member, status);
+ LOGGER.log(
+ Level.DEBUG, "[{0}][{1}] Member {2} detected as {3}", localMember, period, member, status);
sink.emitNext(new FailureDetectorEvent(member, status), busyLooping(Duration.ofSeconds(3)));
}
@@ -397,8 +428,12 @@ private MemberStatus computeMemberStatus(Message message, long period) {
memberStatus = MemberStatus.DEAD;
break;
default:
- LOGGER.warn(
- "[{}][{}] Unknown PingData.AckType received '{}'", localMember, period, ackType);
+ LOGGER.log(
+ Level.WARNING,
+ "[{0}][{1}] Unknown PingData.AckType received: {2}",
+ localMember,
+ period,
+ ackType);
memberStatus = MemberStatus.SUSPECT;
}
return memberStatus;
diff --git a/cluster/src/main/java/io/scalecube/cluster/gossip/GossipProtocolImpl.java b/cluster/src/main/java/io/scalecube/cluster/gossip/GossipProtocolImpl.java
index 3657c06b..28cb2857 100644
--- a/cluster/src/main/java/io/scalecube/cluster/gossip/GossipProtocolImpl.java
+++ b/cluster/src/main/java/io/scalecube/cluster/gossip/GossipProtocolImpl.java
@@ -7,6 +7,8 @@
import io.scalecube.cluster.membership.MembershipEvent;
import io.scalecube.cluster.transport.api.Message;
import io.scalecube.cluster.transport.api.Transport;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
@@ -19,8 +21,6 @@
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import reactor.core.Disposable;
import reactor.core.Disposables;
import reactor.core.publisher.Flux;
@@ -31,7 +31,7 @@
public final class GossipProtocolImpl implements GossipProtocol {
- private static final Logger LOGGER = LoggerFactory.getLogger(GossipProtocol.class);
+ private static final Logger LOGGER = System.getLogger(GossipProtocol.class.getName());
// Qualifiers
@@ -94,14 +94,24 @@ public GossipProtocolImpl(
.publishOn(scheduler)
.subscribe(
this::onMembershipEvent,
- ex -> LOGGER.error("[{}][onMembershipEvent][error] cause:", localMember, ex)),
+ ex ->
+ LOGGER.log(
+ Level.ERROR,
+ "[{0}][onMembershipEvent][error] cause:",
+ localMember,
+ ex)),
transport
.listen() // Listen gossip requests
.publishOn(scheduler)
.filter(this::isGossipRequest)
.subscribe(
this::onGossipRequest,
- ex -> LOGGER.error("[{}][onGossipRequest][error] cause:", localMember, ex))));
+ ex ->
+ LOGGER.log(
+ Level.ERROR,
+ "[{0}][onGossipRequest][error] cause:",
+ localMember,
+ ex))));
}
@Override
@@ -158,7 +168,8 @@ private void doSpreadGossip() {
// Sweep gossips
Set gossipsToRemove = getGossipsToRemove(period);
if (!gossipsToRemove.isEmpty()) {
- LOGGER.debug("[{}][{}] Sweep gossips: {}", localMember, period, gossipsToRemove);
+ LOGGER.log(
+ Level.DEBUG, "[{0}][{1}] Sweep gossips: {2}", localMember, period, gossipsToRemove);
for (String gossipId : gossipsToRemove) {
gossips.remove(gossipId);
}
@@ -167,8 +178,9 @@ private void doSpreadGossip() {
// Check spread gossips
Set gossipsThatSpread = getGossipsThatMostLikelyDisseminated(period);
if (!gossipsThatSpread.isEmpty()) {
- LOGGER.debug(
- "[{}][{}] Most likely disseminated gossips: {}",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Most likely disseminated gossips: {2}",
localMember,
period,
gossipsThatSpread);
@@ -180,7 +192,8 @@ private void doSpreadGossip() {
}
}
} catch (Exception ex) {
- LOGGER.warn("[{}][{}][doSpreadGossip] Exception occurred:", localMember, period, ex);
+ LOGGER.log(
+ Level.WARNING, "[{0}][{1}][doSpreadGossip] Exception occurred:", localMember, period, ex);
}
}
@@ -225,9 +238,10 @@ private void checkGossipSegmentation() {
// or network issue
final SequenceIdCollector sequenceIdCollector = entry.getValue();
if (sequenceIdCollector.size() > intervalsThreshold) {
- LOGGER.warn(
- "[{}][{}] Too many missed gossip messages from original gossiper: '{}', "
- + "current node({}) was SUSPECTED much for a long time or connection problem",
+ LOGGER.log(
+ Level.WARNING,
+ "[{0}][{1}] Too many missed gossip messages from original gossiper: {2}, "
+ + "current node({3}) was SUSPECTED much for a long time or connection problem",
localMember,
currentPeriod,
entry.getKey(),
@@ -244,8 +258,9 @@ private void onMembershipEvent(MembershipEvent event) {
boolean removed = remoteMembers.remove(member);
sequenceIdCollectors.remove(member.id());
if (removed) {
- LOGGER.debug(
- "[{}][{}] Removed {} from remoteMembers list (size={})",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Removed {2} from remoteMembers list (size={3})",
localMember,
currentPeriod,
member,
@@ -254,8 +269,9 @@ private void onMembershipEvent(MembershipEvent event) {
}
if (event.isAdded()) {
remoteMembers.add(member);
- LOGGER.debug(
- "[{}][{}] Added {} to remoteMembers list (size={})",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Added {2} to remoteMembers list (size={3})",
localMember,
currentPeriod,
member,
@@ -298,8 +314,9 @@ private void spreadGossipsTo(long period, Member member) {
.subscribe(
null,
ex ->
- LOGGER.debug(
- "[{}][{}] Failed to send GossipReq({}) to {}, cause: {}",
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][{1}] Failed to send GossipReq({2}) to {3}, cause: {4}",
localMember,
period,
message,
diff --git a/cluster/src/main/java/io/scalecube/cluster/membership/MembershipProtocolImpl.java b/cluster/src/main/java/io/scalecube/cluster/membership/MembershipProtocolImpl.java
index 5c73af81..855319aa 100644
--- a/cluster/src/main/java/io/scalecube/cluster/membership/MembershipProtocolImpl.java
+++ b/cluster/src/main/java/io/scalecube/cluster/membership/MembershipProtocolImpl.java
@@ -16,6 +16,8 @@
import io.scalecube.cluster.metadata.MetadataStore;
import io.scalecube.cluster.transport.api.Message;
import io.scalecube.cluster.transport.api.Transport;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
@@ -39,8 +41,6 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import reactor.core.Disposable;
import reactor.core.Disposables;
import reactor.core.publisher.Flux;
@@ -52,7 +52,7 @@
@SuppressWarnings({"FieldCanBeLocal", "unused"})
public final class MembershipProtocolImpl implements MembershipProtocol {
- private static final Logger LOGGER = LoggerFactory.getLogger(MembershipProtocol.class);
+ private static final Logger LOGGER = System.getLogger(MembershipProtocol.class.getName());
private enum MembershipUpdateReason {
FAILURE_DETECTOR_EVENT,
@@ -142,22 +142,30 @@ public MembershipProtocolImpl(
.publishOn(scheduler)
.subscribe(
this::onMessage,
- ex -> LOGGER.error("[{}][onMessage][error] cause:", localMember, ex)),
+ ex ->
+ LOGGER.log(Level.ERROR, "[{0}][onMessage][error] cause:", localMember, ex)),
failureDetector
.listen() // Listen to events from failure detector
.publishOn(scheduler)
.subscribe(
this::onFailureDetectorEvent,
ex ->
- LOGGER.error(
- "[{}][onFailureDetectorEvent][error] cause:", localMember, ex)),
+ LOGGER.log(
+ Level.ERROR,
+ "[{0}][onFailureDetectorEvent][error] cause:",
+ localMember,
+ ex)),
gossipProtocol
.listen() // Listen to membership gossips
.publishOn(scheduler)
.subscribe(
this::onMembershipGossip,
ex ->
- LOGGER.error("[{}][onMembershipGossip][error] cause:", localMember, ex))));
+ LOGGER.log(
+ Level.DEBUG,
+ "[{0}][onMembershipGossip][error] cause:",
+ localMember,
+ ex))));
}
// Remove duplicates and local address(es)
@@ -197,7 +205,7 @@ private boolean checkAddressesNotEqual(String address0, String address1) {
if (!address0.equals(address1)) {
return true;
} else {
- LOGGER.warn("[{}] Filtering out seed address: {}", localMember, address0);
+ LOGGER.log(Level.WARNING, "[{0}] Filtering out seed address: {1}", localMember, address0);
return false;
}
}
@@ -256,7 +264,8 @@ private void start0(MonoSink