X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2Fquelaton%2FDefaultFcpClient.java;h=42522e049f7d73e05ce85060ca81f059cd2522fe;hb=e556f854462736f67977c60978a13cc1e1f7ee88;hp=9c7a7056b4eb7dc17a1e01ea6f0b68e970b15418;hpb=0594300da2613fc58e794b655b2dd9b27c074b0b;p=jFCPlib.git diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/DefaultFcpClient.java b/src/main/java/net/pterodactylus/fcp/quelaton/DefaultFcpClient.java index 9c7a705..42522e0 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/DefaultFcpClient.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/DefaultFcpClient.java @@ -12,6 +12,9 @@ import net.pterodactylus.fcp.CloseConnectionDuplicateClientName; import net.pterodactylus.fcp.FcpConnection; import net.pterodactylus.fcp.NodeHello; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; + /** * Default {@link FcpClient} implementation. * @@ -19,7 +22,7 @@ import net.pterodactylus.fcp.NodeHello; */ public class DefaultFcpClient implements FcpClient { - private final ExecutorService threadPool; + private final ListeningExecutorService threadPool; private final String hostname; private final int port; private final AtomicReference fcpConnection = new AtomicReference<>(); @@ -28,7 +31,7 @@ public class DefaultFcpClient implements FcpClient { public DefaultFcpClient(ExecutorService threadPool, String hostname, int port, Supplier clientName, Supplier expectedVersion) { - this.threadPool = threadPool; + this.threadPool = MoreExecutors.listeningDecorator(threadPool); this.hostname = hostname; this.port = port; this.clientName = clientName; @@ -69,6 +72,11 @@ public class DefaultFcpClient implements FcpClient { return new ClientGetCommandImpl(threadPool, this::connect); } + @Override + public ClientPutCommand clientPut() { + return new ClientPutCommandImpl(threadPool, this::connect); + } + private class ClientHelloReplySequence extends FcpReplySequence { private final AtomicReference receivedNodeHello;