From: David ‘Bombe’ Roden Date: Tue, 15 Apr 2008 17:15:28 +0000 (+0000) Subject: add setDone() to finalize result X-Git-Tag: v0.1.1~161 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=fa94fcde43d1c87745bcdbf25b4fa6242d5b1834;p=jFCPlib.git add setDone() to finalize result git-svn-id: http://trooper/svn/projects/jFCPlib/branch/high-level-client@823 c3eda9e8-030b-0410-8277-bc7414b0a119 --- diff --git a/src/net/pterodactylus/fcp/highlevel/HighLevelCallback.java b/src/net/pterodactylus/fcp/highlevel/HighLevelCallback.java index aed413d..3e3e70f 100644 --- a/src/net/pterodactylus/fcp/highlevel/HighLevelCallback.java +++ b/src/net/pterodactylus/fcp/highlevel/HighLevelCallback.java @@ -185,4 +185,20 @@ public class HighLevelCallback { } } + /** + * Marks the result given in with + * {@link #setResult(HighLevelResult, boolean)} as complete and notify the + * listeners. If the result was already complete, nothing will be done. + */ + void setDone() { + synchronized (syncObject) { + if (resultComplete) { + return; + } + resultComplete = true; + syncObject.notify(); + } + fireGotResult(); + } + }