Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellblazer committed Jun 8, 2024
1 parent 5b6bd61 commit a453f4f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.time.Duration;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
Expand All @@ -52,6 +53,7 @@ public class ChurnTest {
private MetricRegistry node0Registry;
private MetricRegistry registry;
private List<View> views;
private ExecutorService executor;

@BeforeAll
public static void beforeClass() throws Exception {
Expand Down Expand Up @@ -79,6 +81,9 @@ public void after() {

gateways.forEach(e -> e.close(Duration.ofSeconds(0)));
gateways.clear();
if (executor != null) {
executor.shutdown();
}
}

@Test
Expand Down Expand Up @@ -260,6 +265,7 @@ public void churn() throws Exception {
}

private void initialize() {
executor = UnsafeExecutors.newVirtualThreadPerTaskExecutor();
var parameters = Parameters.newBuilder().setMaximumTxfr(20).build();
registry = new MetricRegistry();
node0Registry = new MetricRegistry();
Expand All @@ -282,14 +288,15 @@ private void initialize() {
.setMetrics(
new ServerConnectionCacheMetricsImpl(
frist.getAndSet(false) ? node0Registry
: registry)));
: registry)),
executor);
var gateway = new LocalServer(gatewayPrefix, node).router(ServerConnectionCache.newBuilder()
.setTarget(200)
.setMetrics(
new ServerConnectionCacheMetricsImpl(
frist.getAndSet(false)
? node0Registry
: registry)));
? node0Registry : registry)),
executor);
comms.start();
communications.add(comms);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.time.Duration;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
Expand Down Expand Up @@ -62,6 +63,7 @@ public class SwarmTest {
private MetricRegistry node0Registry;
private MetricRegistry registry;
private List<View> views;
private ExecutorService executor;

@BeforeAll
public static void beforeClass() throws Exception {
Expand Down Expand Up @@ -89,6 +91,9 @@ public void after() {

gateways.forEach(e -> e.close(Duration.ofSeconds(1)));
gateways.clear();
if (executor != null) {
executor.shutdown();
}
}

@Test
Expand Down Expand Up @@ -204,6 +209,7 @@ public void swarm() throws Exception {
}

private void initialize() {
executor = UnsafeExecutors.newVirtualThreadPerTaskExecutor();
var parameters = Parameters.newBuilder()
.setMaxPending(50)
.setMaximumTxfr(20)
Expand Down Expand Up @@ -235,14 +241,15 @@ private void initialize() {
.setMetrics(
new ServerConnectionCacheMetricsImpl(
frist.getAndSet(false) ? node0Registry
: registry)));
: registry)),
executor);
var gateway = new LocalServer(gatewayPrefix, node).router(ServerConnectionCache.newBuilder()
.setTarget(200)
.setMetrics(
new ServerConnectionCacheMetricsImpl(
frist.getAndSet(false)
? node0Registry
: registry)));
? node0Registry : registry)),
executor);
comms.start();
communications.add(comms);

Expand Down

0 comments on commit a453f4f

Please sign in to comment.