diff --git a/.tool-versions b/.tool-versions index 78e0126b..f5ccfb03 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,4 +1,3 @@ -direnv 2.32.1 -java zulu-17.38.21 -docker-compose 1.29.2 -gradle 7.6 +direnv 2.32.2 +java zulu-17.40.19 +gradle 8.0.1 diff --git a/aeron-core/build.gradle.kts b/aeron-core/build.gradle.kts new file mode 100644 index 00000000..83f678fc --- /dev/null +++ b/aeron-core/build.gradle.kts @@ -0,0 +1,70 @@ + +plugins { + application + checkstyle +} + +val generatedDir = file("${buildDir}/generated/src/main/java") +val codecGeneration = configurations.create("codecGeneration") + +dependencies { + "codecGeneration"(libs.sbe) + checkstyle(libs.checkstyle) + implementation(libs.agrona) + implementation(libs.aeron) + implementation(libs.slf4j) + implementation(libs.logback) +} + +sourceSets { + main { + java.srcDirs("src/main/java", generatedDir) + } +} + +tasks { + + task ("uberJar", Jar::class) { + group = "uber" + manifest { + attributes["Main-Class"]="io.aeron.samples.admin.Admin" + } + archiveClassifier.set("uber") + from(sourceSets.main.get().output) + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + dependsOn(configurations.runtimeClasspath) + from({ + configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) } + }) + } + + task("generateCodecs", JavaExec::class) { + group = "sbe" + val codecsFile = "src/main/resources/messages.xml" + val sbeFile = "src/main/resources/sbe/sbe.xsd" + inputs.files(codecsFile, sbeFile) + outputs.dir(generatedDir) + classpath = codecGeneration + mainClass.set("uk.co.real_logic.sbe.SbeTool") + args = listOf(codecsFile) + systemProperties["sbe.output.dir"] = generatedDir + systemProperties["sbe.target.language"] = "Java" + systemProperties["sbe.validation.xsd"] = sbeFile + systemProperties["sbe.validation.stop.on.error"] = "true" + outputs.dir(generatedDir) + } + + compileJava { + dependsOn("generateCodecs") + } +} + +testing { + suites { + // Configure the built-in test suite + val test by getting(JvmTestSuite::class) { + // Use JUnit Jupiter test framework + useJUnitJupiter(libs.versions.junitVersion.get()) + } + } +} diff --git a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/Constants.java b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/Constants.java index 762dbc1d..2e3f60df 100644 --- a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/Constants.java +++ b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/Constants.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/Client.java b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/Client.java index baa4cc83..602ec165 100644 --- a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/Client.java +++ b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/Client.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ public class Client { - public static void main(String[] args) + public static void main(final String[] args) { final IdleStrategy idleStrategyClient = new SleepingMillisIdleStrategy(); final ShutdownSignalBarrier barrier = new ShutdownSignalBarrier(); @@ -49,8 +49,8 @@ public static void main(String[] args) System.out.println(mediaDriver.aeronDirectoryName()); //Construct the client agent - ClientAgent clientAgent = new ClientAgent(aeron, barrier); - AgentRunner clientAgentRunner = new AgentRunner(idleStrategyClient, Throwable::printStackTrace, + final ClientAgent clientAgent = new ClientAgent(aeron, barrier); + final AgentRunner clientAgentRunner = new AgentRunner(idleStrategyClient, Throwable::printStackTrace, null, clientAgent); AgentRunner.startOnThread(clientAgentRunner); diff --git a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/ClientAgent.java b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/ClientAgent.java index 598d31fb..d63fe161 100644 --- a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/ClientAgent.java +++ b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/ClientAgent.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ public class ClientAgent implements Agent private ExclusivePublication publication; private Subscription subscription; - public ClientAgent(Aeron aeron, ShutdownSignalBarrier barrier) + public ClientAgent(final Aeron aeron, final ShutdownSignalBarrier barrier) { this.demuxer = new ClientDemuxer(barrier); this.aeron = aeron; @@ -150,18 +150,19 @@ public String roleName() return "client"; } - private void send(DirectBuffer buffer, int length) + private void send(final DirectBuffer buffer, final int length) { int retries = 3; do { //in this example, the offset it always zero. This will not always be the case. - long result = publication.offer(buffer, 0, length); + final long result = publication.offer(buffer, 0, length); if (result > 0) { break; - } else + } + else { log.info("aeron returned {} on offer", result); } diff --git a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/ClientDemuxer.java b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/ClientDemuxer.java index 2c390d28..a0746c23 100644 --- a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/ClientDemuxer.java +++ b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/client/ClientDemuxer.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ public class ClientDemuxer implements FragmentHandler private final MessageHeaderDecoder headerDecoder; private final ShutdownSignalBarrier barrier; - public ClientDemuxer(ShutdownSignalBarrier barrier) + public ClientDemuxer(final ShutdownSignalBarrier barrier) { this.barrier = barrier; this.responseEvent = new RpcResponseEventDecoder(); @@ -42,7 +42,7 @@ public ClientDemuxer(ShutdownSignalBarrier barrier) } @Override - public void onFragment(DirectBuffer buffer, int offset, int length, Header header) + public void onFragment(final DirectBuffer buffer, final int offset, final int length, final Header header) { headerDecoder.wrap(buffer, offset); @@ -50,7 +50,7 @@ public void onFragment(DirectBuffer buffer, int offset, int length, Header heade { case RpcResponseEventEncoder.TEMPLATE_ID: responseEvent.wrap(buffer, offset + headerDecoder.encodedLength(), - headerDecoder.blockLength(), headerDecoder.version()); + headerDecoder.blockLength(), headerDecoder.version()); logger.info("Received {}", responseEvent.result()); barrier.signal(); break; diff --git a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/Server.java b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/Server.java index 383b87a4..07ca5d5b 100644 --- a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/Server.java +++ b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/Server.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public class Server { private static final Logger LOGGER = LoggerFactory.getLogger(Server.class); - public static void main(String[] args) + public static void main(final String[] args) { final IdleStrategy idleStrategy = new SleepingMillisIdleStrategy(); final ShutdownSignalBarrier barrier = new ShutdownSignalBarrier(); @@ -53,13 +53,11 @@ public static void main(String[] args) LOGGER.info("Dir {}", mediaDriver.aeronDirectoryName()); //Construct the server agent - ServerAgent serverAgent = new ServerAgent(aeron, barrier); - AgentRunner serverAgentRunner = new AgentRunner(idleStrategy, Throwable::printStackTrace, + final ServerAgent serverAgent = new ServerAgent(aeron, barrier); + final AgentRunner serverAgentRunner = new AgentRunner(idleStrategy, Throwable::printStackTrace, null, serverAgent); AgentRunner.startOnThread(serverAgentRunner); - - //Await shutdown signal barrier.await(); diff --git a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/ServerAgent.java b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/ServerAgent.java index f6c03ea2..b3effcf1 100644 --- a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/ServerAgent.java +++ b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/ServerAgent.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ public class ServerAgent implements Agent private final ServerDemuxer demuxer; private Subscription subscription; - public ServerAgent(Aeron aeron, ShutdownSignalBarrier barrier) + public ServerAgent(final Aeron aeron, final ShutdownSignalBarrier barrier) { this.aeron = aeron; this.demuxer = new ServerDemuxer(aeron, barrier); diff --git a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/ServerDemuxer.java b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/ServerDemuxer.java index 6b48557c..5239d631 100644 --- a/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/ServerDemuxer.java +++ b/aeron-core/src/main/java/com/aeroncookbook/aeron/rpc/server/ServerDemuxer.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public class ServerDemuxer implements FragmentHandler private final ExpandableDirectByteBuffer buffer; private Publication publication; - public ServerDemuxer(Aeron aeron, ShutdownSignalBarrier barrier) + public ServerDemuxer(final Aeron aeron, final ShutdownSignalBarrier barrier) { this.connectRequest = new RpcConnectRequestDecoder(); this.requestMethod = new RpcRequestMethodDecoder(); @@ -59,7 +59,7 @@ public ServerDemuxer(Aeron aeron, ShutdownSignalBarrier barrier) } @Override - public void onFragment(DirectBuffer buffer, int offset, int length, Header header) + public void onFragment(final DirectBuffer buffer, final int offset, final int length, final Header header) { headerDecoder.wrap(buffer, offset); final int headerLength = headerDecoder.encodedLength(); @@ -70,14 +70,14 @@ public void onFragment(DirectBuffer buffer, int offset, int length, Header heade { case RpcConnectRequestDecoder.TEMPLATE_ID: connectRequest.wrap(buffer, offset + headerLength, - actingLength, actingVersion); + actingLength, actingVersion); final int streamId = connectRequest.returnConnectStream(); final String uri = connectRequest.returnConnectUri(); blockingOpenConnection(streamId, uri); break; case RpcRequestMethodDecoder.TEMPLATE_ID: requestMethod.wrap(buffer, offset + headerLength, - actingLength, actingVersion); + actingLength, actingVersion); final String parameters = requestMethod.parameters(); final String correlation = requestMethod.correlation(); respond(parameters, correlation); @@ -87,7 +87,7 @@ public void onFragment(DirectBuffer buffer, int offset, int length, Header heade } } - private void respond(String parameters, String correlation) + private void respond(final String parameters, final String correlation) { final String returnValue = parameters.toUpperCase(); @@ -100,13 +100,15 @@ private void respond(String parameters, String correlation) int retries = 3; do { - long result = publication.offer(buffer, 0, headerEncoder.encodedLength() + responseEvent.encodedLength()); + final long result = publication.offer(buffer, 0, headerEncoder.encodedLength() + + responseEvent.encodedLength()); if (result > 0) { //shutdown once the result is sent barrier.signal(); break; - } else + } + else { log.warn("aeron returned {}", result); } @@ -114,7 +116,7 @@ private void respond(String parameters, String correlation) while (--retries > 0); } - private void blockingOpenConnection(int streamId, String uri) + private void blockingOpenConnection(final int streamId, final String uri) { log.info("Received connect request with response URI {} stream {}", uri, streamId); publication = aeron.addExclusivePublication(uri, streamId); diff --git a/aeron-core/src/main/resources/logback.xml b/aeron-core/src/main/resources/logback.xml index 190d051f..687771da 100644 --- a/aeron-core/src/main/resources/logback.xml +++ b/aeron-core/src/main/resources/logback.xml @@ -1,5 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000..828b1387 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml new file mode 100644 index 00000000..b9d2ddbc --- /dev/null +++ b/config/checkstyle/suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/config/suppressions.xml b/config/suppressions.xml deleted file mode 100644 index ca7786eb..00000000 --- a/config/suppressions.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - diff --git a/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/ConnectRequestSpec.java b/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/ConnectRequestSpec.java index c0503752..6a7388d2 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/ConnectRequestSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/ConnectRequestSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/RequestMethodSpec.java b/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/RequestMethodSpec.java index 66b2e179..434b0567 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/RequestMethodSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/RequestMethodSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/ResponseEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/ResponseEventSpec.java index ff6474ed..340f3573 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/ResponseEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/aeron/rpc/ResponseEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/async/CancelTimerCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/async/CancelTimerCommandSpec.java index 1aa66923..06f43f90 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/async/CancelTimerCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/async/CancelTimerCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/async/ExitCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/async/ExitCommandSpec.java index 28600ff7..3a0f1a02 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/async/ExitCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/async/ExitCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/async/NewTimerCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/async/NewTimerCommandSpec.java index 83cc4c48..35559a17 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/async/NewTimerCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/async/NewTimerCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/async/TimerCanceledEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/async/TimerCanceledEventSpec.java index eba11035..c0b782d0 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/async/TimerCanceledEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/async/TimerCanceledEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/async/TimerFiredEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/async/TimerFiredEventSpec.java index 0c9be9ad..a95877ba 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/async/TimerFiredEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/async/TimerFiredEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/AcceptRfqCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/AcceptRfqCommandSpec.java index ad6758ad..af37af7f 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/AcceptRfqCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/AcceptRfqCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CancelRfqCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CancelRfqCommandSpec.java index 9cc8c32e..72d511dc 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CancelRfqCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CancelRfqCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CounterRfqCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CounterRfqCommandSpec.java index 94dbc901..f2ee73db 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CounterRfqCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CounterRfqCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CreateRfqCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CreateRfqCommandSpec.java index bcee123e..2549a075 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CreateRfqCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/CreateRfqCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/DisconnectRfqUserCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/DisconnectRfqUserCommandSpec.java index c0bb423f..17214778 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/DisconnectRfqUserCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/DisconnectRfqUserCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/GroupConstants.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/GroupConstants.java index f2bb584e..e58d1a35 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/GroupConstants.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/GroupConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/QuoteRfqCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/QuoteRfqCommandSpec.java index 6d14480a..dfdcca01 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/QuoteRfqCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/QuoteRfqCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RejectRfqCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RejectRfqCommandSpec.java index c569da2a..d2d8a9ff 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RejectRfqCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RejectRfqCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqAcceptedEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqAcceptedEventSpec.java index 02d8c1de..f2f7b767 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqAcceptedEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqAcceptedEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqCanceledEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqCanceledEventSpec.java index 1064058e..346dd4b2 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqCanceledEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqCanceledEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqCreatedEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqCreatedEventSpec.java index c600c000..0d5eda16 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqCreatedEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqCreatedEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqErrorEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqErrorEventSpec.java index 73ab6c18..90239b80 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqErrorEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqErrorEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqExpiredEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqExpiredEventSpec.java index 82b008e2..97210b70 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqExpiredEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqExpiredEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqQuotedEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqQuotedEventSpec.java index e7d3e808..271795ae 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqQuotedEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqQuotedEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqRejectedEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqRejectedEventSpec.java index 3493f431..50ee26bb 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqRejectedEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/RfqRejectedEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/Rfq.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/Rfq.java index eeaf9bd9..08ab49f5 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/Rfq.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/Rfq.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqResponseSeq.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqResponseSeq.java index ab08f126..5f0da54a 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqResponseSeq.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqResponseSeq.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqResponses.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqResponses.java index cf879866..e2b20e43 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqResponses.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqResponses.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqSeq.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqSeq.java index ff7d12b6..18dabeb8 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqSeq.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/domain/RfqSeq.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/AddInstrumentCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/AddInstrumentCommandSpec.java index 79ca4a97..04ce70cf 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/AddInstrumentCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/AddInstrumentCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/EnableInstrumentCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/EnableInstrumentCommandSpec.java index 56a312d4..d269e18a 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/EnableInstrumentCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/EnableInstrumentCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/InstrumentRepositorySpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/InstrumentRepositorySpec.java index af029329..cf1274a5 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/InstrumentRepositorySpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/InstrumentRepositorySpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/InstrumentSeq.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/InstrumentSeq.java index ceff7e62..eec9b76a 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/InstrumentSeq.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rfq/instrument/InstrumentSeq.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/AddCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/AddCommandSpec.java index c30ecc0b..28a34f7c 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/AddCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/AddCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/CurrentValueEventSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/CurrentValueEventSpec.java index e35926e5..97b0b0d7 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/CurrentValueEventSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/CurrentValueEventSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/MultiplyCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/MultiplyCommandSpec.java index 11c35e66..794d9451 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/MultiplyCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/MultiplyCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/SetCommandSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/SetCommandSpec.java index 95fa599f..dc76026d 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/SetCommandSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/SetCommandSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/SnapshotSpec.java b/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/SnapshotSpec.java index ce96b106..a6483f23 100644 --- a/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/SnapshotSpec.java +++ b/eider-spec/src/main/java/com/aeroncookbook/cluster/rsm/SnapshotSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..4c12fe41 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,30 @@ +[versions] +junitVersion = "5.9.2" +checkstyleVersion = "10.7.0" +aeronVersion = "1.40.0" +sbeVersion = "1.27.0" +agronaVersion = "1.17.1" +slf4jVersion = "2.0.6" +logbackVersion = "1.4.5" +picocliVersion = "4.7.0" +jlineVersion = "3.22.0" +picoJlineVersion = "4.7.1" +mockitoVersion = "5.1.1" + +[libraries] +aeron = { group = "io.aeron", name = "aeron-all", version.ref = "aeronVersion" } +agrona = { group = "org.agrona", name = "agrona", version.ref = "agronaVersion" } +sbe = { group = "uk.co.real-logic", name = "sbe-tool", version.ref = "sbeVersion" } +jupiterEngine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junitVersion" } +jupiterApi = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junitVersion" } +checkstyle = { group = "com.puppycrawl.tools", name = "checkstyle", version.ref = "checkstyleVersion" } +slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4jVersion" } +logback = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logbackVersion" } +picocli = { group = "info.picocli", name = "picocli", version.ref = "picocliVersion" } +mockito-core = { group = "org.mockito", name="mockito-core", version.ref = "mockitoVersion"} +mockito-junit = { group = "org.mockito", name="mockito-junit-jupiter", version.ref = "mockitoVersion"} +jline = { group = "org.jline", name = "jline", version.ref = "jlineVersion" } +picoJline = { group = "info.picocli", name = "picocli-shell-jline3", version.ref = "picoJlineVersion" } + +[bundles] +testing = [ "jupiterApi", "jupiterEngine", "mockito-core", "mockito-junit"] diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832..943f0cbf 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 070cb702..fc10b601 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb6..65dcd68d 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/gradlew.bat b/gradlew.bat index 53a6b238..6689b85b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/ipc-core/build.gradle.kts b/ipc-core/build.gradle.kts new file mode 100644 index 00000000..19774010 --- /dev/null +++ b/ipc-core/build.gradle.kts @@ -0,0 +1,23 @@ + +plugins { + application + checkstyle +} + +dependencies { + checkstyle(libs.checkstyle) + implementation(libs.agrona) + implementation(libs.aeron) + implementation(libs.slf4j) + implementation(libs.logback) +} + +testing { + suites { + // Configure the built-in test suite + val test by getting(JvmTestSuite::class) { + // Use JUnit Jupiter test framework + useJUnitJupiter(libs.versions.junitVersion.get()) + } + } +} diff --git a/ipc-core/src/main/java/com/aeroncookbook/ipc/SimplestCase.java b/ipc-core/src/main/java/com/aeroncookbook/ipc/SimplestCase.java index e9d68812..93612762 100644 --- a/ipc-core/src/main/java/com/aeroncookbook/ipc/SimplestCase.java +++ b/ipc-core/src/main/java/com/aeroncookbook/ipc/SimplestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ public class SimplestCase { private static final Logger LOGGER = LoggerFactory.getLogger(SimplestCase.class); - public static void main(String[] args) + public static void main(final String[] args) { final String channel = "aeron:ipc"; final String message = "my message"; @@ -42,9 +42,9 @@ public static void main(String[] args) final UnsafeBuffer unsafeBuffer = new UnsafeBuffer(ByteBuffer.allocate(256)); try (MediaDriver driver = MediaDriver.launch(); - Aeron aeron = Aeron.connect(); - Subscription sub = aeron.addSubscription(channel, 10); - Publication pub = aeron.addPublication(channel, 10)) + Aeron aeron = Aeron.connect(); + Subscription sub = aeron.addSubscription(channel, 10); + Publication pub = aeron.addPublication(channel, 10)) { while (!pub.isConnected()) { @@ -58,8 +58,8 @@ public static void main(String[] args) idle.idle(); } - FragmentHandler handler = (buffer, offset, length, header) -> - LOGGER.info("received:{}", buffer.getStringAscii(offset)); + final FragmentHandler handler = (buffer, offset, length, header) -> + LOGGER.info("received:{}", buffer.getStringAscii(offset)); while (sub.poll(handler, 1) <= 0) { diff --git a/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/ReceiveAgent.java b/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/ReceiveAgent.java index cbf4749f..5efb6558 100644 --- a/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/ReceiveAgent.java +++ b/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/ReceiveAgent.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ public class ReceiveAgent implements Agent private final int sendCount; private final Logger logger = LoggerFactory.getLogger(ReceiveAgent.class); - public ReceiveAgent(final Subscription subscription, ShutdownSignalBarrier barrier, int sendCount) + public ReceiveAgent(final Subscription subscription, final ShutdownSignalBarrier barrier, final int sendCount) { this.subscription = subscription; this.barrier = barrier; @@ -45,14 +45,14 @@ public int doWork() throws Exception return 0; } - private void handler(DirectBuffer buffer, int offset, int length, Header header) + private void handler(final DirectBuffer buffer, final int offset, final int length, final Header header) { final int lastValue = buffer.getInt(offset); if (lastValue >= sendCount) { logger.info("received: {}", lastValue); - //barrier.signal(); + barrier.signal(); } } diff --git a/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/SendAgent.java b/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/SendAgent.java index ce8f5598..f804c583 100644 --- a/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/SendAgent.java +++ b/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/SendAgent.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ public class SendAgent implements Agent private final UnsafeBuffer unsafeBuffer; private int currentCountItem = 1; - public SendAgent(final Publication publication, int sendCount) + public SendAgent(final Publication publication, final int sendCount) { this.publication = publication; this.sendCount = sendCount; diff --git a/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/StartHere.java b/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/StartHere.java index 299ba048..4def0185 100644 --- a/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/StartHere.java +++ b/ipc-core/src/main/java/com/aeroncookbook/ipc/agents/StartHere.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Shaun Laurens. + * Copyright 2019-2023 Shaun Laurens. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public class StartHere { private static final Logger LOGGER = LoggerFactory.getLogger(StartHere.class); - public static void main(String[] args) + public static void main(final String[] args) { final String channel = "aeron:ipc"; final int stream = 10; @@ -43,15 +43,15 @@ public static void main(String[] args) //construct Media Driver, cleaning up media driver folder on start/stop final MediaDriver.Context mediaDriverCtx = new MediaDriver.Context() - .dirDeleteOnStart(true) - .threadingMode(ThreadingMode.SHARED) - .sharedIdleStrategy(new BusySpinIdleStrategy()) - .dirDeleteOnShutdown(true); + .dirDeleteOnStart(true) + .threadingMode(ThreadingMode.SHARED) + .sharedIdleStrategy(new BusySpinIdleStrategy()) + .dirDeleteOnShutdown(true); final MediaDriver mediaDriver = MediaDriver.launchEmbedded(mediaDriverCtx); //construct Aeron, pointing at the media driver's folder final Aeron.Context aeronCtx = new Aeron.Context() - .aeronDirectoryName(mediaDriver.aeronDirectoryName()); + .aeronDirectoryName(mediaDriver.aeronDirectoryName()); final Aeron aeron = Aeron.connect(aeronCtx); LOGGER.info("Dir {}", mediaDriver.aeronDirectoryName()); @@ -66,9 +66,9 @@ public static void main(String[] args) //construct agent runners final AgentRunner sendAgentRunner = new AgentRunner(idleStrategySend, - Throwable::printStackTrace, null, sendAgent); + Throwable::printStackTrace, null, sendAgent); final AgentRunner receiveAgentRunner = new AgentRunner(idleStrategyReceive, - Throwable::printStackTrace, null, receiveAgent); + Throwable::printStackTrace, null, receiveAgent); LOGGER.info("starting"); //start the runners AgentRunner.startOnThread(sendAgentRunner); diff --git a/ipc-core/src/main/resources/logback.xml b/ipc-core/src/main/resources/logback.xml index 190d051f..687771da 100644 --- a/ipc-core/src/main/resources/logback.xml +++ b/ipc-core/src/main/resources/logback.xml @@ -1,5 +1,5 @@