remove AsynchronousByteListenChannel
This commit is contained in:
parent
e3f447d4c7
commit
ca7ceed32f
4 changed files with 8 additions and 28 deletions
|
@ -31,21 +31,6 @@ public class EzRpcServer {
|
|||
}
|
||||
|
||||
public CompletableFuture<java.lang.Void> start() {
|
||||
return this.twoPartyRpc.listen(new AsynchronousByteListenChannel() {
|
||||
@Override
|
||||
public <A> void accept(A attachment, CompletionHandler<AsynchronousByteChannel, ? super A> handler) {
|
||||
serverAcceptSocket.accept(attachment, new CompletionHandler<>() {
|
||||
@Override
|
||||
public void completed(AsynchronousSocketChannel result, A attachment) {
|
||||
handler.completed(result, attachment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Throwable exc, A attachment) {
|
||||
handler.failed(exc, attachment);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return this.twoPartyRpc.listen(this.serverAcceptSocket);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,11 +39,11 @@ public class TwoPartyServer {
|
|||
});
|
||||
}
|
||||
|
||||
public CompletableFuture<java.lang.Void> listen(AsynchronousByteListenChannel listener) {
|
||||
var result = new CompletableFuture<AsynchronousByteChannel>();
|
||||
public CompletableFuture<java.lang.Void> listen(AsynchronousServerSocketChannel listener) {
|
||||
var result = new CompletableFuture<AsynchronousSocketChannel>();
|
||||
listener.accept(null, new CompletionHandler<>() {
|
||||
@Override
|
||||
public void completed(AsynchronousByteChannel channel, Object attachment) {
|
||||
public void completed(AsynchronousSocketChannel channel, Object attachment) {
|
||||
accept(channel);
|
||||
result.complete(null);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.capnproto;
|
|||
|
||||
import java.io.FileDescriptor;
|
||||
import java.nio.channels.AsynchronousByteChannel;
|
||||
import java.nio.channels.AsynchronousSocketChannel;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
|
@ -71,7 +72,9 @@ public class TwoPartyVatNetwork
|
|||
|
||||
var result = this.previousWrite.whenComplete((void_, exc) -> {
|
||||
try {
|
||||
this.channel.shutdownOutput();
|
||||
if (this.channel instanceof AsynchronousSocketChannel) {
|
||||
((AsynchronousSocketChannel)this.channel).shutdownOutput();
|
||||
}
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package org.capnproto;
|
||||
|
||||
import java.nio.channels.AsynchronousByteChannel;
|
||||
import java.nio.channels.CompletionHandler;
|
||||
|
||||
public interface AsynchronousByteListenChannel {
|
||||
public abstract <A> void accept(A attachment, CompletionHandler<AsynchronousByteChannel,? super A> handler);
|
||||
}
|
Loading…
Reference in a new issue