From c325cfe08804a1655f2dbfb7bda1c5ba04e7699e Mon Sep 17 00:00:00 2001 From: Ryland Degnan Date: Fri, 12 Oct 2018 12:04:33 -0700 Subject: [PATCH] Move aeron transport to separate repo Signed-off-by: Ryland Degnan --- build.gradle | 2 - gradle/wrapper/gradle-wrapper.jar | Bin 54712 -> 54329 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- rsocket-transport-aeron/build.gradle | 38 -- .../rsocket/aeron/AeronDuplexConnection.java | 92 --- .../aeron/client/AeronClientTransport.java | 48 -- .../rsocket/aeron/internal/AeronWrapper.java | 44 -- .../io/rsocket/aeron/internal/Constants.java | 47 -- .../aeron/internal/DefaultAeronWrapper.java | 75 --- .../io/rsocket/aeron/internal/EventLoop.java | 31 - .../aeron/internal/NotConnectedException.java | 30 - .../internal/SingleThreadedEventLoop.java | 96 --- .../aeron/internal/TimedOutException.java | 22 - .../reactivestreams/AeronChannel.java | 96 --- .../reactivestreams/AeronChannelServer.java | 284 --------- .../AeronClientChannelConnector.java | 341 ----------- .../reactivestreams/AeronInSubscriber.java | 210 ------- .../reactivestreams/AeronOutPublisher.java | 221 ------- .../reactivestreams/AeronSocketAddress.java | 88 --- .../ReactiveStreamsRemote.java | 92 --- .../messages/AckConnectDecoder.java | 210 ------- .../messages/AckConnectEncoder.java | 128 ---- .../messages/ConnectDecoder.java | 549 ------------------ .../messages/ConnectEncoder.java | 393 ------------- .../messages/MessageHeaderDecoder.java | 106 ---- .../messages/MessageHeaderEncoder.java | 110 ---- .../messages/MetaAttribute.java | 28 - .../messages/VarDataEncodingDecoder.java | 94 --- .../messages/VarDataEncodingEncoder.java | 82 --- .../aeron/server/AeronServerTransport.java | 66 --- .../services/io.rsocket.uri.UriHandler | 17 - .../main/resources/aeron-channel-schema.xml | 54 -- .../rsocket/aeron/AeronClientSetupRule.java | 62 -- .../test/java/io/rsocket/aeron/AeronPing.java | 68 --- .../io/rsocket/aeron/AeronPongServer.java | 53 -- .../io/rsocket/aeron/ClientServerTest.java | 136 ----- .../io/rsocket/aeron/MediaDriverHolder.java | 45 -- .../reactivestreams/AeronChannelPing.java | 92 --- .../AeronChannelPongServer.java | 48 -- .../reactivestreams/AeronChannelTest.java | 342 ----------- .../AeronClientServerChannelTest.java | 180 ------ .../src/test/resources/log4j.properties | 33 -- settings.gradle | 1 - 43 files changed, 1 insertion(+), 4755 deletions(-) delete mode 100644 rsocket-transport-aeron/build.gradle delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/AeronDuplexConnection.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/client/AeronClientTransport.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/AeronWrapper.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/Constants.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/DefaultAeronWrapper.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/EventLoop.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/NotConnectedException.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/SingleThreadedEventLoop.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/TimedOutException.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronChannel.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelServer.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronClientChannelConnector.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronInSubscriber.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronOutPublisher.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronSocketAddress.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/ReactiveStreamsRemote.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/AckConnectDecoder.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/AckConnectEncoder.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/ConnectDecoder.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/ConnectEncoder.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MessageHeaderDecoder.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MessageHeaderEncoder.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MetaAttribute.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/VarDataEncodingDecoder.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/VarDataEncodingEncoder.java delete mode 100644 rsocket-transport-aeron/src/main/java/io/rsocket/aeron/server/AeronServerTransport.java delete mode 100644 rsocket-transport-aeron/src/main/resources/META-INF/services/io.rsocket.uri.UriHandler delete mode 100644 rsocket-transport-aeron/src/main/resources/aeron-channel-schema.xml delete mode 100644 rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronClientSetupRule.java delete mode 100644 rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronPing.java delete mode 100644 rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronPongServer.java delete mode 100644 rsocket-transport-aeron/src/test/java/io/rsocket/aeron/ClientServerTest.java delete mode 100644 rsocket-transport-aeron/src/test/java/io/rsocket/aeron/MediaDriverHolder.java delete mode 100644 rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelPing.java delete mode 100644 rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelPongServer.java delete mode 100644 rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelTest.java delete mode 100644 rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronClientServerChannelTest.java delete mode 100644 rsocket-transport-aeron/src/test/resources/log4j.properties diff --git a/build.gradle b/build.gradle index b73a2e226..2150baf29 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,6 @@ subprojects { ext['logback.version'] = '1.2.3' ext['findbugs.version'] = '3.0.2' ext['netty.version'] = '4.1.29.Final' - ext['aeron.version'] = '1.11.2' ext['hdrhistogram.version'] = '2.1.10' ext['jctool.version'] = '2.1.2' ext['mockito.version'] = '2.23.0' @@ -52,7 +51,6 @@ subprojects { dependency "ch.qos.logback:logback-classic:${ext['logback.version']}" dependency "com.google.code.findbugs:jsr305:${ext['findbugs.version']}" dependency "io.netty:netty-buffer:${ext['netty.version']}" - dependency "io.aeron:aeron-all:${ext['aeron.version']}" dependency "io.micrometer:micrometer-core:${ext['micrometer.version']}" dependency "org.assertj:assertj-core:${ext['assertj.version']}" dependency "org.hdrhistogram:HdrHistogram:${ext['hdrhistogram.version']}" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ed88a042a287c140a32e1639edfc91b2a233da8c..f6b961fd5a86aa5fbfe90f707c3138408be7c718 100644 GIT binary patch delta 16093 zcmZ9zV|XQ9vp*bXV%xTD+qP{Rdt!6Pb|$tl6Wg|JCzDL(&2yjgf1m3<{bkpxRaM<< zclE-rs@ki-JAQyCa=}n548ID2fPknc39CV8-nrhnf`TOCHnb8r!8TtlfDS-{fN&uK z0Y${X#3^_{uBM(Bng;qOB|;`U&N`~~f-4qm35>&{uCT5Mb(<}dv>ly9s10jb$bx)^ ze0yZ{%LUW!5ZBQVv@=ZgxGrP9|E<-l*y4?R8Bm5YiIK?HGJo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MTe7$2j4YNgWPd0 ze2atJd5}ZU=xa84kxGm6-X!7IlqvJxu%EP?$!WI3KR;g&o@$3`3Q}OZi{xlnYL#Y3 z6TgrcM+|)^^m=Gtj5E(?<9zh1I8Xni{2+Oo0~oWRNU&f0DqXBD)15+%6$y5~|AMJ~ zB`of+!lAB-E1+~^NqgT^K?WTaVskJmc>i8S=@(Ij9YZK(&{i91f>W>=E1<`-#xTb$ z;e)j%Wc3&{VmWJA{ktvrq1~+m`_c_JH^g0JZKj}`_)f}7B>VxoiKoNm1Z-_4_?^0m z2R_(=X!f4y+m#4dIz)7T8e1gU{%0j)r6 z;C;Xh5HI*S&wQ5JX&m#m`(wz|ucg0J49FHL{4nu?bY*r%`+ebcMfD3W`WT zB?Vld?kGJ3q2k}E%uyi-S@pl-^{5O4tX|UI;XEAcHv-5P6&) z+!4q(E(nop4s18)046M;0z1a>!RdiZ<5mzec0jQZLZIG+7=*dQU$LtPGo$x0koUMA^cAZA{dy!zwQZl{|ox%jt|_JM1}gV zKB}8ZEC?d+zZV#$$Uptlw*pj|!iGTe`#T5lBlrhQ_w{Yn{IINhznsTBEfIp{E3I7&>{0WFx{K=^QTN_UNUtmHa zG*D`W8tQNA9q2fN1p%M*-xsifeKV+p|Ku!7!NI^v{xst7{^vP=B;4=+tD!0x?XO+` z%4YrxjFtMo;QvZ)LIWQMQ3?O%kp9@G@hAQHZ~LCo|Gyjl%angb_y47RKI<=7Y>tfZ zp8)XgAB_%w%DF}U1)|IS3u?U3o3AK9v|XoFEGAG@Glej7Vsek`+*t@<`AhMVAld0;s5@W|9MsaGUNmV Ogj=MCmKgkJ_WuEs-6Qw_ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9a4163a4f..e0b3fb8d7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/rsocket-transport-aeron/build.gradle b/rsocket-transport-aeron/build.gradle deleted file mode 100644 index cf983a9de..000000000 --- a/rsocket-transport-aeron/build.gradle +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id 'java-library' - id 'maven-publish' - id 'com.jfrog.artifactory' - id 'com.jfrog.bintray' -} - -dependencies { - api project(':rsocket-core') - api 'io.aeron:aeron-all' - - implementation 'org.slf4j:slf4j-api' - - testImplementation project(':rsocket-test') - testImplementation 'org.junit.jupiter:junit-jupiter-api' - - // TODO: Remove after JUnit5 migration - testCompileOnly 'junit:junit' - testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' -} - -description = 'Aeron RSocket transport implementation' diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/AeronDuplexConnection.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/AeronDuplexConnection.java deleted file mode 100644 index 644f8e6ab..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/AeronDuplexConnection.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron; - -import io.netty.buffer.Unpooled; -import io.rsocket.DuplexConnection; -import io.rsocket.Frame; -import io.rsocket.aeron.internal.reactivestreams.AeronChannel; -import org.agrona.concurrent.UnsafeBuffer; -import org.reactivestreams.Publisher; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.core.publisher.MonoProcessor; - -/** - * Implementation of {@link DuplexConnection} over Aeron using an {@link - * io.rsocket.aeron.internal.reactivestreams.AeronChannel} - */ -public class AeronDuplexConnection implements DuplexConnection { - private final String name; - private final AeronChannel channel; - private final MonoProcessor onClose; - - public AeronDuplexConnection(String name, AeronChannel channel) { - this.name = name; - this.channel = channel; - this.onClose = MonoProcessor.create(); - } - - @Override - public Mono send(Publisher frame) { - Flux buffers = - Flux.from(frame).map(f -> new UnsafeBuffer(f.content().nioBuffer())); - - return channel.send(buffers); - } - - @Override - public Flux receive() { - return channel - .receive() - .map(b -> Frame.from(Unpooled.wrappedBuffer(b.byteBuffer()))) - .doOnError(Throwable::printStackTrace); - } - - @Override - public void dispose() { - try { - channel.dispose(); - onClose.onComplete(); - } catch (Exception e) { - onClose.onError(e); - } - } - - @Override - public boolean isDisposed() { - return channel.isDisposed(); - } - - @Override - public Mono onClose() { - return onClose; - } - - @Override - public String toString() { - return "AeronDuplexConnection{" - + "name='" - + name - + '\'' - + ", channel=" - + channel - + ", onClose=" - + onClose - + '}'; - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/client/AeronClientTransport.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/client/AeronClientTransport.java deleted file mode 100644 index 970887f98..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/client/AeronClientTransport.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.client; - -import io.rsocket.DuplexConnection; -import io.rsocket.aeron.AeronDuplexConnection; -import io.rsocket.aeron.internal.reactivestreams.AeronChannel; -import io.rsocket.aeron.internal.reactivestreams.AeronClientChannelConnector; -import io.rsocket.transport.ClientTransport; -import java.util.Objects; -import org.reactivestreams.Publisher; -import reactor.core.publisher.Mono; - -/** {@link ClientTransport} implementation that uses Aeron as a transport */ -public class AeronClientTransport implements ClientTransport { - private final AeronClientChannelConnector connector; - private final AeronClientChannelConnector.AeronClientConfig config; - - public AeronClientTransport( - AeronClientChannelConnector connector, AeronClientChannelConnector.AeronClientConfig config) { - Objects.requireNonNull(config); - Objects.requireNonNull(connector); - this.connector = connector; - this.config = config; - } - - @Override - public Mono connect() { - Publisher channelPublisher = connector.apply(config); - - return Mono.from(channelPublisher) - .map(aeronChannel -> new AeronDuplexConnection("client", aeronChannel)); - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/AeronWrapper.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/AeronWrapper.java deleted file mode 100644 index 9434b322c..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/AeronWrapper.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal; - -import io.aeron.Aeron; -import io.aeron.Image; -import io.aeron.Publication; -import io.aeron.Subscription; -import java.util.function.Function; - -/** */ -public interface AeronWrapper { - Aeron getAeron(); - - void availableImageHandler(Function handler); - - void unavailableImageHandlers(Function handler); - - default Subscription addSubscription(String channel, int streamId) { - return getAeron().addSubscription(channel, streamId); - } - - default Publication addPublication(String channel, int streamId) { - return getAeron().addPublication(channel, streamId); - } - - default void close() { - getAeron().close(); - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/Constants.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/Constants.java deleted file mode 100644 index 70ca1ebd4..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/Constants.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal; - -import java.util.concurrent.TimeUnit; -import org.agrona.concurrent.BackoffIdleStrategy; -import org.agrona.concurrent.IdleStrategy; -import org.agrona.concurrent.NoOpIdleStrategy; -import org.agrona.concurrent.SleepingIdleStrategy; - -public final class Constants { - - public static final int SERVER_STREAM_ID = 0; - public static final int CLIENT_STREAM_ID = 1; - public static final int SERVER_MANAGEMENT_STREAM_ID = 10; - public static final int CLIENT_MANAGEMENT_STREAM_ID = 11; - public static final IdleStrategy EVENT_LOOP_IDLE_STRATEGY; - public static final int AERON_MTU_SIZE = Integer.getInteger("aeron.mtu.length", 4096); - - static { - String idlStrategy = System.getProperty("idleStrategy"); - - if (NoOpIdleStrategy.class.getName().equalsIgnoreCase(idlStrategy)) { - EVENT_LOOP_IDLE_STRATEGY = new NoOpIdleStrategy(); - } else if (SleepingIdleStrategy.class.getName().equalsIgnoreCase(idlStrategy)) { - EVENT_LOOP_IDLE_STRATEGY = new SleepingIdleStrategy(TimeUnit.MILLISECONDS.toNanos(10)); - } else { - EVENT_LOOP_IDLE_STRATEGY = new BackoffIdleStrategy(1, 10, 1_000, 100_000); - } - } - - private Constants() {} -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/DefaultAeronWrapper.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/DefaultAeronWrapper.java deleted file mode 100644 index a6d3b7a6b..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/DefaultAeronWrapper.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal; - -import io.aeron.Aeron; -import io.aeron.Image; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArraySet; -import java.util.function.Function; - -/** */ -public class DefaultAeronWrapper implements AeronWrapper { - private Set> availableImageHandlers; - private Set> unavailableImageHandlers; - - private Aeron aeron; - - public DefaultAeronWrapper() { - this.availableImageHandlers = new CopyOnWriteArraySet<>(); - this.unavailableImageHandlers = new CopyOnWriteArraySet<>(); - - Aeron.Context ctx = new Aeron.Context(); - - ctx.availableImageHandler(this::availableImageHandler); - ctx.unavailableImageHandler(this::unavailableImageHandler); - - this.aeron = Aeron.connect(ctx); - } - - public Aeron getAeron() { - return aeron; - } - - public void availableImageHandler(Function handler) { - availableImageHandlers.add(handler); - } - - public void unavailableImageHandlers(Function handler) { - unavailableImageHandlers.add(handler); - } - - private void availableImageHandler(Image image) { - Iterator> iterator = availableImageHandlers.iterator(); - - Set> itemsToRemove = new HashSet<>(); - while (iterator.hasNext()) { - Function handler = iterator.next(); - if (handler.apply(image)) { - itemsToRemove.add(handler); - } - } - - availableImageHandlers.removeAll(itemsToRemove); - } - - private void unavailableImageHandler(Image image) { - unavailableImageHandlers.removeIf(handler -> handler.apply(image)); - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/EventLoop.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/EventLoop.java deleted file mode 100644 index df5f64718..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/EventLoop.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal; - -import java.util.function.IntSupplier; - -/** Interface for an EventLoop used by Aeron */ -public interface EventLoop { - /** - * Executes an IntSupplier that returns a number greater than 0 if it wants the the event loop to - * keep processing items, and zero its okay for the eventloop to execute an idle strategy - * - * @param r signal for roughly how many items could be processed. - * @return whether items could be processed - */ - boolean execute(IntSupplier r); -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/NotConnectedException.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/NotConnectedException.java deleted file mode 100644 index f97413b15..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/NotConnectedException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal; - -public class NotConnectedException extends RuntimeException { - - private static final long serialVersionUID = -5521573868855763403L; - - public NotConnectedException() { - super(); - } - - public NotConnectedException(String message) { - super(message); - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/SingleThreadedEventLoop.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/SingleThreadedEventLoop.java deleted file mode 100644 index 24a02cb44..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/SingleThreadedEventLoop.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal; - -import java.util.concurrent.locks.LockSupport; -import java.util.function.IntSupplier; -import org.agrona.concurrent.IdleStrategy; -import org.agrona.concurrent.OneToOneConcurrentArrayQueue; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** */ -public class SingleThreadedEventLoop implements EventLoop { - private static final Logger logger = LoggerFactory.getLogger(SingleThreadedEventLoop.class); - private final String name; - private final Thread thread; - private final OneToOneConcurrentArrayQueue events = - new OneToOneConcurrentArrayQueue<>(32768); - - public SingleThreadedEventLoop(String name) { - this.name = name; - logger.info("Starting event loop named => {}", name); - - thread = new Thread(new SingleThreadedEventLoopRunnable()); - thread.setDaemon(true); - thread.setName("aeron-single-threaded-event-loop-" + name); - thread.start(); - } - - @Override - public boolean execute(IntSupplier r) { - boolean offer; - - if (thread == Thread.currentThread()) { - offer = events.offer(r); - } else { - synchronized (this) { - offer = events.offer(r); - } - LockSupport.unpark(thread); - } - - return offer; - } - - private int drain() { - int count = 0; - while (!events.isEmpty()) { - IntSupplier poll = events.poll(); - if (poll != null) { - count += poll.getAsInt(); - } - } - - return count; - } - - private class SingleThreadedEventLoopRunnable implements Runnable { - final IdleStrategy idleStrategy = Constants.EVENT_LOOP_IDLE_STRATEGY; - - @Override - public void run() { - while (true) { - try { - int count = drain(); - // if (count > 100) { - // System.out.println(name + " drained..." + count); - // } - idleStrategy.idle(count); - } catch (Throwable t) { - System.err.println("Something bad happened - an error made it to the event loop"); - t.printStackTrace(); - } - } - } - } - - @Override - public String toString() { - return "SingleThreadedEventLoop{" + "name='" + name + '\'' + '}'; - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/TimedOutException.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/TimedOutException.java deleted file mode 100644 index e77eecdfd..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/TimedOutException.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal; - -public class TimedOutException extends RuntimeException { - - private static final long serialVersionUID = 6252022225519863073L; -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronChannel.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronChannel.java deleted file mode 100644 index 5275f0c92..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronChannel.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import io.aeron.Publication; -import io.aeron.Subscription; -import io.rsocket.aeron.internal.EventLoop; -import java.util.Objects; -import org.agrona.DirectBuffer; -import reactor.core.Disposable; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** */ -public class AeronChannel implements ReactiveStreamsRemote.Channel, Disposable { - private final String name; - private final Publication destination; - private final Subscription source; - private final AeronOutPublisher outPublisher; - private final EventLoop eventLoop; - - /** - * Creates on end of a bi-directional channel - * - * @param name name of the channel - * @param destination {@code Publication} to send data to - * @param source Aeron {@code Subscription} to listen to data on - * @param eventLoop {@link EventLoop} used to poll data on - * @param sessionId sessionId between the {@code Publication} and the remote {@code Subscription} - */ - public AeronChannel( - String name, - Publication destination, - Subscription source, - EventLoop eventLoop, - int sessionId) { - this.destination = destination; - this.source = source; - this.name = name; - this.eventLoop = eventLoop; - this.outPublisher = new AeronOutPublisher(name, sessionId, source, eventLoop); - } - - /** - * Subscribes to a stream of DirectBuffers and sends the to an Aeron Publisher - * - * @param in the publisher of buffers. - * @return Mono the completes when all publishers have been sent. - */ - public Mono send(Flux in) { - AeronInSubscriber inSubscriber = new AeronInSubscriber(name, destination); - Objects.requireNonNull(in, "in must not be null"); - return Mono.create( - sink -> in.doOnComplete(sink::success).doOnError(sink::error).subscribe(inSubscriber)); - } - - /** - * Returns ReactiveStreamsRemote.Out of DirectBuffer that can only be subscribed to once per - * channel - * - * @return ReactiveStreamsRemote.Out of DirectBuffer - */ - public Flux receive() { - return outPublisher; - } - - @Override - public void dispose() { - destination.close(); - source.close(); - } - - @Override - public boolean isDisposed() { - return destination.isClosed() && source.isClosed(); - } - - @Override - public String toString() { - return "AeronChannel{" + "name='" + name + '\'' + '}'; - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelServer.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelServer.java deleted file mode 100644 index 3afe64a13..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelServer.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import io.aeron.FragmentAssembler; -import io.aeron.Publication; -import io.aeron.Subscription; -import io.aeron.logbuffer.FragmentHandler; -import io.aeron.logbuffer.Header; -import io.rsocket.Closeable; -import io.rsocket.aeron.internal.AeronWrapper; -import io.rsocket.aeron.internal.Constants; -import io.rsocket.aeron.internal.EventLoop; -import io.rsocket.aeron.internal.NotConnectedException; -import io.rsocket.aeron.internal.reactivestreams.messages.AckConnectEncoder; -import io.rsocket.aeron.internal.reactivestreams.messages.ConnectDecoder; -import io.rsocket.aeron.internal.reactivestreams.messages.MessageHeaderDecoder; -import io.rsocket.aeron.internal.reactivestreams.messages.MessageHeaderEncoder; -import java.net.SocketAddress; -import java.nio.ByteBuffer; -import java.time.Duration; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import org.agrona.DirectBuffer; -import org.agrona.concurrent.UnsafeBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import reactor.core.publisher.Mono; -import reactor.core.publisher.MonoProcessor; - -/** - * Implementation of {@link - * io.rsocket.aeron.internal.reactivestreams.ReactiveStreamsRemote.ChannelServer} that manages - * {@link AeronChannel}s. - */ -public class AeronChannelServer - extends ReactiveStreamsRemote.ChannelServer { - private static final Logger logger = LoggerFactory.getLogger(AeronChannelServer.class); - private final AeronWrapper aeronWrapper; - private final AeronSocketAddress managementSubscriptionSocket; - private final AtomicBoolean started = new AtomicBoolean(false); - private final ConcurrentHashMap serverSubscriptions; - private volatile boolean running = true; - private final EventLoop eventLoop; - private Subscription managementSubscription; - private AeronChannelStartedServer startServer; - - private AeronChannelServer( - AeronChannelConsumer channelConsumer, - AeronWrapper aeronWrapper, - AeronSocketAddress managementSubscriptionSocket, - EventLoop eventLoop) { - super(channelConsumer); - this.aeronWrapper = aeronWrapper; - this.managementSubscriptionSocket = managementSubscriptionSocket; - this.eventLoop = eventLoop; - this.serverSubscriptions = new ConcurrentHashMap<>(); - } - - public static AeronChannelServer create( - AeronChannelConsumer channelConsumer, - AeronWrapper aeronWrapper, - AeronSocketAddress managementSubscriptionSocket, - EventLoop eventLoop) { - return new AeronChannelServer( - channelConsumer, aeronWrapper, managementSubscriptionSocket, eventLoop); - } - - @Override - public AeronChannelStartedServer start() { - if (!started.compareAndSet(false, true)) { - throw new IllegalStateException("server already started"); - } - - logger.debug( - "management server starting on {}, stream id {}", - managementSubscriptionSocket.getChannel(), - Constants.SERVER_MANAGEMENT_STREAM_ID); - - this.managementSubscription = - aeronWrapper.addSubscription( - managementSubscriptionSocket.getChannel(), Constants.SERVER_MANAGEMENT_STREAM_ID); - - this.startServer = new AeronChannelStartedServer(); - - poll(); - - return startServer; - } - - private final FragmentAssembler fragmentAssembler = - new FragmentAssembler( - new FragmentHandler() { - private final MessageHeaderDecoder messageHeaderDecoder = new MessageHeaderDecoder(); - private final ConnectDecoder connectDecoder = new ConnectDecoder(); - private final MessageHeaderEncoder messageHeaderEncoder = new MessageHeaderEncoder(); - private final AckConnectEncoder ackConnectEncoder = new AckConnectEncoder(); - - @Override - public void onFragment(DirectBuffer buffer, int offset, int length, Header header) { - messageHeaderDecoder.wrap(buffer, offset); - - // Do not change the order or remove fields - final int actingBlockLength = messageHeaderDecoder.blockLength(); - final int templateId = messageHeaderDecoder.templateId(); - final int schemaId = messageHeaderDecoder.schemaId(); - final int actingVersion = messageHeaderDecoder.version(); - - if (templateId == ConnectDecoder.TEMPLATE_ID) { - offset += messageHeaderDecoder.encodedLength(); - connectDecoder.wrap(buffer, offset, actingBlockLength, actingVersion); - - // Do not change the order or remove fields - long channelId = connectDecoder.channelId(); - String receivingChannel = connectDecoder.receivingChannel(); - int receivingStreamId = connectDecoder.receivingStreamId(); - String sendingChannel = connectDecoder.sendingChannel(); - int sendingStreamId = connectDecoder.sendingStreamId(); - int clientSessionId = connectDecoder.clientSessionId(); - String clientManagementChannel = connectDecoder.clientManagementChannel(); - - logger.debug( - "server creating a AeronChannel with channel id {} receiving on receivingChannel {}, receivingStreamId {}, sendingChannel {}, sendingStreamId {}", - channelId, - receivingChannel, - receivingStreamId, - sendingChannel, - sendingStreamId); - - // Server sends to receiving Channel - Publication destination = - aeronWrapper.addPublication(receivingChannel, receivingStreamId); - int sessionId = destination.sessionId(); - logger.debug( - "server created publication to channel {}, stream id {}, and session id {}", - receivingChannel, - receivingStreamId, - sessionId); - - // Server listens to sending channel - Subscription source = - serverSubscriptions.computeIfAbsent( - sendingChannel, - s -> aeronWrapper.addSubscription(sendingChannel, sendingStreamId)); - logger.debug( - "server created subscription to channel {}, stream id {}", - sendingChannel, - sendingStreamId); - - AeronChannel aeronChannel = - new AeronChannel("server", destination, source, eventLoop, clientSessionId); - logger.debug( - "server create AeronChannel with destination channel {}, source channel {}, and clientSessionId {}"); - - channelConsumer.accept(aeronChannel); - - Publication managementPublication = - aeronWrapper.addPublication( - clientManagementChannel, Constants.CLIENT_MANAGEMENT_STREAM_ID); - logger.debug( - "server created management publication to channel {}", clientManagementChannel); - - final ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4096); - final UnsafeBuffer directBuffer = new UnsafeBuffer(byteBuffer); - int bufferOffset = 0; - - messageHeaderEncoder - .wrap(directBuffer, bufferOffset) - .blockLength(AckConnectEncoder.BLOCK_LENGTH) - .templateId(AckConnectEncoder.TEMPLATE_ID) - .schemaId(AckConnectEncoder.SCHEMA_ID) - .version(AckConnectEncoder.SCHEMA_VERSION); - - bufferOffset += messageHeaderEncoder.encodedLength(); - - ackConnectEncoder - .wrap(directBuffer, bufferOffset) - .channelId(channelId) - .serverSessionId(destination.sessionId()); - - logger.debug( - "server sending AckConnect message to channel {}", clientManagementChannel); - - long offer; - do { - offer = managementPublication.offer(directBuffer); - if (offer == Publication.CLOSED) { - throw new NotConnectedException(); - } - } while (offer < 0); - } - } - }); - - private int poll() { - int poll; - try { - poll = managementSubscription.poll(fragmentAssembler, 4096); - } finally { - if (running) { - boolean execute = eventLoop.execute(this::poll); - if (!execute) { - running = false; - throw new IllegalStateException("unable to keep polling, eventLoop rejection"); - } - } - } - - return poll; - } - - public interface AeronChannelConsumer - extends ReactiveStreamsRemote.ChannelConsumer {} - - public class AeronChannelStartedServer implements ReactiveStreamsRemote.StartedServer, Closeable { - private final MonoProcessor onClose = MonoProcessor.create(); - - public AeronWrapper getAeronWrapper() { - return aeronWrapper; - } - - public EventLoop getEventLoop() { - return eventLoop; - } - - @Override - public SocketAddress getServerAddress() { - return managementSubscriptionSocket; - } - - @Override - public int getServerPort() { - return managementSubscriptionSocket.getPort(); - } - - @Override - public void awaitShutdown(long duration, TimeUnit durationUnit) { - Duration d = Duration.ofMillis(durationUnit.toMillis(duration)); - onClose().block(d); - } - - @Override - public void awaitShutdown() { - onClose().block(); - } - - @Override - public void shutdown() { - dispose(); - } - - @Override - public void dispose() { - running = false; - managementSubscription.close(); - onClose.onComplete(); - } - - @Override - public boolean isDisposed() { - return onClose.isDisposed(); - } - - @Override - public Mono onClose() { - return onClose; - } - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronClientChannelConnector.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronClientChannelConnector.java deleted file mode 100644 index 7272ecbfc..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronClientChannelConnector.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import io.aeron.FragmentAssembler; -import io.aeron.Publication; -import io.aeron.Subscription; -import io.aeron.logbuffer.FragmentHandler; -import io.aeron.logbuffer.Header; -import io.rsocket.aeron.internal.AeronWrapper; -import io.rsocket.aeron.internal.Constants; -import io.rsocket.aeron.internal.EventLoop; -import io.rsocket.aeron.internal.NotConnectedException; -import io.rsocket.aeron.internal.reactivestreams.messages.AckConnectDecoder; -import io.rsocket.aeron.internal.reactivestreams.messages.ConnectEncoder; -import io.rsocket.aeron.internal.reactivestreams.messages.MessageHeaderDecoder; -import io.rsocket.aeron.internal.reactivestreams.messages.MessageHeaderEncoder; -import java.nio.ByteBuffer; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicLong; -import java.util.function.IntConsumer; -import org.agrona.DirectBuffer; -import org.agrona.concurrent.UnsafeBuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import reactor.core.publisher.Mono; -import reactor.core.publisher.Operators; - -/** Brokers a connection to a remote Aeron server. */ -public class AeronClientChannelConnector - implements ReactiveStreamsRemote.ClientChannelConnector< - AeronClientChannelConnector.AeronClientConfig, AeronChannel>, - AutoCloseable { - - private static final Logger logger = LoggerFactory.getLogger(AeronClientChannelConnector.class); - - private static final AtomicLong CHANNEL_ID_COUNTER = new AtomicLong(); - - private final AeronWrapper aeronWrapper; - - // Subscriptions clients listen to responses on - private final ConcurrentHashMap clientSubscriptions; - private final ConcurrentHashMap serverSessionIdConsumerMap; - - private final Subscription managementSubscription; - - private final EventLoop eventLoop; - - private volatile boolean running = true; - - private AeronClientChannelConnector( - AeronWrapper aeronWrapper, - AeronSocketAddress managementSubscriptionSocket, - EventLoop eventLoop) { - this.aeronWrapper = aeronWrapper; - - logger.debug( - "client creating a management subscription on channel {}, stream id {}", - managementSubscriptionSocket.getChannel(), - Constants.CLIENT_MANAGEMENT_STREAM_ID); - - this.managementSubscription = - aeronWrapper.addSubscription( - managementSubscriptionSocket.getChannel(), Constants.CLIENT_MANAGEMENT_STREAM_ID); - this.eventLoop = eventLoop; - this.clientSubscriptions = new ConcurrentHashMap<>(); - this.serverSessionIdConsumerMap = new ConcurrentHashMap<>(); - - poll(); - } - - public static AeronClientChannelConnector create( - AeronWrapper wrapper, AeronSocketAddress managementSubscriptionSocket, EventLoop eventLoop) { - return new AeronClientChannelConnector(wrapper, managementSubscriptionSocket, eventLoop); - } - - private final FragmentAssembler fragmentAssembler = - new FragmentAssembler( - new FragmentHandler() { - private final MessageHeaderDecoder messageHeaderDecoder = new MessageHeaderDecoder(); - private final AckConnectDecoder ackConnectDecoder = new AckConnectDecoder(); - - @Override - public void onFragment(DirectBuffer buffer, int offset, int length, Header header) { - messageHeaderDecoder.wrap(buffer, offset); - - // Do not change the order or remove fields - final int actingBlockLength = messageHeaderDecoder.blockLength(); - final int templateId = messageHeaderDecoder.templateId(); - final int schemaId = messageHeaderDecoder.schemaId(); - final int actingVersion = messageHeaderDecoder.version(); - - if (templateId == AckConnectDecoder.TEMPLATE_ID) { - logger.debug("client received an ack message on session id {}", header.sessionId()); - offset += messageHeaderDecoder.encodedLength(); - ackConnectDecoder.wrap(buffer, offset, actingBlockLength, actingVersion); - long channelId = ackConnectDecoder.channelId(); - int serverSessionId = ackConnectDecoder.serverSessionId(); - - logger.debug( - "client received ack message for channel id {} and server session id {}", - channelId, - serverSessionId); - - IntConsumer intConsumer = serverSessionIdConsumerMap.remove(channelId); - - if (intConsumer != null) { - intConsumer.accept(serverSessionId); - } else { - throw new IllegalStateException("no channel found for channel id " + channelId); - } - } else { - throw new IllegalStateException("received unknown template id " + templateId); - } - } - }); - - private int poll() { - int poll; - try { - poll = managementSubscription.poll(fragmentAssembler, 4096); - } finally { - if (running) { - boolean execute = eventLoop.execute(this::poll); - if (!execute) { - running = false; - throw new IllegalStateException("unable to keep polling, eventLoop rejection"); - } - } - } - - return poll; - } - - @Override - public Mono apply(AeronClientConfig aeronClientConfig) { - return Mono.from( - subscriber -> { - subscriber.onSubscribe(Operators.emptySubscription()); - final long channelId = CHANNEL_ID_COUNTER.get(); - try { - - logger.debug("Creating new client channel with id {}", channelId); - final Publication destination = - aeronWrapper.addPublication( - aeronClientConfig.sendSocketAddress.getChannel(), - aeronClientConfig.sendStreamId); - int destinationStreamId = destination.streamId(); - - logger.debug( - "Client created publication to {}, on stream id {}, and session id {}", - aeronClientConfig.sendSocketAddress, - aeronClientConfig.sendStreamId, - destination.sessionId()); - - final Subscription source = - clientSubscriptions.computeIfAbsent( - aeronClientConfig.receiveSocketAddress, - address -> { - Subscription subscription = - aeronWrapper.addSubscription( - aeronClientConfig.receiveSocketAddress.getChannel(), - aeronClientConfig.receiveStreamId); - logger.debug( - "Client created subscription to {}, on stream id {}", - aeronClientConfig.receiveSocketAddress, - aeronClientConfig.receiveStreamId); - return subscription; - }); - - IntConsumer sessionIdConsumer = - sessionId -> { - try { - AeronChannel aeronChannel = - new AeronChannel( - "client", destination, source, aeronClientConfig.eventLoop, sessionId); - logger.debug( - "created client AeronChannel for destination {}, source {}, destination stream id {}, source stream id {}, client session id, and server session id {}", - aeronClientConfig.sendSocketAddress, - aeronClientConfig.receiveSocketAddress, - destination.streamId(), - source.streamId(), - destination.sessionId(), - sessionId); - subscriber.onNext(aeronChannel); - subscriber.onComplete(); - } catch (Throwable t) { - subscriber.onError(t); - } - }; - - serverSessionIdConsumerMap.putIfAbsent(channelId, sessionIdConsumer); - - aeronWrapper.unavailableImageHandlers( - image -> { - if (destinationStreamId == image.sessionId()) { - clientSubscriptions.remove(aeronClientConfig.receiveSocketAddress); - return true; - } else { - return false; - } - }); - - Publication managementPublication = - aeronWrapper.addPublication( - aeronClientConfig.sendSocketAddress.getChannel(), - Constants.SERVER_MANAGEMENT_STREAM_ID); - logger.debug( - "Client created management publication to channel {}, stream id {}", - managementPublication.channel(), - managementPublication.streamId()); - - DirectBuffer buffer = - encodeConnectMessage(channelId, aeronClientConfig, destination.sessionId()); - long offer; - do { - offer = managementPublication.offer(buffer); - if (offer == Publication.CLOSED) { - subscriber.onError(new NotConnectedException()); - } - } while (offer < 0); - logger.debug("Client sent create message to {}", managementPublication.channel()); - - } catch (Throwable t) { - logger.error("Error creating a channel to {}", aeronClientConfig); - clientSubscriptions.remove(aeronClientConfig.receiveSocketAddress); - subscriber.onError(t); - } - }); - } - - public DirectBuffer encodeConnectMessage( - long channelId, AeronClientConfig config, int clientSessionId) { - final ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4096); - final UnsafeBuffer directBuffer = new UnsafeBuffer(byteBuffer); - int bufferOffset = 0; - - MessageHeaderEncoder messageHeaderEncoder = new MessageHeaderEncoder(); - - // Do not channel the order - messageHeaderEncoder - .wrap(directBuffer, bufferOffset) - .blockLength(ConnectEncoder.BLOCK_LENGTH) - .templateId(ConnectEncoder.TEMPLATE_ID) - .schemaId(ConnectEncoder.SCHEMA_ID) - .version(ConnectEncoder.SCHEMA_VERSION); - - bufferOffset += messageHeaderEncoder.encodedLength(); - - ConnectEncoder connectEncoder = new ConnectEncoder(); - - // Do not change the order - connectEncoder - .wrap(directBuffer, bufferOffset) - .channelId(channelId) - .receivingChannel(config.receiveSocketAddress.getChannel()) - .receivingStreamId(config.receiveStreamId) - .sendingChannel(config.sendSocketAddress.getChannel()) - .sendingStreamId(config.sendStreamId) - .clientSessionId(clientSessionId) - .clientManagementChannel(managementSubscription.channel()); - - return directBuffer; - } - - public static class AeronClientConfig implements ReactiveStreamsRemote.ClientChannelConfig { - private final AeronSocketAddress receiveSocketAddress; - private final AeronSocketAddress sendSocketAddress; - private final int receiveStreamId; - private final int sendStreamId; - private final EventLoop eventLoop; - - private AeronClientConfig( - AeronSocketAddress receiveSocketAddress, - AeronSocketAddress sendSocketAddress, - int receiveStreamId, - int sendStreamId, - EventLoop eventLoop) { - this.receiveSocketAddress = receiveSocketAddress; - this.sendSocketAddress = sendSocketAddress; - this.receiveStreamId = receiveStreamId; - this.sendStreamId = sendStreamId; - this.eventLoop = eventLoop; - } - - /** - * Creates client a new {@code AeronClientConfig} for a {@link AeronChannel} - * - * @param receiveSocketAddress the address the channels receives data on - * @param sendSocketAddress the address the channel sends data too - * @param receiveStreamId receiving stream id - * @param sendStreamId the sending stream id - * @param eventLoop event loop for this client - * @return new {@code AeronClientConfig} - */ - public static AeronClientConfig create( - AeronSocketAddress receiveSocketAddress, - AeronSocketAddress sendSocketAddress, - int receiveStreamId, - int sendStreamId, - EventLoop eventLoop) { - return new AeronClientConfig( - receiveSocketAddress, sendSocketAddress, receiveStreamId, sendStreamId, eventLoop); - } - - @Override - public String toString() { - return "AeronClientConfig{" - + "receiveSocketAddress=" - + receiveSocketAddress - + ", sendSocketAddress=" - + sendSocketAddress - + ", receiveStreamId=" - + receiveStreamId - + ", sendStreamId=" - + sendStreamId - + ", eventLoop=" - + eventLoop - + '}'; - } - } - - @Override - public void close() { - running = false; - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronInSubscriber.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronInSubscriber.java deleted file mode 100644 index 78cf93c95..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronInSubscriber.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import io.aeron.Publication; -import io.aeron.logbuffer.BufferClaim; -import io.rsocket.aeron.internal.Constants; -import io.rsocket.aeron.internal.NotConnectedException; -import org.agrona.DirectBuffer; -import org.agrona.MutableDirectBuffer; -import org.agrona.concurrent.OneToOneConcurrentArrayQueue; -import org.reactivestreams.Subscriber; -import org.reactivestreams.Subscription; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** */ -public class AeronInSubscriber implements Subscriber { - private static final Logger logger = LoggerFactory.getLogger(AeronInSubscriber.class); - private static final ThreadLocal bufferClaims = - ThreadLocal.withInitial(BufferClaim::new); - private static final int BUFFER_SIZE = 128; - private static final int REFILL = BUFFER_SIZE / 3; - - private static final OneToOneConcurrentArrayQueue> - queues = new OneToOneConcurrentArrayQueue<>(BUFFER_SIZE); - - private final OneToOneConcurrentArrayQueue buffers; - private final String name; - private final Publication destination; - - private Subscription subscription; - - private volatile boolean complete; - private volatile boolean erred = false; - - private volatile long requested; - - public AeronInSubscriber(String name, Publication destination) { - this.name = name; - this.destination = destination; - OneToOneConcurrentArrayQueue poll; - synchronized (queues) { - poll = queues.poll(); - } - buffers = poll != null ? poll : new OneToOneConcurrentArrayQueue<>(BUFFER_SIZE); - } - - @Override - public synchronized void onSubscribe(Subscription subscription) { - this.subscription = subscription; - requested = BUFFER_SIZE; - subscription.request(BUFFER_SIZE); - } - - @Override - public void onNext(DirectBuffer buffer) { - if (!erred) { - if (logger.isTraceEnabled()) { - logger.trace( - name - + " sending to destination => " - + destination.channel() - + " and aeron stream " - + destination.streamId() - + " and session id " - + destination.sessionId()); - } - boolean offer; - synchronized (buffers) { - offer = buffers.offer(buffer); - } - if (!offer) { - onError(new IllegalStateException("missing back-pressure")); - } - - tryEmit(); - } - } - - private boolean emitting = false; - private boolean missed = false; - - void tryEmit() { - synchronized (this) { - if (emitting) { - missed = true; - return; - } - } - - emit(); - } - - void emit() { - try { - for (; ; ) { - synchronized (this) { - missed = false; - } - while (!buffers.isEmpty()) { - DirectBuffer buffer = buffers.poll(); - tryClaimOrOffer(buffer); - requested--; - if (requested < REFILL) { - synchronized (buffers) { - if (!complete) { - long diff = BUFFER_SIZE - requested; - requested = BUFFER_SIZE; - subscription.request(diff); - } - } - } - } - - synchronized (this) { - if (!missed) { - emitting = false; - break; - } - } - } - } catch (Throwable t) { - onError(t); - } - - if (complete && buffers.isEmpty()) { - synchronized (queues) { - queues.offer(buffers); - } - } - } - - private void tryClaimOrOffer(DirectBuffer buffer) { - boolean successful = false; - - int capacity = buffer.capacity(); - if (capacity < Constants.AERON_MTU_SIZE) { - BufferClaim bufferClaim = bufferClaims.get(); - - while (!successful) { - long offer = destination.tryClaim(capacity, bufferClaim); - if (offer >= 0) { - try { - final MutableDirectBuffer b = bufferClaim.buffer(); - int offset = bufferClaim.offset(); - b.putBytes(offset, buffer, 0, capacity); - } finally { - bufferClaim.commit(); - successful = true; - } - } else { - if (offer == Publication.CLOSED) { - onError(new NotConnectedException(name)); - } - - successful = false; - } - } - - } else { - while (!successful) { - long offer = destination.offer(buffer); - - if (offer < 0) { - if (offer == Publication.CLOSED) { - onError(new NotConnectedException(name)); - } - } else { - successful = true; - } - } - } - } - - @Override - public synchronized void onError(Throwable t) { - if (!erred) { - erred = true; - subscription.cancel(); - } - - t.printStackTrace(); - } - - @Override - public synchronized void onComplete() { - complete = true; - tryEmit(); - } - - @Override - public String toString() { - return "AeronInSubscriber{" + "name='" + name + '\'' + '}'; - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronOutPublisher.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronOutPublisher.java deleted file mode 100644 index 7732c3160..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronOutPublisher.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import io.aeron.ControlledFragmentAssembler; -import io.aeron.logbuffer.ControlledFragmentHandler; -import io.aeron.logbuffer.Header; -import io.rsocket.aeron.internal.EventLoop; -import io.rsocket.aeron.internal.NotConnectedException; -import java.nio.ByteBuffer; -import java.util.Objects; -import java.util.function.IntSupplier; -import org.agrona.DirectBuffer; -import org.agrona.concurrent.UnsafeBuffer; -import org.reactivestreams.Subscriber; -import org.reactivestreams.Subscription; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import reactor.core.CoreSubscriber; -import reactor.core.publisher.Flux; - -/** */ -public class AeronOutPublisher extends Flux { - private static final Logger logger = LoggerFactory.getLogger(AeronOutPublisher.class); - private final io.aeron.Subscription source; - private final EventLoop eventLoop; - - private String name; - private volatile long requested; - private volatile long processed; - private Subscriber destination; - private AeronOutProcessorSubscription subscription; - private final int sessionId; - - /** - * Creates a publication for a unique session - * - * @param name publication's name - * @param sessionId sessionId between the source and the remote publication - * @param source Aeron {@code Subscription} publish data from - * @param eventLoop {@link EventLoop} to poll the source with - */ - public AeronOutPublisher( - String name, int sessionId, io.aeron.Subscription source, EventLoop eventLoop) { - this.name = name; - this.source = source; - this.eventLoop = eventLoop; - this.sessionId = sessionId; - } - - @Override - public void subscribe(CoreSubscriber destination) { - Objects.requireNonNull(destination); - synchronized (this) { - if (this.destination != null && subscription.canEmit()) { - throw new IllegalStateException( - "only allows one subscription => channel " - + source.channel() - + " and stream id => " - + source.streamId()); - } - this.destination = destination; - } - - this.subscription = new AeronOutProcessorSubscription(destination); - destination.onSubscribe(subscription); - } - - void onError(Throwable t) { - subscription.erred = true; - if (destination != null) { - destination.onError(t); - } - } - - void cancel() { - if (subscription != null) { - subscription.cancel(); - } - } - - @Override - public String toString() { - return "AeronOutPublisher{" + "name='" + name + '\'' + '}'; - } - - private class AeronOutProcessorSubscription implements Subscription { - private volatile boolean erred = false; - private volatile boolean cancelled = false; - private final Subscriber destination; - private final ControlledFragmentAssembler assembler; - - public AeronOutProcessorSubscription(Subscriber destination) { - this.destination = destination; - this.assembler = new ControlledFragmentAssembler(this::onFragment, 4096); - } - - boolean emitting = false; - boolean missed = false; - - @Override - public void request(long n) { - if (n < 0) { - onError(new IllegalStateException("n must be greater than zero")); - } - - synchronized (AeronOutPublisher.this) { - long r; - if (requested != Long.MAX_VALUE && n > 0) { - r = requested + n; - requested = r < 0 ? Long.MAX_VALUE : r; - } - } - - tryEmit(); - } - - // allocate this once - final IntSupplier supplier = this::emit; - - void tryEmit() { - synchronized (AeronOutPublisher.this) { - if (emitting) { - missed = true; - return; - } - emitting = true; - eventLoop.execute(supplier); - } - } - - ControlledFragmentHandler.Action onFragment( - DirectBuffer buffer, int offset, int length, Header header) { - if (sessionId != header.sessionId()) { - if (source.imageBySessionId(header.sessionId()) == null) { - return ControlledFragmentHandler.Action.CONTINUE; - } - - return ControlledFragmentHandler.Action.ABORT; - } - - try { - ByteBuffer bytes = ByteBuffer.allocate(length); - buffer.getBytes(offset, bytes, length); - - if (canEmit()) { - destination.onNext(new UnsafeBuffer(bytes)); - } - } catch (Throwable t) { - onError(t); - } - - return ControlledFragmentHandler.Action.COMMIT; - } - - int emit() { - int emitted = 0; - for (; ; ) { - synchronized (AeronOutPublisher.this) { - missed = false; - } - - try { - if (source.isClosed()) { - onError(new NotConnectedException(name)); - return 0; - } - - while (processed < requested) { - - int poll = source.controlledPoll(assembler, 4096); - - if (poll < 1) { - break; - } else { - emitted++; - processed++; - } - } - - synchronized (AeronOutPublisher.this) { - emitting = false; - break; - } - - } catch (Throwable t) { - onError(t); - } - } - - if (canEmit()) { - tryEmit(); - } - - return emitted; - } - - @Override - public void cancel() { - cancelled = true; - } - - private boolean canEmit() { - return !cancelled && !erred; - } - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronSocketAddress.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronSocketAddress.java deleted file mode 100644 index ca8926add..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/AeronSocketAddress.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import java.net.SocketAddress; - -/** SocketAddress that represents an Aeron Channel */ -public class AeronSocketAddress extends SocketAddress { - private static final String FORMAT = "%s?endpoint=%s:%d"; - private static final long serialVersionUID = -7691068719112973697L; - private final String protocol; - private final String host; - private final int port; - private final String channel; - - private AeronSocketAddress(String protocol, String host, int port) { - this.protocol = protocol; - this.host = host; - this.port = port; - this.channel = String.format(FORMAT, protocol, host, port); - } - - public static AeronSocketAddress create(String protocol, String host, int port) { - return new AeronSocketAddress(protocol, host, port); - } - - public String getProtocol() { - return protocol; - } - - public String getHost() { - return host; - } - - public int getPort() { - return port; - } - - public String getChannel() { - return channel; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - AeronSocketAddress that = (AeronSocketAddress) o; - - return channel != null ? channel.equals(that.channel) : that.channel == null; - } - - @Override - public int hashCode() { - return channel != null ? channel.hashCode() : 0; - } - - @Override - public String toString() { - return "AeronSocketAddress{" - + "protocol='" - + protocol - + '\'' - + ", host='" - + host - + '\'' - + ", port=" - + port - + ", channel='" - + channel - + '\'' - + '}'; - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/ReactiveStreamsRemote.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/ReactiveStreamsRemote.java deleted file mode 100644 index f2a8666b9..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/ReactiveStreamsRemote.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import io.rsocket.Closeable; -import java.net.SocketAddress; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.function.Function; -import org.reactivestreams.Publisher; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** Interfaces to define a ReactiveStream over a remote channel */ -public interface ReactiveStreamsRemote { - interface Channel { - Mono send(Flux in); - - default Mono send(T t) { - return send(Flux.just(t)); - } - - Flux receive(); - } - - interface ClientChannelConnector> - extends Function> {} - - interface ClientChannelConfig {} - - interface ChannelConsumer> extends Consumer {} - - abstract class ChannelServer> { - protected final C channelConsumer; - - public ChannelServer(C channelConsumer) { - this.channelConsumer = channelConsumer; - } - - public abstract StartedServer start(); - } - - interface StartedServer extends Closeable { - /** - * Address for this server. - * - * @return Address for this server. - */ - SocketAddress getServerAddress(); - - /** - * Port for this server. - * - * @return Port for this server. - */ - int getServerPort(); - - /** - * Blocks till this server shutsdown. - * - *

This does not shutdown the server. - */ - void awaitShutdown(); - - /** - * Blocks till this server shutsdown till the passed duration. - * - *

This does not shutdown the server. - * - * @param duration the number of durationUnit to wait - * @param durationUnit the unit e.g. seconds - */ - void awaitShutdown(long duration, TimeUnit durationUnit); - - /** Initiates the shutdown of this server. */ - void shutdown(); - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/AckConnectDecoder.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/AckConnectDecoder.java deleted file mode 100644 index 626c1f6d8..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/AckConnectDecoder.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated SBE (Simple Binary Encoding) message codec */ - -package io.rsocket.aeron.internal.reactivestreams.messages; - -import org.agrona.DirectBuffer; - -@javax.annotation.Generated( - value = {"io.rsocket.aeron.internal.reactivestreams.messages.AckConnectDecoder"} -) -@SuppressWarnings("all") -public class AckConnectDecoder { - public static final int BLOCK_LENGTH = 12; - public static final int TEMPLATE_ID = 2; - public static final int SCHEMA_ID = 1; - public static final int SCHEMA_VERSION = 0; - - private final AckConnectDecoder parentMessage = this; - private DirectBuffer buffer; - protected int offset; - protected int limit; - protected int actingBlockLength; - protected int actingVersion; - - public int sbeBlockLength() { - return BLOCK_LENGTH; - } - - public int sbeTemplateId() { - return TEMPLATE_ID; - } - - public int sbeSchemaId() { - return SCHEMA_ID; - } - - public int sbeSchemaVersion() { - return SCHEMA_VERSION; - } - - public String sbeSemanticType() { - return ""; - } - - public int offset() { - return offset; - } - - public AckConnectDecoder wrap( - final DirectBuffer buffer, - final int offset, - final int actingBlockLength, - final int actingVersion) { - this.buffer = buffer; - this.offset = offset; - this.actingBlockLength = actingBlockLength; - this.actingVersion = actingVersion; - limit(offset + actingBlockLength); - - return this; - } - - public int encodedLength() { - return limit - offset; - } - - public int limit() { - return limit; - } - - public void limit(final int limit) { - this.limit = limit; - } - - public static int channelIdId() { - return 1; - } - - public static String channelIdMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static long channelIdNullValue() { - return -9223372036854775808L; - } - - public static long channelIdMinValue() { - return -9223372036854775807L; - } - - public static long channelIdMaxValue() { - return 9223372036854775807L; - } - - public long channelId() { - return buffer.getLong(offset + 0, java.nio.ByteOrder.LITTLE_ENDIAN); - } - - public static int serverSessionIdId() { - return 2; - } - - public static String serverSessionIdMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static int serverSessionIdNullValue() { - return -2147483648; - } - - public static int serverSessionIdMinValue() { - return -2147483647; - } - - public static int serverSessionIdMaxValue() { - return 2147483647; - } - - public int serverSessionId() { - return buffer.getInt(offset + 8, java.nio.ByteOrder.LITTLE_ENDIAN); - } - - public String toString() { - return appendTo(new StringBuilder(100)).toString(); - } - - public StringBuilder appendTo(final StringBuilder builder) { - final int originalLimit = limit(); - limit(offset + actingBlockLength); - builder.append("[AckConnect](sbeTemplateId="); - builder.append(TEMPLATE_ID); - builder.append("|sbeSchemaId="); - builder.append(SCHEMA_ID); - builder.append("|sbeSchemaVersion="); - if (actingVersion != SCHEMA_VERSION) { - builder.append(actingVersion); - builder.append('/'); - } - builder.append(SCHEMA_VERSION); - builder.append("|sbeBlockLength="); - if (actingBlockLength != BLOCK_LENGTH) { - builder.append(actingBlockLength); - builder.append('/'); - } - builder.append(BLOCK_LENGTH); - builder.append("):"); - // Token{signal=BEGIN_FIELD, name='channelId', description='The AeronChannel id', id=1, - // version=0, encodedLength=0, offset=0, componentTokenCount=3, - // encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', - // epoch='unix', timeUnit=nanosecond, semanticType='null'}} - // Token{signal=ENCODING, name='int64', description='The AeronChannel id', id=-1, version=0, - // encodedLength=8, offset=0, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, - // primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, - // constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, - // semanticType='null'}} - builder.append("channelId="); - builder.append(channelId()); - builder.append('|'); - // Token{signal=BEGIN_FIELD, name='serverSessionId', description='The session id for the server - // publication', id=2, version=0, encodedLength=0, offset=8, componentTokenCount=3, - // encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', - // epoch='unix', timeUnit=nanosecond, semanticType='null'}} - // Token{signal=ENCODING, name='int32', description='The session id for the server publication', - // id=-1, version=0, encodedLength=4, offset=8, componentTokenCount=1, - // encoding=Encoding{presence=REQUIRED, primitiveType=INT32, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', - // epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.append("serverSessionId="); - builder.append(serverSessionId()); - - limit(originalLimit); - - return builder; - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/AckConnectEncoder.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/AckConnectEncoder.java deleted file mode 100644 index 05fef8487..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/AckConnectEncoder.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated SBE (Simple Binary Encoding) message codec */ - -package io.rsocket.aeron.internal.reactivestreams.messages; - -import org.agrona.MutableDirectBuffer; - -@javax.annotation.Generated( - value = {"io.rsocket.aeron.internal.reactivestreams.messages.AckConnectEncoder"} -) -@SuppressWarnings("all") -public class AckConnectEncoder { - public static final int BLOCK_LENGTH = 12; - public static final int TEMPLATE_ID = 2; - public static final int SCHEMA_ID = 1; - public static final int SCHEMA_VERSION = 0; - - private final AckConnectEncoder parentMessage = this; - private MutableDirectBuffer buffer; - protected int offset; - protected int limit; - protected int actingBlockLength; - protected int actingVersion; - - public int sbeBlockLength() { - return BLOCK_LENGTH; - } - - public int sbeTemplateId() { - return TEMPLATE_ID; - } - - public int sbeSchemaId() { - return SCHEMA_ID; - } - - public int sbeSchemaVersion() { - return SCHEMA_VERSION; - } - - public String sbeSemanticType() { - return ""; - } - - public int offset() { - return offset; - } - - public AckConnectEncoder wrap(final MutableDirectBuffer buffer, final int offset) { - this.buffer = buffer; - this.offset = offset; - limit(offset + BLOCK_LENGTH); - - return this; - } - - public int encodedLength() { - return limit - offset; - } - - public int limit() { - return limit; - } - - public void limit(final int limit) { - this.limit = limit; - } - - public static long channelIdNullValue() { - return -9223372036854775808L; - } - - public static long channelIdMinValue() { - return -9223372036854775807L; - } - - public static long channelIdMaxValue() { - return 9223372036854775807L; - } - - public AckConnectEncoder channelId(final long value) { - buffer.putLong(offset + 0, value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } - - public static int serverSessionIdNullValue() { - return -2147483648; - } - - public static int serverSessionIdMinValue() { - return -2147483647; - } - - public static int serverSessionIdMaxValue() { - return 2147483647; - } - - public AckConnectEncoder serverSessionId(final int value) { - buffer.putInt(offset + 8, value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } - - public String toString() { - return appendTo(new StringBuilder(100)).toString(); - } - - public StringBuilder appendTo(final StringBuilder builder) { - AckConnectDecoder writer = new AckConnectDecoder(); - writer.wrap(buffer, offset, BLOCK_LENGTH, SCHEMA_VERSION); - - return writer.appendTo(builder); - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/ConnectDecoder.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/ConnectDecoder.java deleted file mode 100644 index cd294a48b..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/ConnectDecoder.java +++ /dev/null @@ -1,549 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated SBE (Simple Binary Encoding) message codec */ - -package io.rsocket.aeron.internal.reactivestreams.messages; - -import org.agrona.DirectBuffer; -import org.agrona.MutableDirectBuffer; - -@javax.annotation.Generated( - value = {"io.rsocket.aeron.internal.reactivestreams.messages.ConnectDecoder"} -) -@SuppressWarnings("all") -public class ConnectDecoder { - public static final int BLOCK_LENGTH = 20; - public static final int TEMPLATE_ID = 1; - public static final int SCHEMA_ID = 1; - public static final int SCHEMA_VERSION = 0; - - private final ConnectDecoder parentMessage = this; - private DirectBuffer buffer; - protected int offset; - protected int limit; - protected int actingBlockLength; - protected int actingVersion; - - public int sbeBlockLength() { - return BLOCK_LENGTH; - } - - public int sbeTemplateId() { - return TEMPLATE_ID; - } - - public int sbeSchemaId() { - return SCHEMA_ID; - } - - public int sbeSchemaVersion() { - return SCHEMA_VERSION; - } - - public String sbeSemanticType() { - return ""; - } - - public int offset() { - return offset; - } - - public ConnectDecoder wrap( - final DirectBuffer buffer, - final int offset, - final int actingBlockLength, - final int actingVersion) { - this.buffer = buffer; - this.offset = offset; - this.actingBlockLength = actingBlockLength; - this.actingVersion = actingVersion; - limit(offset + actingBlockLength); - - return this; - } - - public int encodedLength() { - return limit - offset; - } - - public int limit() { - return limit; - } - - public void limit(final int limit) { - this.limit = limit; - } - - public static int channelIdId() { - return 1; - } - - public static String channelIdMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static long channelIdNullValue() { - return -9223372036854775808L; - } - - public static long channelIdMinValue() { - return -9223372036854775807L; - } - - public static long channelIdMaxValue() { - return 9223372036854775807L; - } - - public long channelId() { - return buffer.getLong(offset + 0, java.nio.ByteOrder.LITTLE_ENDIAN); - } - - public static int sendingStreamIdId() { - return 2; - } - - public static String sendingStreamIdMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static int sendingStreamIdNullValue() { - return -2147483648; - } - - public static int sendingStreamIdMinValue() { - return -2147483647; - } - - public static int sendingStreamIdMaxValue() { - return 2147483647; - } - - public int sendingStreamId() { - return buffer.getInt(offset + 8, java.nio.ByteOrder.LITTLE_ENDIAN); - } - - public static int receivingStreamIdId() { - return 3; - } - - public static String receivingStreamIdMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static int receivingStreamIdNullValue() { - return -2147483648; - } - - public static int receivingStreamIdMinValue() { - return -2147483647; - } - - public static int receivingStreamIdMaxValue() { - return 2147483647; - } - - public int receivingStreamId() { - return buffer.getInt(offset + 12, java.nio.ByteOrder.LITTLE_ENDIAN); - } - - public static int clientSessionIdId() { - return 4; - } - - public static String clientSessionIdMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static int clientSessionIdNullValue() { - return -2147483648; - } - - public static int clientSessionIdMinValue() { - return -2147483647; - } - - public static int clientSessionIdMaxValue() { - return 2147483647; - } - - public int clientSessionId() { - return buffer.getInt(offset + 16, java.nio.ByteOrder.LITTLE_ENDIAN); - } - - public static int sendingChannelId() { - return 5; - } - - public static String sendingChannelCharacterEncoding() { - return "UTF-8"; - } - - public static String sendingChannelMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static int sendingChannelHeaderLength() { - return 4; - } - - public int sendingChannelLength() { - final int limit = parentMessage.limit(); - return (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - } - - public int getSendingChannel( - final MutableDirectBuffer dst, final int dstOffset, final int length) { - final int headerLength = 4; - final int limit = parentMessage.limit(); - final int dataLength = - (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - final int bytesCopied = Math.min(length, dataLength); - parentMessage.limit(limit + headerLength + dataLength); - buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied); - - return bytesCopied; - } - - public int getSendingChannel(final byte[] dst, final int dstOffset, final int length) { - final int headerLength = 4; - final int limit = parentMessage.limit(); - final int dataLength = - (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - final int bytesCopied = Math.min(length, dataLength); - parentMessage.limit(limit + headerLength + dataLength); - buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied); - - return bytesCopied; - } - - public String sendingChannel() { - final int headerLength = 4; - final int limit = parentMessage.limit(); - final int dataLength = - (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - parentMessage.limit(limit + headerLength + dataLength); - final byte[] tmp = new byte[dataLength]; - buffer.getBytes(limit + headerLength, tmp, 0, dataLength); - - final String value; - try { - value = new String(tmp, "UTF-8"); - } catch (final java.io.UnsupportedEncodingException ex) { - throw new RuntimeException(ex); - } - - return value; - } - - public static int receivingChannelId() { - return 6; - } - - public static String receivingChannelCharacterEncoding() { - return "UTF-8"; - } - - public static String receivingChannelMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static int receivingChannelHeaderLength() { - return 4; - } - - public int receivingChannelLength() { - final int limit = parentMessage.limit(); - return (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - } - - public int getReceivingChannel( - final MutableDirectBuffer dst, final int dstOffset, final int length) { - final int headerLength = 4; - final int limit = parentMessage.limit(); - final int dataLength = - (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - final int bytesCopied = Math.min(length, dataLength); - parentMessage.limit(limit + headerLength + dataLength); - buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied); - - return bytesCopied; - } - - public int getReceivingChannel(final byte[] dst, final int dstOffset, final int length) { - final int headerLength = 4; - final int limit = parentMessage.limit(); - final int dataLength = - (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - final int bytesCopied = Math.min(length, dataLength); - parentMessage.limit(limit + headerLength + dataLength); - buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied); - - return bytesCopied; - } - - public String receivingChannel() { - final int headerLength = 4; - final int limit = parentMessage.limit(); - final int dataLength = - (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - parentMessage.limit(limit + headerLength + dataLength); - final byte[] tmp = new byte[dataLength]; - buffer.getBytes(limit + headerLength, tmp, 0, dataLength); - - final String value; - try { - value = new String(tmp, "UTF-8"); - } catch (final java.io.UnsupportedEncodingException ex) { - throw new RuntimeException(ex); - } - - return value; - } - - public static int clientManagementChannelId() { - return 6; - } - - public static String clientManagementChannelCharacterEncoding() { - return "UTF-8"; - } - - public static String clientManagementChannelMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static int clientManagementChannelHeaderLength() { - return 4; - } - - public int clientManagementChannelLength() { - final int limit = parentMessage.limit(); - return (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - } - - public int getClientManagementChannel( - final MutableDirectBuffer dst, final int dstOffset, final int length) { - final int headerLength = 4; - final int limit = parentMessage.limit(); - final int dataLength = - (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - final int bytesCopied = Math.min(length, dataLength); - parentMessage.limit(limit + headerLength + dataLength); - buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied); - - return bytesCopied; - } - - public int getClientManagementChannel(final byte[] dst, final int dstOffset, final int length) { - final int headerLength = 4; - final int limit = parentMessage.limit(); - final int dataLength = - (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - final int bytesCopied = Math.min(length, dataLength); - parentMessage.limit(limit + headerLength + dataLength); - buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied); - - return bytesCopied; - } - - public String clientManagementChannel() { - final int headerLength = 4; - final int limit = parentMessage.limit(); - final int dataLength = - (int) (buffer.getInt(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - parentMessage.limit(limit + headerLength + dataLength); - final byte[] tmp = new byte[dataLength]; - buffer.getBytes(limit + headerLength, tmp, 0, dataLength); - - final String value; - try { - value = new String(tmp, "UTF-8"); - } catch (final java.io.UnsupportedEncodingException ex) { - throw new RuntimeException(ex); - } - - return value; - } - - public String toString() { - return appendTo(new StringBuilder(100)).toString(); - } - - public StringBuilder appendTo(final StringBuilder builder) { - final int originalLimit = limit(); - limit(offset + actingBlockLength); - builder.append("[Connect](sbeTemplateId="); - builder.append(TEMPLATE_ID); - builder.append("|sbeSchemaId="); - builder.append(SCHEMA_ID); - builder.append("|sbeSchemaVersion="); - if (actingVersion != SCHEMA_VERSION) { - builder.append(actingVersion); - builder.append('/'); - } - builder.append(SCHEMA_VERSION); - builder.append("|sbeBlockLength="); - if (actingBlockLength != BLOCK_LENGTH) { - builder.append(actingBlockLength); - builder.append('/'); - } - builder.append(BLOCK_LENGTH); - builder.append("):"); - // Token{signal=BEGIN_FIELD, name='channelId', description='The AeronChannel id', id=1, - // version=0, encodedLength=0, offset=0, componentTokenCount=3, - // encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', - // epoch='unix', timeUnit=nanosecond, semanticType='null'}} - // Token{signal=ENCODING, name='int64', description='The AeronChannel id', id=-1, version=0, - // encodedLength=8, offset=0, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, - // primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, - // constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, - // semanticType='null'}} - builder.append("channelId="); - builder.append(channelId()); - builder.append('|'); - // Token{signal=BEGIN_FIELD, name='sendingStreamId', description='The stream id the connecting - // client will send traffic on', id=2, version=0, encodedLength=0, offset=8, - // componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, - // byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, - // characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} - // Token{signal=ENCODING, name='int32', description='The stream id the connecting client will - // send traffic on', id=-1, version=0, encodedLength=4, offset=8, componentTokenCount=1, - // encoding=Encoding{presence=REQUIRED, primitiveType=INT32, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', - // epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.append("sendingStreamId="); - builder.append(sendingStreamId()); - builder.append('|'); - // Token{signal=BEGIN_FIELD, name='receivingStreamId', description='The stream id the connecting - // client will receive data on', id=3, version=0, encodedLength=0, offset=12, - // componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, - // byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, - // characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} - // Token{signal=ENCODING, name='int32', description='The stream id the connecting client will - // receive data on', id=-1, version=0, encodedLength=4, offset=12, componentTokenCount=1, - // encoding=Encoding{presence=REQUIRED, primitiveType=INT32, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', - // epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.append("receivingStreamId="); - builder.append(receivingStreamId()); - builder.append('|'); - // Token{signal=BEGIN_FIELD, name='clientSessionId', description='The session id for the client - // publication', id=4, version=0, encodedLength=0, offset=16, componentTokenCount=3, - // encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', - // epoch='unix', timeUnit=nanosecond, semanticType='null'}} - // Token{signal=ENCODING, name='int32', description='The session id for the client publication', - // id=-1, version=0, encodedLength=4, offset=16, componentTokenCount=1, - // encoding=Encoding{presence=REQUIRED, primitiveType=INT32, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', - // epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.append("clientSessionId="); - builder.append(clientSessionId()); - builder.append('|'); - // Token{signal=BEGIN_VAR_DATA, name='sendingChannel', description='The Aeron channel the client - // will send data on', id=5, version=0, encodedLength=0, offset=20, componentTokenCount=6, - // encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', - // epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.append("sendingChannel="); - builder.append(sendingChannel()); - builder.append('|'); - // Token{signal=BEGIN_VAR_DATA, name='receivingChannel', description='The Aeron channel the - // client will receive data on', id=6, version=0, encodedLength=0, offset=-1, - // componentTokenCount=6, encoding=Encoding{presence=REQUIRED, primitiveType=null, - // byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, - // characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.append("receivingChannel="); - builder.append(receivingChannel()); - builder.append('|'); - // Token{signal=BEGIN_VAR_DATA, name='clientManagementChannel', description='The channel the - // client listens for management data on', id=6, version=0, encodedLength=0, offset=-1, - // componentTokenCount=6, encoding=Encoding{presence=REQUIRED, primitiveType=null, - // byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, - // characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.append("clientManagementChannel="); - builder.append(clientManagementChannel()); - - limit(originalLimit); - - return builder; - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/ConnectEncoder.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/ConnectEncoder.java deleted file mode 100644 index 140a5a293..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/ConnectEncoder.java +++ /dev/null @@ -1,393 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated SBE (Simple Binary Encoding) message codec */ - -package io.rsocket.aeron.internal.reactivestreams.messages; - -import org.agrona.DirectBuffer; -import org.agrona.MutableDirectBuffer; - -@javax.annotation.Generated( - value = {"io.rsocket.aeron.internal.reactivestreams.messages.ConnectEncoder"} -) -@SuppressWarnings("all") -public class ConnectEncoder { - public static final int BLOCK_LENGTH = 20; - public static final int TEMPLATE_ID = 1; - public static final int SCHEMA_ID = 1; - public static final int SCHEMA_VERSION = 0; - - private final ConnectEncoder parentMessage = this; - private MutableDirectBuffer buffer; - protected int offset; - protected int limit; - protected int actingBlockLength; - protected int actingVersion; - - public int sbeBlockLength() { - return BLOCK_LENGTH; - } - - public int sbeTemplateId() { - return TEMPLATE_ID; - } - - public int sbeSchemaId() { - return SCHEMA_ID; - } - - public int sbeSchemaVersion() { - return SCHEMA_VERSION; - } - - public String sbeSemanticType() { - return ""; - } - - public int offset() { - return offset; - } - - public ConnectEncoder wrap(final MutableDirectBuffer buffer, final int offset) { - this.buffer = buffer; - this.offset = offset; - limit(offset + BLOCK_LENGTH); - - return this; - } - - public int encodedLength() { - return limit - offset; - } - - public int limit() { - return limit; - } - - public void limit(final int limit) { - this.limit = limit; - } - - public static long channelIdNullValue() { - return -9223372036854775808L; - } - - public static long channelIdMinValue() { - return -9223372036854775807L; - } - - public static long channelIdMaxValue() { - return 9223372036854775807L; - } - - public ConnectEncoder channelId(final long value) { - buffer.putLong(offset + 0, value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } - - public static int sendingStreamIdNullValue() { - return -2147483648; - } - - public static int sendingStreamIdMinValue() { - return -2147483647; - } - - public static int sendingStreamIdMaxValue() { - return 2147483647; - } - - public ConnectEncoder sendingStreamId(final int value) { - buffer.putInt(offset + 8, value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } - - public static int receivingStreamIdNullValue() { - return -2147483648; - } - - public static int receivingStreamIdMinValue() { - return -2147483647; - } - - public static int receivingStreamIdMaxValue() { - return 2147483647; - } - - public ConnectEncoder receivingStreamId(final int value) { - buffer.putInt(offset + 12, value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } - - public static int clientSessionIdNullValue() { - return -2147483648; - } - - public static int clientSessionIdMinValue() { - return -2147483647; - } - - public static int clientSessionIdMaxValue() { - return 2147483647; - } - - public ConnectEncoder clientSessionId(final int value) { - buffer.putInt(offset + 16, value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } - - public static int sendingChannelId() { - return 5; - } - - public static String sendingChannelCharacterEncoding() { - return "UTF-8"; - } - - public static String sendingChannelMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static int sendingChannelHeaderLength() { - return 4; - } - - public ConnectEncoder putSendingChannel( - final DirectBuffer src, final int srcOffset, final int length) { - if (length > 1073741824) { - throw new IllegalArgumentException("length > max value for type: " + length); - } - - final int headerLength = 4; - final int limit = parentMessage.limit(); - parentMessage.limit(limit + headerLength + length); - buffer.putInt(limit, length, java.nio.ByteOrder.LITTLE_ENDIAN); - buffer.putBytes(limit + headerLength, src, srcOffset, length); - - return this; - } - - public ConnectEncoder putSendingChannel(final byte[] src, final int srcOffset, final int length) { - if (length > 1073741824) { - throw new IllegalArgumentException("length > max value for type: " + length); - } - - final int headerLength = 4; - final int limit = parentMessage.limit(); - parentMessage.limit(limit + headerLength + length); - buffer.putInt(limit, length, java.nio.ByteOrder.LITTLE_ENDIAN); - buffer.putBytes(limit + headerLength, src, srcOffset, length); - - return this; - } - - public ConnectEncoder sendingChannel(final String value) { - final byte[] bytes; - try { - bytes = value.getBytes("UTF-8"); - } catch (final java.io.UnsupportedEncodingException ex) { - throw new RuntimeException(ex); - } - - final int length = bytes.length; - if (length > 1073741824) { - throw new IllegalArgumentException("length > max value for type: " + length); - } - - final int headerLength = 4; - final int limit = parentMessage.limit(); - parentMessage.limit(limit + headerLength + length); - buffer.putInt(limit, length, java.nio.ByteOrder.LITTLE_ENDIAN); - buffer.putBytes(limit + headerLength, bytes, 0, length); - - return this; - } - - public static int receivingChannelId() { - return 6; - } - - public static String receivingChannelCharacterEncoding() { - return "UTF-8"; - } - - public static String receivingChannelMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static int receivingChannelHeaderLength() { - return 4; - } - - public ConnectEncoder putReceivingChannel( - final DirectBuffer src, final int srcOffset, final int length) { - if (length > 1073741824) { - throw new IllegalArgumentException("length > max value for type: " + length); - } - - final int headerLength = 4; - final int limit = parentMessage.limit(); - parentMessage.limit(limit + headerLength + length); - buffer.putInt(limit, length, java.nio.ByteOrder.LITTLE_ENDIAN); - buffer.putBytes(limit + headerLength, src, srcOffset, length); - - return this; - } - - public ConnectEncoder putReceivingChannel( - final byte[] src, final int srcOffset, final int length) { - if (length > 1073741824) { - throw new IllegalArgumentException("length > max value for type: " + length); - } - - final int headerLength = 4; - final int limit = parentMessage.limit(); - parentMessage.limit(limit + headerLength + length); - buffer.putInt(limit, length, java.nio.ByteOrder.LITTLE_ENDIAN); - buffer.putBytes(limit + headerLength, src, srcOffset, length); - - return this; - } - - public ConnectEncoder receivingChannel(final String value) { - final byte[] bytes; - try { - bytes = value.getBytes("UTF-8"); - } catch (final java.io.UnsupportedEncodingException ex) { - throw new RuntimeException(ex); - } - - final int length = bytes.length; - if (length > 1073741824) { - throw new IllegalArgumentException("length > max value for type: " + length); - } - - final int headerLength = 4; - final int limit = parentMessage.limit(); - parentMessage.limit(limit + headerLength + length); - buffer.putInt(limit, length, java.nio.ByteOrder.LITTLE_ENDIAN); - buffer.putBytes(limit + headerLength, bytes, 0, length); - - return this; - } - - public static int clientManagementChannelId() { - return 6; - } - - public static String clientManagementChannelCharacterEncoding() { - return "UTF-8"; - } - - public static String clientManagementChannelMetaAttribute(final MetaAttribute metaAttribute) { - switch (metaAttribute) { - case EPOCH: - return "unix"; - case TIME_UNIT: - return "nanosecond"; - case SEMANTIC_TYPE: - return ""; - } - - return ""; - } - - public static int clientManagementChannelHeaderLength() { - return 4; - } - - public ConnectEncoder putClientManagementChannel( - final DirectBuffer src, final int srcOffset, final int length) { - if (length > 1073741824) { - throw new IllegalArgumentException("length > max value for type: " + length); - } - - final int headerLength = 4; - final int limit = parentMessage.limit(); - parentMessage.limit(limit + headerLength + length); - buffer.putInt(limit, length, java.nio.ByteOrder.LITTLE_ENDIAN); - buffer.putBytes(limit + headerLength, src, srcOffset, length); - - return this; - } - - public ConnectEncoder putClientManagementChannel( - final byte[] src, final int srcOffset, final int length) { - if (length > 1073741824) { - throw new IllegalArgumentException("length > max value for type: " + length); - } - - final int headerLength = 4; - final int limit = parentMessage.limit(); - parentMessage.limit(limit + headerLength + length); - buffer.putInt(limit, length, java.nio.ByteOrder.LITTLE_ENDIAN); - buffer.putBytes(limit + headerLength, src, srcOffset, length); - - return this; - } - - public ConnectEncoder clientManagementChannel(final String value) { - final byte[] bytes; - try { - bytes = value.getBytes("UTF-8"); - } catch (final java.io.UnsupportedEncodingException ex) { - throw new RuntimeException(ex); - } - - final int length = bytes.length; - if (length > 1073741824) { - throw new IllegalArgumentException("length > max value for type: " + length); - } - - final int headerLength = 4; - final int limit = parentMessage.limit(); - parentMessage.limit(limit + headerLength + length); - buffer.putInt(limit, length, java.nio.ByteOrder.LITTLE_ENDIAN); - buffer.putBytes(limit + headerLength, bytes, 0, length); - - return this; - } - - public String toString() { - return appendTo(new StringBuilder(100)).toString(); - } - - public StringBuilder appendTo(final StringBuilder builder) { - ConnectDecoder writer = new ConnectDecoder(); - writer.wrap(buffer, offset, BLOCK_LENGTH, SCHEMA_VERSION); - - return writer.appendTo(builder); - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MessageHeaderDecoder.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MessageHeaderDecoder.java deleted file mode 100644 index 2c3e6f464..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MessageHeaderDecoder.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated SBE (Simple Binary Encoding) message codec */ - -package io.rsocket.aeron.internal.reactivestreams.messages; - -import org.agrona.DirectBuffer; - -@javax.annotation.Generated( - value = {"io.rsocket.aeron.internal.reactivestreams.messages.MessageHeaderDecoder"} -) -@SuppressWarnings("all") -public class MessageHeaderDecoder { - public static final int ENCODED_LENGTH = 8; - private DirectBuffer buffer; - private int offset; - - public MessageHeaderDecoder wrap(final DirectBuffer buffer, final int offset) { - this.buffer = buffer; - this.offset = offset; - - return this; - } - - public int encodedLength() { - return ENCODED_LENGTH; - } - - public static int blockLengthNullValue() { - return 65535; - } - - public static int blockLengthMinValue() { - return 0; - } - - public static int blockLengthMaxValue() { - return 65534; - } - - public int blockLength() { - return (buffer.getShort(offset + 0, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); - } - - public static int templateIdNullValue() { - return 65535; - } - - public static int templateIdMinValue() { - return 0; - } - - public static int templateIdMaxValue() { - return 65534; - } - - public int templateId() { - return (buffer.getShort(offset + 2, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); - } - - public static int schemaIdNullValue() { - return 65535; - } - - public static int schemaIdMinValue() { - return 0; - } - - public static int schemaIdMaxValue() { - return 65534; - } - - public int schemaId() { - return (buffer.getShort(offset + 4, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); - } - - public static int versionNullValue() { - return 65535; - } - - public static int versionMinValue() { - return 0; - } - - public static int versionMaxValue() { - return 65534; - } - - public int version() { - return (buffer.getShort(offset + 6, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MessageHeaderEncoder.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MessageHeaderEncoder.java deleted file mode 100644 index 8bd1b58f6..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MessageHeaderEncoder.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated SBE (Simple Binary Encoding) message codec */ - -package io.rsocket.aeron.internal.reactivestreams.messages; - -import org.agrona.MutableDirectBuffer; - -@javax.annotation.Generated( - value = {"io.rsocket.aeron.internal.reactivestreams.messages.MessageHeaderEncoder"} -) -@SuppressWarnings("all") -public class MessageHeaderEncoder { - public static final int ENCODED_LENGTH = 8; - private MutableDirectBuffer buffer; - private int offset; - - public MessageHeaderEncoder wrap(final MutableDirectBuffer buffer, final int offset) { - this.buffer = buffer; - this.offset = offset; - - return this; - } - - public int encodedLength() { - return ENCODED_LENGTH; - } - - public static int blockLengthNullValue() { - return 65535; - } - - public static int blockLengthMinValue() { - return 0; - } - - public static int blockLengthMaxValue() { - return 65534; - } - - public MessageHeaderEncoder blockLength(final int value) { - buffer.putShort(offset + 0, (short) value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } - - public static int templateIdNullValue() { - return 65535; - } - - public static int templateIdMinValue() { - return 0; - } - - public static int templateIdMaxValue() { - return 65534; - } - - public MessageHeaderEncoder templateId(final int value) { - buffer.putShort(offset + 2, (short) value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } - - public static int schemaIdNullValue() { - return 65535; - } - - public static int schemaIdMinValue() { - return 0; - } - - public static int schemaIdMaxValue() { - return 65534; - } - - public MessageHeaderEncoder schemaId(final int value) { - buffer.putShort(offset + 4, (short) value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } - - public static int versionNullValue() { - return 65535; - } - - public static int versionMinValue() { - return 0; - } - - public static int versionMaxValue() { - return 65534; - } - - public MessageHeaderEncoder version(final int value) { - buffer.putShort(offset + 6, (short) value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MetaAttribute.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MetaAttribute.java deleted file mode 100644 index b4a0b5594..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/MetaAttribute.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated SBE (Simple Binary Encoding) message codec */ - -package io.rsocket.aeron.internal.reactivestreams.messages; - -@javax.annotation.Generated( - value = {"io.rsocket.aeron.internal.reactivestreams.messages.MetaAttribute"} -) -public enum MetaAttribute { - EPOCH, - TIME_UNIT, - SEMANTIC_TYPE -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/VarDataEncodingDecoder.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/VarDataEncodingDecoder.java deleted file mode 100644 index cea04b1e7..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/VarDataEncodingDecoder.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated SBE (Simple Binary Encoding) message codec */ - -package io.rsocket.aeron.internal.reactivestreams.messages; - -import org.agrona.DirectBuffer; - -@javax.annotation.Generated( - value = {"io.rsocket.aeron.internal.reactivestreams.messages.VarDataEncodingDecoder"} -) -@SuppressWarnings("all") -public class VarDataEncodingDecoder { - public static final int ENCODED_LENGTH = -1; - private DirectBuffer buffer; - private int offset; - - public VarDataEncodingDecoder wrap(final DirectBuffer buffer, final int offset) { - this.buffer = buffer; - this.offset = offset; - - return this; - } - - public int encodedLength() { - return ENCODED_LENGTH; - } - - public static long lengthNullValue() { - return 4294967294L; - } - - public static long lengthMinValue() { - return 0L; - } - - public static long lengthMaxValue() { - return 1073741824L; - } - - public long length() { - return (buffer.getInt(offset + 0, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF_FFFFL); - } - - public static short varDataNullValue() { - return (short) 255; - } - - public static short varDataMinValue() { - return (short) 0; - } - - public static short varDataMaxValue() { - return (short) 254; - } - - public String toString() { - return appendTo(new StringBuilder(100)).toString(); - } - - public StringBuilder appendTo(final StringBuilder builder) { - builder.append('('); - // Token{signal=ENCODING, name='length', description='The channel the client listens for - // management data on', id=-1, version=0, encodedLength=4, offset=0, componentTokenCount=1, - // encoding=Encoding{presence=REQUIRED, primitiveType=UINT32, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=1073741824, nullValue=null, constValue=null, - // characterEncoding='UTF-8', epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.append("length="); - builder.append(length()); - builder.append('|'); - // Token{signal=ENCODING, name='varData', description='The channel the client listens for - // management data on', id=-1, version=0, encodedLength=-1, offset=4, componentTokenCount=1, - // encoding=Encoding{presence=REQUIRED, primitiveType=UINT8, byteOrder=LITTLE_ENDIAN, - // minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='UTF-8', - // epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.append(')'); - - return builder; - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/VarDataEncodingEncoder.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/VarDataEncodingEncoder.java deleted file mode 100644 index ab23e24a1..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/internal/reactivestreams/messages/VarDataEncodingEncoder.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated SBE (Simple Binary Encoding) message codec */ - -package io.rsocket.aeron.internal.reactivestreams.messages; - -import org.agrona.MutableDirectBuffer; - -@javax.annotation.Generated( - value = {"io.rsocket.aeron.internal.reactivestreams.messages.VarDataEncodingEncoder"} -) -@SuppressWarnings("all") -public class VarDataEncodingEncoder { - public static final int ENCODED_LENGTH = -1; - private MutableDirectBuffer buffer; - private int offset; - - public VarDataEncodingEncoder wrap(final MutableDirectBuffer buffer, final int offset) { - this.buffer = buffer; - this.offset = offset; - - return this; - } - - public int encodedLength() { - return ENCODED_LENGTH; - } - - public static long lengthNullValue() { - return 4294967294L; - } - - public static long lengthMinValue() { - return 0L; - } - - public static long lengthMaxValue() { - return 1073741824L; - } - - public VarDataEncodingEncoder length(final long value) { - buffer.putInt(offset + 0, (int) value, java.nio.ByteOrder.LITTLE_ENDIAN); - return this; - } - - public static short varDataNullValue() { - return (short) 255; - } - - public static short varDataMinValue() { - return (short) 0; - } - - public static short varDataMaxValue() { - return (short) 254; - } - - public String toString() { - return appendTo(new StringBuilder(100)).toString(); - } - - public StringBuilder appendTo(final StringBuilder builder) { - VarDataEncodingDecoder writer = new VarDataEncodingDecoder(); - writer.wrap(buffer, offset); - - return writer.appendTo(builder); - } -} diff --git a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/server/AeronServerTransport.java b/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/server/AeronServerTransport.java deleted file mode 100644 index 1a0429c7d..000000000 --- a/rsocket-transport-aeron/src/main/java/io/rsocket/aeron/server/AeronServerTransport.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.server; - -import io.rsocket.Closeable; -import io.rsocket.DuplexConnection; -import io.rsocket.aeron.AeronDuplexConnection; -import io.rsocket.aeron.internal.AeronWrapper; -import io.rsocket.aeron.internal.EventLoop; -import io.rsocket.aeron.internal.reactivestreams.AeronChannelServer; -import io.rsocket.aeron.internal.reactivestreams.AeronSocketAddress; -import io.rsocket.transport.ServerTransport; -import reactor.core.publisher.Mono; - -/** */ -public class AeronServerTransport implements ServerTransport { - private final AeronWrapper aeronWrapper; - private final AeronSocketAddress managementSubscriptionSocket; - private final EventLoop eventLoop; - - private AeronChannelServer aeronChannelServer; - - public AeronServerTransport( - AeronWrapper aeronWrapper, - AeronSocketAddress managementSubscriptionSocket, - EventLoop eventLoop) { - this.aeronWrapper = aeronWrapper; - this.managementSubscriptionSocket = managementSubscriptionSocket; - this.eventLoop = eventLoop; - } - - @Override - public Mono start(ConnectionAcceptor acceptor) { - synchronized (this) { - if (aeronChannelServer != null) { - throw new IllegalStateException("server already ready started"); - } - - aeronChannelServer = - AeronChannelServer.create( - aeronChannel -> { - DuplexConnection connection = new AeronDuplexConnection("server", aeronChannel); - acceptor.apply(connection).subscribe(); - }, - aeronWrapper, - managementSubscriptionSocket, - eventLoop); - } - - return Mono.just(aeronChannelServer.start()); - } -} diff --git a/rsocket-transport-aeron/src/main/resources/META-INF/services/io.rsocket.uri.UriHandler b/rsocket-transport-aeron/src/main/resources/META-INF/services/io.rsocket.uri.UriHandler deleted file mode 100644 index 84db6fd4a..000000000 --- a/rsocket-transport-aeron/src/main/resources/META-INF/services/io.rsocket.uri.UriHandler +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright 2015-2018 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -io.rsocket.aeron.AeronUriHandler diff --git a/rsocket-transport-aeron/src/main/resources/aeron-channel-schema.xml b/rsocket-transport-aeron/src/main/resources/aeron-channel-schema.xml deleted file mode 100644 index cbd64809f..000000000 --- a/rsocket-transport-aeron/src/main/resources/aeron-channel-schema.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronClientSetupRule.java b/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronClientSetupRule.java deleted file mode 100644 index 4a7cdc6ae..000000000 --- a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronClientSetupRule.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron; - -import io.rsocket.Closeable; -import io.rsocket.aeron.client.AeronClientTransport; -import io.rsocket.aeron.internal.*; -import io.rsocket.aeron.internal.reactivestreams.AeronClientChannelConnector; -import io.rsocket.aeron.internal.reactivestreams.AeronSocketAddress; -import io.rsocket.aeron.server.AeronServerTransport; -import io.rsocket.test.ClientSetupRule; - -class AeronClientSetupRule extends ClientSetupRule { - - public static final AeronSocketAddress ADDRESS = - AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - - static { - MediaDriverHolder.getInstance(); - AeronWrapper aeronWrapper = new DefaultAeronWrapper(); - - EventLoop serverEventLoop = new SingleThreadedEventLoop("server"); - server = new AeronServerTransport(aeronWrapper, ADDRESS, serverEventLoop); - - // Create Client Connector - EventLoop clientEventLoop = new SingleThreadedEventLoop("client"); - - AeronClientChannelConnector.AeronClientConfig config = - AeronClientChannelConnector.AeronClientConfig.create( - ADDRESS, - ADDRESS, - Constants.CLIENT_STREAM_ID, - Constants.SERVER_STREAM_ID, - clientEventLoop); - - AeronClientChannelConnector connector = - AeronClientChannelConnector.create(aeronWrapper, ADDRESS, clientEventLoop); - - client = new AeronClientTransport(connector, config); - } - - private static final AeronServerTransport server; - private static final AeronClientTransport client; - - AeronClientSetupRule() { - super(() -> ADDRESS, (address, server) -> client, address -> server); - } -} diff --git a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronPing.java b/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronPing.java deleted file mode 100644 index 15db974c7..000000000 --- a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronPing.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron; - -import io.rsocket.RSocket; -import io.rsocket.RSocketFactory; -import io.rsocket.aeron.client.AeronClientTransport; -import io.rsocket.aeron.internal.*; -import io.rsocket.aeron.internal.reactivestreams.AeronClientChannelConnector; -import io.rsocket.aeron.internal.reactivestreams.AeronSocketAddress; -import io.rsocket.test.PingClient; -import java.time.Duration; -import org.HdrHistogram.Recorder; -import reactor.core.publisher.Mono; - -public final class AeronPing { - - public static void main(String... args) { - // Create Client Connector - AeronWrapper aeronWrapper = new DefaultAeronWrapper(); - - AeronSocketAddress clientManagementSocketAddress = - AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - EventLoop clientEventLoop = new SingleThreadedEventLoop("client"); - - AeronSocketAddress receiveAddress = AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - AeronSocketAddress sendAddress = AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - - AeronClientChannelConnector.AeronClientConfig config = - AeronClientChannelConnector.AeronClientConfig.create( - receiveAddress, - sendAddress, - Constants.CLIENT_STREAM_ID, - Constants.SERVER_STREAM_ID, - clientEventLoop); - - AeronClientChannelConnector connector = - AeronClientChannelConnector.create( - aeronWrapper, clientManagementSocketAddress, clientEventLoop); - - AeronClientTransport aeronTransportClient = new AeronClientTransport(connector, config); - - Mono client = RSocketFactory.connect().transport(aeronTransportClient).start(); - PingClient pingClient = new PingClient(client); - Recorder recorder = pingClient.startTracker(Duration.ofSeconds(1)); - final int count = 1_000_000_000; - pingClient - .startPingPong(count, recorder) - .doOnTerminate(() -> System.out.println("Sent " + count + " messages.")) - .blockLast(); - - System.exit(0); - } -} diff --git a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronPongServer.java b/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronPongServer.java deleted file mode 100644 index 28b9080c4..000000000 --- a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/AeronPongServer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron; - -import io.aeron.driver.MediaDriver; -import io.aeron.driver.ThreadingMode; -import io.rsocket.RSocketFactory; -import io.rsocket.aeron.internal.AeronWrapper; -import io.rsocket.aeron.internal.DefaultAeronWrapper; -import io.rsocket.aeron.internal.EventLoop; -import io.rsocket.aeron.internal.SingleThreadedEventLoop; -import io.rsocket.aeron.internal.reactivestreams.AeronSocketAddress; -import io.rsocket.aeron.server.AeronServerTransport; -import io.rsocket.test.PingHandler; - -public final class AeronPongServer { - static { - final io.aeron.driver.MediaDriver.Context ctx = - new io.aeron.driver.MediaDriver.Context() - .threadingMode(ThreadingMode.SHARED_NETWORK) - .dirDeleteOnStart(true); - MediaDriver.launch(ctx); - } - - public static void main(String... args) { - MediaDriverHolder.getInstance(); - AeronWrapper aeronWrapper = new DefaultAeronWrapper(); - - AeronSocketAddress serverManagementSocketAddress = - AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - EventLoop serverEventLoop = new SingleThreadedEventLoop("server"); - AeronServerTransport server = - new AeronServerTransport(aeronWrapper, serverManagementSocketAddress, serverEventLoop); - - AeronServerTransport transport = - new AeronServerTransport(aeronWrapper, serverManagementSocketAddress, serverEventLoop); - RSocketFactory.receive().acceptor(new PingHandler()).transport(transport).start(); - } -} diff --git a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/ClientServerTest.java b/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/ClientServerTest.java deleted file mode 100644 index c34b6d4df..000000000 --- a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/ClientServerTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron; - -import static org.junit.Assert.assertEquals; - -import io.rsocket.Payload; -import io.rsocket.test.ClientSetupRule; -import io.rsocket.util.DefaultPayload; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import reactor.core.publisher.Flux; - -@Ignore -public class ClientServerTest { - - @Rule public final ClientSetupRule setup = new AeronClientSetupRule(); - - @Test(timeout = 10000) - public void testFireNForget10() { - long outputCount = - Flux.range(1, 10) - .flatMap( - i -> setup.getRSocket().fireAndForget(DefaultPayload.create("hello", "metadata"))) - .doOnError(Throwable::printStackTrace) - .count() - .block(); - - assertEquals(0, outputCount); - } - - @Test(timeout = 10000) - public void testPushMetadata10() { - long outputCount = - Flux.range(1, 10) - .flatMap(i -> setup.getRSocket().metadataPush(DefaultPayload.create("", "metadata"))) - .doOnError(Throwable::printStackTrace) - .count() - .block(); - - assertEquals(0, outputCount); - } - - @Test(timeout = 5000000) - public void testRequestResponse1() { - long outputCount = - Flux.range(1, 1) - .flatMap( - i -> - setup - .getRSocket() - .requestResponse(DefaultPayload.create("hello", "metadata")) - .map(Payload::getDataUtf8)) - .doOnError(Throwable::printStackTrace) - .count() - .block(); - - assertEquals(1, outputCount); - } - - @Test(timeout = 2000) - public void testRequestResponse10() { - long outputCount = - Flux.range(1, 10) - .flatMap( - i -> - setup - .getRSocket() - .requestResponse(DefaultPayload.create("hello", "metadata")) - .map(Payload::getDataUtf8)) - .doOnError(Throwable::printStackTrace) - .count() - .block(); - - assertEquals(10, outputCount); - } - - @Test(timeout = 2000) - public void testRequestResponse100() { - long outputCount = - Flux.range(1, 100) - .flatMap( - i -> - setup - .getRSocket() - .requestResponse(DefaultPayload.create("hello", "metadata")) - .map(Payload::getDataUtf8)) - .doOnError(Throwable::printStackTrace) - .count() - .block(); - - assertEquals(100, outputCount); - } - - @Test(timeout = 5000) - public void testRequestResponse10_000() { - long outputCount = - Flux.range(1, 10_000) - .flatMap( - i -> - setup - .getRSocket() - .requestResponse(DefaultPayload.create("hello", "metadata")) - .map(Payload::getDataUtf8)) - .doOnError(Throwable::printStackTrace) - .count() - .block(); - - assertEquals(10_000, outputCount); - } - - @Test(timeout = 10000) - public void testRequestStream() { - Flux publisher = - setup.getRSocket().requestStream(DefaultPayload.create("hello", "metadata")); - - long count = publisher.take(5).count().block(); - - assertEquals(5, count); - } -} diff --git a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/MediaDriverHolder.java b/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/MediaDriverHolder.java deleted file mode 100644 index d43768c28..000000000 --- a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/MediaDriverHolder.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron; - -import io.aeron.driver.MediaDriver; -import io.aeron.driver.ThreadingMode; -import java.util.concurrent.TimeUnit; -import org.agrona.concurrent.SleepingIdleStrategy; - -public class MediaDriverHolder { - private static final MediaDriverHolder INSTANCE = new MediaDriverHolder(); - - static { - final io.aeron.driver.MediaDriver.Context ctx = - new io.aeron.driver.MediaDriver.Context() - .threadingMode(ThreadingMode.SHARED) - .dirDeleteOnStart(true) - .conductorIdleStrategy(new SleepingIdleStrategy(TimeUnit.MILLISECONDS.toNanos(1))) - .receiverIdleStrategy(new SleepingIdleStrategy(TimeUnit.MILLISECONDS.toNanos(1))) - .senderIdleStrategy(new SleepingIdleStrategy(TimeUnit.MILLISECONDS.toNanos(1))); - - ctx.driverTimeoutMs(TimeUnit.MINUTES.toMillis(10)); - MediaDriver.launch(ctx); - } - - private MediaDriverHolder() {} - - public static MediaDriverHolder getInstance() { - return INSTANCE; - } -} diff --git a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelPing.java b/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelPing.java deleted file mode 100644 index af62c46c7..000000000 --- a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelPing.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import io.rsocket.aeron.internal.AeronWrapper; -import io.rsocket.aeron.internal.DefaultAeronWrapper; -import io.rsocket.aeron.internal.SingleThreadedEventLoop; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; -import org.HdrHistogram.Recorder; -import org.agrona.concurrent.UnsafeBuffer; -import reactor.core.publisher.Flux; - -/** */ -public final class AeronChannelPing { - public static void main(String... args) { - int count = 1_000_000_000; - final Recorder histogram = new Recorder(Long.MAX_VALUE, 3); - Executors.newSingleThreadScheduledExecutor() - .scheduleAtFixedRate( - () -> { - System.out.println("---- PING/ PONG HISTO ----"); - histogram - .getIntervalHistogram() - .outputPercentileDistribution(System.out, 5, 1000.0, false); - System.out.println("---- PING/ PONG HISTO ----"); - }, - 1, - 1, - TimeUnit.SECONDS); - - AeronWrapper wrapper = new DefaultAeronWrapper(); - AeronSocketAddress managementSocketAddress = - AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - SingleThreadedEventLoop eventLoop = new SingleThreadedEventLoop("client"); - AeronClientChannelConnector connector = - AeronClientChannelConnector.create(wrapper, managementSocketAddress, eventLoop); - - AeronSocketAddress receiveAddress = AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - AeronSocketAddress sendAddress = AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - - AeronClientChannelConnector.AeronClientConfig config = - AeronClientChannelConnector.AeronClientConfig.create( - receiveAddress, sendAddress, 1, 2, eventLoop); - - AeronChannel channel = connector.apply(config).block(); - - AtomicLong lastUpdate = new AtomicLong(System.nanoTime()); - channel - .receive() - .doOnNext( - b -> { - synchronized (wrapper) { - int anInt = b.getInt(0); - if (anInt % 1_000 == 0) { - long diff = System.nanoTime() - lastUpdate.get(); - histogram.recordValue(diff); - lastUpdate.set(System.nanoTime()); - } - } - }) - .doOnError(Throwable::printStackTrace) - .subscribe(); - - byte[] b = new byte[1024]; - Flux.range(0, count) - .flatMap( - i -> { - UnsafeBuffer buffer = new UnsafeBuffer(b); - buffer.putInt(0, i); - return channel.send(buffer); - }, - 8) - .last(null) - .block(); - } -} diff --git a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelPongServer.java b/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelPongServer.java deleted file mode 100644 index aa0296c45..000000000 --- a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelPongServer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import io.rsocket.aeron.MediaDriverHolder; -import io.rsocket.aeron.internal.AeronWrapper; -import io.rsocket.aeron.internal.DefaultAeronWrapper; -import io.rsocket.aeron.internal.SingleThreadedEventLoop; -import org.agrona.DirectBuffer; -import reactor.core.publisher.Flux; - -/** */ -public class AeronChannelPongServer { - public static void main(String... args) { - MediaDriverHolder.getInstance(); - AeronWrapper wrapper = new DefaultAeronWrapper(); - AeronSocketAddress managementSubscription = - AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - SingleThreadedEventLoop eventLoop = new SingleThreadedEventLoop("server"); - - AeronChannelServer.AeronChannelConsumer consumer = - aeronChannel -> { - Flux receive = aeronChannel.receive(); - // .doOnNext(b -> System.out.println("server got => " + b.getInt(0))); - - aeronChannel.send(receive).doOnError(Throwable::printStackTrace).subscribe(); - }; - - AeronChannelServer server = - AeronChannelServer.create(consumer, wrapper, managementSubscription, eventLoop); - AeronChannelServer.AeronChannelStartedServer start = server.start(); - start.awaitShutdown(); - } -} diff --git a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelTest.java b/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelTest.java deleted file mode 100644 index 2a5339af2..000000000 --- a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronChannelTest.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import io.aeron.Aeron; -import io.aeron.Publication; -import io.aeron.Subscription; -import io.rsocket.aeron.MediaDriverHolder; -import io.rsocket.aeron.internal.Constants; -import io.rsocket.aeron.internal.EventLoop; -import io.rsocket.aeron.internal.SingleThreadedEventLoop; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ThreadLocalRandom; -import org.agrona.BitUtil; -import org.agrona.LangUtil; -import org.agrona.concurrent.UnsafeBuffer; -import org.junit.Ignore; -import org.junit.Test; -import reactor.core.publisher.Flux; - -/** */ -@Ignore("travis does not like me") -public class AeronChannelTest { - static { - // System.setProperty("aeron.publication.linger.timeout", String.valueOf(50_000_000_000L)); - // System.setProperty("aeron.client.liveness.timeout", String.valueOf(50_000_000_000L)); - MediaDriverHolder.getInstance(); - } - - @Test - @Ignore - public void testPing() { - - int count = 5_000_000; - CountDownLatch countDownLatch = new CountDownLatch(count); - - CountDownLatch sync = new CountDownLatch(2); - Aeron.Context ctx = new Aeron.Context(); - - // ctx.publicationConnectionTimeout(TimeUnit.MINUTES.toNanos(5)); - - ctx.availableImageHandler( - image -> { - System.out.println( - "name image subscription => " - + image.subscription().channel() - + " streamId => " - + image.subscription().streamId() - + " registrationId => " - + image.subscription().registrationId()); - sync.countDown(); - }); - - ctx.unavailableImageHandler( - image -> - System.out.println( - "=== unavailable image name image subscription => " - + image.subscription().channel() - + " streamId => " - + image.subscription().streamId() - + " registrationId => " - + image.subscription().registrationId())); - /*ctx.errorHandler(t -> { - /* StringWriter writer = new StringWriter(); - PrintWriter w = new PrintWriter(writer); - t.printStackTrace(w); - - w.flush();* - - // System.out.println("\nGOT AERON ERROR => \n [" + writer.toString() + "]\n\n"); - });*/ - - ctx.driverTimeoutMs(Integer.MAX_VALUE); - Aeron aeron = Aeron.connect(ctx); - /* - Subscription serverSubscription = aeron.addSubscription("aeron:ipc", Constants.SERVER_STREAM_ID); - Publication serverPublication = aeron.addPublication("aeron:ipc", Constants.CLIENT_STREAM_ID); - - Subscription clientSubscription = aeron.addSubscription("aeron:ipc", Constants.CLIENT_STREAM_ID); - Publication clientPublication = aeron.addPublication("aeron:ipc", Constants.SERVER_STREAM_ID); - */ - - Subscription serverSubscription = - aeron.addSubscription("aeron:udp?endpoint=localhost:39791", Constants.SERVER_STREAM_ID); - System.out.println( - "serverSubscription registration id => " + serverSubscription.registrationId()); - - Publication serverPublication = - aeron.addPublication("aeron:udp?endpoint=localhost:39790", Constants.CLIENT_STREAM_ID); - - Subscription clientSubscription = - aeron.addSubscription("aeron:udp?endpoint=localhost:39790", Constants.CLIENT_STREAM_ID); - - System.out.println( - "clientSubscription registration id => " + clientSubscription.registrationId()); - Publication clientPublication = - aeron.addPublication("aeron:udp?endpoint=localhost:39791", Constants.SERVER_STREAM_ID); - - try { - sync.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - EventLoop serverLoop = new SingleThreadedEventLoop("server"); - - AeronOutPublisher publisher = - new AeronOutPublisher( - "server", clientPublication.sessionId(), serverSubscription, serverLoop); - publisher - .doOnNext(i -> countDownLatch.countDown()) - .doOnError(Throwable::printStackTrace) - .subscribe(); - - AeronInSubscriber aeronInSubscriber = new AeronInSubscriber("client", clientPublication); - - Flux unsafeBufferObservable = - Flux.range(1, count) - // .doOnNext(i -> LockSupport.parkNanos(TimeUnit.MICROSECONDS.toNanos(50))) - // .doOnNext(i -> System.out.println(Thread.currentThread() + " => client sending => " + - // i)) - .map( - i -> { - UnsafeBuffer buffer = new UnsafeBuffer(new byte[BitUtil.SIZE_OF_INT]); - buffer.putInt(0, i); - return buffer; - }) - // .doOnRequest(l -> System.out.println("Client reuqested => " + l)) - .doOnError(Throwable::printStackTrace) - .doOnComplete(() -> System.out.println("Im done")); - - unsafeBufferObservable.subscribe(aeronInSubscriber); - - try { - countDownLatch.await(); - } catch (InterruptedException e) { - LangUtil.rethrowUnchecked(e); - } - System.out.println("HERE!!!!"); - } - - @Test(timeout = 2_000) - public void testPingPong_10() { - pingPong(10); - } - - @Test(timeout = 2_000) - public void testPingPong_100() { - pingPong(100); - } - - @Test(timeout = 5_000) - public void testPingPong_300() { - pingPong(300); - } - - @Test(timeout = 5_000) - public void testPingPong_1_000() { - pingPong(1_000); - } - - @Test(timeout = 15_000) - public void testPingPong_10_000() { - pingPong(10_000); - } - - @Ignore - @Test(timeout = 5_000) - public void testPingPong_100_000() { - pingPong(100_000); - } - - @Ignore - @Test(timeout = 15_000) - public void testPingPong_1_000_000() { - pingPong(1_000_000); - } - - @Test(timeout = 50_000) - @Ignore - public void testPingPong_10_000_000() { - pingPong(10_000_000); - } - - @Test - @Ignore - public void testPingPongAlot() { - pingPong(100_000_000); - } - - private void pingPong(int count) { - - CountDownLatch sync = new CountDownLatch(2); - Aeron.Context ctx = new Aeron.Context(); - ctx.availableImageHandler( - image -> { - System.out.println( - "name image subscription => " - + image.subscription().channel() - + " streamId => " - + image.subscription().streamId() - + " registrationId => " - + image.subscription().registrationId()); - sync.countDown(); - }); - - ctx.unavailableImageHandler( - image -> - System.out.println( - "=== unavailable image name image subscription => " - + image.subscription().channel() - + " streamId => " - + image.subscription().streamId() - + " registrationId => " - + image.subscription().registrationId())); - - /*ctx.errorHandler(t -> { - /* StringWriter writer = new StringWriter(); - PrintWriter w = new PrintWriter(writer); - t.printStackTrace(w); - - w.flush();* - - // System.out.println("\nGOT AERON ERROR => \n [" + writer.toString() + "]\n\n"); - });*/ - - // ctx.driverTimeoutMs(Integer.MAX_VALUE); - Aeron aeron = Aeron.connect(ctx); - - Subscription serverSubscription = - aeron.addSubscription("aeron:ipc", Constants.SERVER_STREAM_ID); - Publication serverPublication = aeron.addPublication("aeron:ipc", Constants.CLIENT_STREAM_ID); - - Subscription clientSubscription = - aeron.addSubscription("aeron:ipc", Constants.CLIENT_STREAM_ID); - Publication clientPublication = aeron.addPublication("aeron:ipc", Constants.SERVER_STREAM_ID); - - /* - Subscription serverSubscription = aeron.addSubscription("udp://localhost:39791", Constants.SERVER_STREAM_ID); - System.out.println("serverSubscription registration id => " + serverSubscription.registrationId()); - - Publication serverPublication = aeron.addPublication("udp://localhost:39790", Constants.CLIENT_STREAM_ID); - - Subscription clientSubscription = aeron.addSubscription("udp://localhost:39790", Constants.CLIENT_STREAM_ID); - - System.out.println("clientSubscription registration id => " + clientSubscription.registrationId()); - Publication clientPublication = aeron.addPublication("udp://localhost:39791", Constants.SERVER_STREAM_ID); - */ - try { - sync.await(); - } catch (InterruptedException e) { - LangUtil.rethrowUnchecked(e); - } - - SingleThreadedEventLoop serverLoop = new SingleThreadedEventLoop("server"); - SingleThreadedEventLoop clientLoop = new SingleThreadedEventLoop("client"); - - AeronChannel serverChannel = - new AeronChannel( - "server", - serverPublication, - serverSubscription, - serverLoop, - clientPublication.sessionId()); - - System.out.println("created server channel"); - - CountDownLatch latch = new CountDownLatch(count); - - serverChannel - .receive() - // latch.countDown(); - // System.out.println("received -> " + f.getInt(0)); - .flatMap(serverChannel::send, 32) - .doOnError(Throwable::printStackTrace) - .subscribe(); - - AeronChannel clientChannel = - new AeronChannel( - "client", - clientPublication, - clientSubscription, - clientLoop, - serverPublication.sessionId()); - - clientChannel - .receive() - .doOnNext( - l -> { - synchronized (latch) { - latch.countDown(); - if (latch.getCount() % 10_000 == 0) { - System.out.println("mod of client got back -> " + latch.getCount()); - } - // if (latch.getCount() < 10_000) { - // System.out.println("client got back -> " + latch.getCount()); - // } - } - }) - .doOnError(Throwable::printStackTrace) - .subscribe(); - - byte[] bytes = new byte[8]; - ThreadLocalRandom.current().nextBytes(bytes); - - Flux.range(1, count) - // .doOnRequest(l -> System.out.println("requested => " + l)) - .flatMap( - i -> { - // System.out.println("Sending -> " + i); - - // UnsafeBuffer b = new UnsafeBuffer(new byte[BitUtil.SIZE_OF_INT]); - UnsafeBuffer b = new UnsafeBuffer(bytes); - b.putInt(0, i); - - return clientChannel.send(b); - }, - 8) - .doOnError(Throwable::printStackTrace) - .subscribe(); - - try { - latch.await(); - } catch (Exception t) { - LangUtil.rethrowUnchecked(t); - } - } -} diff --git a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronClientServerChannelTest.java b/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronClientServerChannelTest.java deleted file mode 100644 index 1874281d5..000000000 --- a/rsocket-transport-aeron/src/test/java/io/rsocket/aeron/internal/reactivestreams/AeronClientServerChannelTest.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright 2015-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.rsocket.aeron.internal.reactivestreams; - -import io.rsocket.aeron.MediaDriverHolder; -import io.rsocket.aeron.internal.AeronWrapper; -import io.rsocket.aeron.internal.DefaultAeronWrapper; -import io.rsocket.aeron.internal.EventLoop; -import io.rsocket.aeron.internal.SingleThreadedEventLoop; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ThreadLocalRandom; -import org.agrona.BitUtil; -import org.agrona.DirectBuffer; -import org.agrona.concurrent.UnsafeBuffer; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.reactivestreams.Publisher; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** */ -@Ignore("travis does not like me") -public class AeronClientServerChannelTest { - static { - MediaDriverHolder.getInstance(); - } - - @Test(timeout = 5_000) - public void testConnect() throws Exception { - int clientId = ThreadLocalRandom.current().nextInt(0, 1_000); - int serverId = clientId + 1; - - System.out.println("test client stream id => " + clientId); - System.out.println("test server stream id => " + serverId); - - AeronWrapper aeronWrapper = new DefaultAeronWrapper(); - - // Create Client Connector - AeronSocketAddress clientManagementSocketAddress = - AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - EventLoop clientEventLoop = new SingleThreadedEventLoop("client"); - - AeronSocketAddress receiveAddress = AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - AeronSocketAddress sendAddress = AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - - AeronClientChannelConnector.AeronClientConfig config = - AeronClientChannelConnector.AeronClientConfig.create( - receiveAddress, sendAddress, clientId, serverId, clientEventLoop); - - AeronClientChannelConnector connector = - AeronClientChannelConnector.create( - aeronWrapper, clientManagementSocketAddress, clientEventLoop); - - // Create Server - CountDownLatch latch = new CountDownLatch(2); - - AeronChannelServer.AeronChannelConsumer consumer = - (AeronChannel aeronChannel) -> { - Assert.assertNotNull(aeronChannel); - latch.countDown(); - }; - - AeronSocketAddress serverManagementSocketAddress = - AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - EventLoop serverEventLoop = new SingleThreadedEventLoop("server"); - AeronChannelServer aeronChannelServer = - AeronChannelServer.create( - consumer, aeronWrapper, serverManagementSocketAddress, serverEventLoop); - - aeronChannelServer.start(); - - Publisher publisher = connector.apply(config); - Flux.from(publisher) - .doOnNext(Assert::assertNotNull) - .doOnNext(c -> latch.countDown()) - .doOnError( - t -> { - throw new RuntimeException(t); - }) - .subscribe(); - - latch.await(); - } - - @Test(timeout = 5_000) - public void testPingPong() throws Exception { - int clientId = ThreadLocalRandom.current().nextInt(2_000, 3_000); - int serverId = clientId + 1; - - System.out.println("test client stream id => " + clientId); - System.out.println("test server stream id => " + serverId); - - AeronWrapper aeronWrapper = new DefaultAeronWrapper(); - - // Create Client Connector - AeronSocketAddress clientManagementSocketAddress = - AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - EventLoop clientEventLoop = new SingleThreadedEventLoop("client"); - - AeronSocketAddress receiveAddress = AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - AeronSocketAddress sendAddress = AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - - AeronClientChannelConnector.AeronClientConfig config = - AeronClientChannelConnector.AeronClientConfig.create( - receiveAddress, sendAddress, clientId, serverId, clientEventLoop); - - AeronClientChannelConnector connector = - AeronClientChannelConnector.create( - aeronWrapper, clientManagementSocketAddress, clientEventLoop); - - // Create Server - - AeronChannelServer.AeronChannelConsumer consumer = - (AeronChannel aeronChannel) -> { - Assert.assertNotNull(aeronChannel); - - Flux receive = aeronChannel.receive(); - - Flux data = - receive.doOnNext(b -> System.out.println("server received => " + b.getInt(0))); - - aeronChannel.send(data).subscribe(); - }; - - AeronSocketAddress serverManagementSocketAddress = - AeronSocketAddress.create("aeron:udp", "127.0.0.1", 39790); - EventLoop serverEventLoop = new SingleThreadedEventLoop("server"); - AeronChannelServer aeronChannelServer = - AeronChannelServer.create( - consumer, aeronWrapper, serverManagementSocketAddress, serverEventLoop); - - aeronChannelServer.start(); - - Publisher publisher = connector.apply(config); - - int count = 10; - CountDownLatch latch = new CountDownLatch(count); - - Mono.from(publisher) - .flatMap( - aeronChannel -> - Mono.create( - callback -> { - Flux data = - Flux.range(1, count) - .map( - i -> { - byte[] b = new byte[BitUtil.SIZE_OF_INT]; - UnsafeBuffer buffer = new UnsafeBuffer(b); - buffer.putInt(0, i); - return buffer; - }); - - aeronChannel - .receive() - .doOnNext(b -> latch.countDown()) - .doOnNext(callback::success) - .subscribe(); - aeronChannel.send(data).subscribe(); - })) - .subscribe(); - - latch.await(); - } -} diff --git a/rsocket-transport-aeron/src/test/resources/log4j.properties b/rsocket-transport-aeron/src/test/resources/log4j.properties deleted file mode 100644 index 6477d125f..000000000 --- a/rsocket-transport-aeron/src/test/resources/log4j.properties +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright 2016 Netflix, Inc. -#

-# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -#

-# http://www.apache.org/licenses/LICENSE-2.0 -#

-# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on -# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. -# - - -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -log4j.rootLogger=INFO, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %5p [%t] (%F:%L) - %m%n \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index f32f1e087..16630076a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -21,6 +21,5 @@ include 'rsocket-examples' include 'rsocket-load-balancer' include 'rsocket-micrometer' include 'rsocket-test' -include 'rsocket-transport-aeron' include 'rsocket-transport-local' include 'rsocket-transport-netty'