diff --git a/pom.xml b/pom.xml
index e21226c..e635be9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,7 +104,7 @@
ch.qos.logback
logback-classic
- 1.2.11
+ 1.4.12
test
@@ -162,14 +162,44 @@
1
true
-
- **/it/**/*Test.java
-
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 2.19.1
+
+ false
+
+ true
+ true
+ true
+ false
+ 1000
+ io.vertx.core.logging.SLF4JLogDelegateFactory
+ PARANOID
+ ${project.build.directory}
+ ${project.version}
+
+
+
+ -Xms512M -Xmx1200M
+
+ 1
+ true
+
+ maven-surefire-plugin
+
+
+ **/it/**/*Test.java
+
+
+
maven-failsafe-plugin
@@ -216,6 +246,21 @@
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+ -Xms512M -Xmx1200M
+
+ --add-opens=java.base/java.nio=ALL-UNNAMED
+ --add-opens=java.base/java.util=ALL-UNNAMED
+ --add-opens=java.base/java.lang.invoke=ALL-UNNAMED
+ --add-opens=java.base/java.lang=ALL-UNNAMED
+
+
+
diff --git a/src/main/java/io/vertx/spi/cluster/ignite/IgniteClusterManager.java b/src/main/java/io/vertx/spi/cluster/ignite/IgniteClusterManager.java
index c57a04e..183fb1e 100644
--- a/src/main/java/io/vertx/spi/cluster/ignite/IgniteClusterManager.java
+++ b/src/main/java/io/vertx/spi/cluster/ignite/IgniteClusterManager.java
@@ -50,7 +50,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
-import java.util.stream.Collectors;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
@@ -197,7 +196,7 @@ public void nodeListener(NodeListener nodeListener) {
@Override
public void getAsyncMap(String name, Promise> promise) {
- vertx.>executeBlocking(prom -> prom.complete(new AsyncMapImpl<>(getCache(name), vertx))).onComplete(promise);
+ vertx.>executeBlocking(() -> new AsyncMapImpl<>(getCache(name), vertx)).onComplete(promise);
}
@Override
@@ -207,7 +206,7 @@ public Map getSyncMap(String name) {
@Override
public void getLockWithTimeout(String name, long timeout, Promise promise) {
- vertx.executeBlocking(prom -> {
+ vertx.executeBlocking(() -> {
IgniteSemaphore semaphore = ignite.semaphore(LOCK_SEMAPHORE_PREFIX + name, 1, true, true);
boolean locked;
long remaining = timeout;
@@ -217,7 +216,7 @@ public void getLockWithTimeout(String name, long timeout, Promise promise)
remaining = remaining - TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, NANOSECONDS);
} while (!locked && remaining > 0);
if (locked) {
- prom.complete(new LockImpl(semaphore, lockReleaseExec));
+ return new LockImpl(semaphore, lockReleaseExec);
} else {
throw new VertxException("Timed out waiting to get lock " + name);
}
@@ -226,7 +225,7 @@ public void getLockWithTimeout(String name, long timeout, Promise promise)
@Override
public void getCounter(String name, Promise promise) {
- vertx.executeBlocking(prom -> prom.complete(new CounterImpl(ignite.atomicLong(name, 0, true)))).onComplete(promise);
+ vertx.executeBlocking(() -> new CounterImpl(ignite.atomicLong(name, 0, true))).onComplete(promise);
}
@Override
@@ -240,9 +239,9 @@ public void setNodeInfo(NodeInfo nodeInfo, Promise promise) {
this.nodeInfo = nodeInfo;
}
IgniteNodeInfo value = new IgniteNodeInfo(nodeInfo);
- vertx.executeBlocking(prom -> {
+ vertx.executeBlocking(() -> {
nodeInfoMap.put(nodeId, value);
- prom.complete();
+ return null;
}, false).onComplete(promise);
}
@@ -270,8 +269,15 @@ public void getNodeInfo(String id, Promise promise) {
@Override
public List getNodes() {
try {
- return ignite.cluster().nodes().stream()
- .map(IgniteClusterManager::nodeId).collect(Collectors.toList());
+ Collection nodes = ignite.cluster().nodes();
+ List nodeIds;
+ synchronized (nodes) {
+ nodeIds = new ArrayList<>(nodes.size());
+ for (ClusterNode node : nodes) {
+ nodeIds.add(nodeId(node));
+ }
+ }
+ return nodeIds;
} catch (IllegalStateException e) {
log.debug(e.getMessage());
return Collections.emptyList();
@@ -280,7 +286,7 @@ public List getNodes() {
@Override
public void join(Promise promise) {
- vertx.executeBlocking(prom -> {
+ vertx.executeBlocking(() -> {
synchronized (monitor) {
if (!active) {
active = true;
@@ -303,14 +309,13 @@ public void join(Promise promise) {
return false;
}
- vertx.executeBlocking(f -> {
+ vertx.executeBlocking(() -> {
String id = nodeId(((DiscoveryEvent) event).eventNode());
switch (event.type()) {
case EVT_NODE_JOINED:
notifyNodeListener(listener -> listener.nodeAdded(id));
log.debug("node " + id + " joined the cluster");
- f.complete();
- break;
+ return null;
case EVT_NODE_LEFT:
case EVT_NODE_FAILED:
if (cleanNodeInfos(id)) {
@@ -318,8 +323,7 @@ public void join(Promise promise) {
}
notifyNodeListener(listener -> listener.nodeLeft(id));
log.debug("node " + id + " left the cluster");
- f.complete();
- break;
+ return null;
case EVT_NODE_SEGMENTED:
if (customIgnite || !shutdownOnSegmentation) {
log.warn("node got segmented");
@@ -327,10 +331,9 @@ public void join(Promise promise) {
log.warn("node got segmented and will be shut down");
vertx.close();
}
- f.fail(new IllegalStateException("node is stopped"));
- break;
+ throw new IllegalStateException("node is stopped");
default:
- f.fail("event not known");
+ throw new IllegalStateException("event not known");
}
});
@@ -343,18 +346,18 @@ public void join(Promise promise) {
try {
MILLISECONDS.sleep(delayAfterStart);
- prom.complete();
} catch (InterruptedException e) {
- prom.fail(e);
+ throw new IllegalStateException(e);
}
}
+ return null;
}
}).onComplete(promise);
}
@Override
public void leave(Promise promise) {
- vertx.executeBlocking(prom -> {
+ vertx.executeBlocking(() -> {
synchronized (monitor) {
if (active) {
active = false;
@@ -370,12 +373,10 @@ public void leave(Promise promise) {
} catch (Exception e) {
log.error(e);
}
- subsMapHelper = null;
- nodeInfoMap = null;
}
}
- prom.complete();
+ return null;
}).onComplete(promise);
}
@@ -386,39 +387,29 @@ public boolean isActive() {
@Override
public void addRegistration(String address, RegistrationInfo registrationInfo, Promise promise) {
- vertx.executeBlocking(prom -> {
- subsMapHelper.put(address, registrationInfo)
- .onComplete(prom);
- }, false).onComplete(promise);
+ subsMapHelper.put(address, registrationInfo)
+ .onComplete(promise);
}
@Override
public void removeRegistration(String address, RegistrationInfo registrationInfo, Promise promise) {
- vertx.executeBlocking(prom -> {
- subsMapHelper.remove(address, registrationInfo, prom);
- }, false).onComplete(promise);
+ subsMapHelper.remove(address, registrationInfo, promise);
}
@Override
public void getRegistrations(String address, Promise> promise) {
- vertx.>executeBlocking(prom -> {
- subsMapHelper.get(address, prom);
- }, false).onComplete(promise);
+ subsMapHelper.get(address, promise);
}
private void cleanSubs(String id) {
- try {
- subsMapHelper.removeAllForNode(id);
- } catch (IllegalStateException | CacheException e) {
- //ignore
- }
+ subsMapHelper.removeAllForNode(id);
}
private boolean cleanNodeInfos(String nid) {
try {
return nodeInfoMap.remove(nid);
} catch (IllegalStateException | CacheException e) {
- //ignore
+ log.warn("Could not remove nodeInfo (" + nid + "): " + e.getMessage());
}
return false;
}
@@ -519,7 +510,7 @@ private CounterImpl(IgniteAtomicLong cnt) {
@Override
public Future get() {
- return vertx.executeBlocking(fut -> fut.complete(cnt.get()));
+ return vertx.executeBlocking(cnt::get);
}
@Override
@@ -530,7 +521,7 @@ public void get(Handler> handler) {
@Override
public Future incrementAndGet() {
- return vertx.executeBlocking(fut -> fut.complete(cnt.incrementAndGet()));
+ return vertx.executeBlocking(cnt::incrementAndGet);
}
@Override
@@ -541,7 +532,7 @@ public void incrementAndGet(Handler> handler) {
@Override
public Future getAndIncrement() {
- return vertx.executeBlocking(fut -> fut.complete(cnt.getAndIncrement()));
+ return vertx.executeBlocking(cnt::getAndIncrement);
}
@Override
@@ -552,7 +543,7 @@ public void getAndIncrement(Handler> handler) {
@Override
public Future decrementAndGet() {
- return vertx.executeBlocking(fut -> fut.complete(cnt.decrementAndGet()));
+ return vertx.executeBlocking(cnt::decrementAndGet);
}
@Override
@@ -563,7 +554,7 @@ public void decrementAndGet(Handler> handler) {
@Override
public Future addAndGet(long value) {
- return vertx.executeBlocking(fut -> fut.complete(cnt.addAndGet(value)));
+ return vertx.executeBlocking(() -> cnt.addAndGet(value));
}
@Override
@@ -574,7 +565,7 @@ public void addAndGet(long value, Handler> handler) {
@Override
public Future getAndAdd(long value) {
- return vertx.executeBlocking(fut -> fut.complete(cnt.getAndAdd(value)));
+ return vertx.executeBlocking(() -> cnt.getAndAdd(value));
}
@Override
@@ -585,7 +576,7 @@ public void getAndAdd(long value, Handler> handler) {
@Override
public Future compareAndSet(long expected, long value) {
- return vertx.executeBlocking(fut -> fut.complete(cnt.compareAndSet(expected, value)));
+ return vertx.executeBlocking(() -> cnt.compareAndSet(expected, value));
}
@Override
diff --git a/src/main/java/io/vertx/spi/cluster/ignite/impl/AsyncMapImpl.java b/src/main/java/io/vertx/spi/cluster/ignite/impl/AsyncMapImpl.java
index cd7b7d7..3198ec6 100644
--- a/src/main/java/io/vertx/spi/cluster/ignite/impl/AsyncMapImpl.java
+++ b/src/main/java/io/vertx/spi/cluster/ignite/impl/AsyncMapImpl.java
@@ -135,16 +135,16 @@ public Future> values() {
@Override
public Future