/** Whether the job has finished. */
private boolean finished;
+ /** Whether the job was successful. */
+ private boolean success;
+
//
// ACTIONS
//
* Waits for completion of this job or stopping of the WebOfTrust
* updater.
*
+ * @return {@code true} if this job finished successfully, {@code false}
+ * otherwise
+ *
* @see WebOfTrustUpdater#stop()
*/
@SuppressWarnings("synthetic-access")
- public void waitForCompletion() {
+ public boolean waitForCompletion() {
synchronized (syncObject) {
while (!finished && !shouldStop()) {
try {
/* we’re looping, ignore. */
}
}
+ return success;
}
}
/**
* Signals that this job has finished.
+ *
+ * @param success
+ * {@code true} if this job finished successfully,
+ * {@code false} otherwise
*/
- protected void finish() {
+ protected void finish(boolean success) {
synchronized (syncObject) {
finished = true;
+ this.success = success;
syncObject.notifyAll();
}
}
}
webOfTrustConnector.removeTrust(truster, trustee);
}
+ finish(true);
} catch (WebOfTrustException wote1) {
logger.log(Level.WARNING, "Could not set Trust value for " + truster + " -> " + trustee + " to " + score + " (" + comment + ")!", wote1);
+ finish(false);
}
- finish();
}
}
if (trustee instanceof DefaultIdentity) {
((DefaultIdentity) trustee).setTrust(truster, trust);
}
+ finish(true);
} catch (PluginException pe1) {
logger.log(Level.WARNING, "Could not get Trust value for " + truster + " -> " + trustee + "!", pe1);
+ finish(false);
}
- finish();
}
}