Skip to content

Commit ca7ceed

Browse files
committed
remove AsynchronousByteListenChannel
1 parent e3f447d commit ca7ceed

File tree

4 files changed

+8
-28
lines changed

4 files changed

+8
-28
lines changed

runtime-rpc/src/main/java/org/capnproto/EzRpcServer.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,6 @@ public int getPort() {
3131
}
3232

3333
public CompletableFuture<java.lang.Void> start() {
34-
return this.twoPartyRpc.listen(new AsynchronousByteListenChannel() {
35-
@Override
36-
public <A> void accept(A attachment, CompletionHandler<AsynchronousByteChannel, ? super A> handler) {
37-
serverAcceptSocket.accept(attachment, new CompletionHandler<>() {
38-
@Override
39-
public void completed(AsynchronousSocketChannel result, A attachment) {
40-
handler.completed(result, attachment);
41-
}
42-
43-
@Override
44-
public void failed(Throwable exc, A attachment) {
45-
handler.failed(exc, attachment);
46-
}
47-
});
48-
}
49-
});
34+
return this.twoPartyRpc.listen(this.serverAcceptSocket);
5035
}
5136
}

runtime-rpc/src/main/java/org/capnproto/TwoPartyServer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public void accept(AsynchronousByteChannel channel) {
3939
});
4040
}
4141

42-
public CompletableFuture<java.lang.Void> listen(AsynchronousByteListenChannel listener) {
43-
var result = new CompletableFuture<AsynchronousByteChannel>();
42+
public CompletableFuture<java.lang.Void> listen(AsynchronousServerSocketChannel listener) {
43+
var result = new CompletableFuture<AsynchronousSocketChannel>();
4444
listener.accept(null, new CompletionHandler<>() {
4545
@Override
46-
public void completed(AsynchronousByteChannel channel, Object attachment) {
46+
public void completed(AsynchronousSocketChannel channel, Object attachment) {
4747
accept(channel);
4848
result.complete(null);
4949
}

runtime-rpc/src/main/java/org/capnproto/TwoPartyVatNetwork.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.FileDescriptor;
44
import java.nio.channels.AsynchronousByteChannel;
5+
import java.nio.channels.AsynchronousSocketChannel;
56
import java.util.List;
67
import java.util.concurrent.CompletableFuture;
78

@@ -71,7 +72,9 @@ public CompletableFuture<java.lang.Void> shutdown() {
7172

7273
var result = this.previousWrite.whenComplete((void_, exc) -> {
7374
try {
74-
this.channel.shutdownOutput();
75+
if (this.channel instanceof AsynchronousSocketChannel) {
76+
((AsynchronousSocketChannel)this.channel).shutdownOutput();
77+
}
7578
}
7679
catch (Exception ignored) {
7780
}

runtime/src/main/java/org/capnproto/AsynchronousByteListenChannel.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)