X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2Fquelaton%2FListPeerNotesCommandImpl.java;h=8e1df8c0c5d04aefbadba526c74614be89352994;hb=7a3be5ca037785f4f1acb225381578db12d15eb1;hp=0cd04839bef9b1c5b04f12864a4b7cf6ac856415;hpb=91de0a638af50527fc314ed97a095d1beaf36866;p=jFCPlib.git diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/ListPeerNotesCommandImpl.java b/src/main/java/net/pterodactylus/fcp/quelaton/ListPeerNotesCommandImpl.java index 0cd0483..8e1df8c 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/ListPeerNotesCommandImpl.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/ListPeerNotesCommandImpl.java @@ -6,6 +6,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; import net.pterodactylus.fcp.EndListPeerNotes; import net.pterodactylus.fcp.ListPeerNotes; @@ -25,11 +26,13 @@ public class ListPeerNotesCommandImpl implements ListPeerNotesCommand { private final ListeningExecutorService threadPool; private final ConnectionSupplier connectionSupplier; + private final Supplier identifierGenerator; private final AtomicReference nodeIdentifier = new AtomicReference<>(); - public ListPeerNotesCommandImpl(ExecutorService threadPool, ConnectionSupplier connectionSupplier) { + public ListPeerNotesCommandImpl(ExecutorService threadPool, ConnectionSupplier connectionSupplier, Supplier identifierGenerator) { this.threadPool = MoreExecutors.listeningDecorator(threadPool); this.connectionSupplier = connectionSupplier; + this.identifierGenerator = identifierGenerator; } @Override @@ -55,8 +58,7 @@ public class ListPeerNotesCommandImpl implements ListPeerNotesCommand { } private Optional executeDialog() throws IOException, ExecutionException, InterruptedException { - ListPeerNotes listPeerNotes = - new ListPeerNotes(new RandomIdentifierGenerator().generate(), nodeIdentifier.get()); + ListPeerNotes listPeerNotes = new ListPeerNotes(identifierGenerator.get(), nodeIdentifier.get()); try (ListPeerNotesDialog listPeerNotesDialog = new ListPeerNotesDialog()) { return listPeerNotesDialog.send(listPeerNotes).get(); }