+ /**
+ * Waits for completion of this job or stopping of the WebOfTrust
+ * updater.
+ *
+ * @see WebOfTrustUpdater#stop()
+ */
+ @SuppressWarnings("synthetic-access")
+ public void waitForCompletion() {
+ synchronized (syncObject) {
+ while (!finished && !shouldStop()) {
+ try {
+ syncObject.wait();
+ } catch (InterruptedException ie1) {
+ /* we’re looping, ignore. */
+ }
+ }
+ }
+ }
+
+ //
+ // PROTECTED METHODS
+ //
+
+ /**
+ * Signals that this job has finished.
+ */
+ protected void finish() {
+ synchronized (syncObject) {
+ finished = true;
+ syncObject.notifyAll();
+ }
+ }
+