X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2Fquelaton%2FGenerateKeypairCommandImpl.java;h=d5f30d6f46d373f2a3daa27cb0c7b777ebe3bba1;hb=bbe77c263f9f37b2407a6b5ce2f5e68e11bd9e7c;hp=6f5df331d86d065a2fab6f880a4cf3320fc8337b;hpb=7980851d84be2f31d0db3837619eb1548c3847c7;p=jFCPlib.git diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/GenerateKeypairCommandImpl.java b/src/main/java/net/pterodactylus/fcp/quelaton/GenerateKeypairCommandImpl.java index 6f5df33..d5f30d6 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/GenerateKeypairCommandImpl.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/GenerateKeypairCommandImpl.java @@ -9,6 +9,10 @@ import net.pterodactylus.fcp.FcpKeyPair; import net.pterodactylus.fcp.GenerateSSK; import net.pterodactylus.fcp.SSKKeypair; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; + /** * Implementation of the {@link GenerateKeypairCommand}. * @@ -16,16 +20,16 @@ import net.pterodactylus.fcp.SSKKeypair; */ class GenerateKeypairCommandImpl implements GenerateKeypairCommand { - private final ExecutorService threadPool; + private final ListeningExecutorService threadPool; private final ConnectionSupplier connectionSupplier; GenerateKeypairCommandImpl(ExecutorService threadPool, ConnectionSupplier connectionSupplier) { - this.threadPool = threadPool; + this.threadPool = MoreExecutors.listeningDecorator(threadPool); this.connectionSupplier = connectionSupplier; } @Override - public Future execute() { + public ListenableFuture execute() { return threadPool.submit(() -> new FcpKeyPairReplySequence().send(new GenerateSSK()).get()); }