* The identity receiving the trust
*/
public void getTrust(OwnIdentity truster, Identity trustee) {
- updateJobs.add(new GetTrustJob(truster, trustee));
+ GetTrustJob getTrustJob = new GetTrustJob(truster, trustee);
+ if (!updateJobs.contains(getTrustJob)) {
+ logger.log(Level.FINER, "Adding Trust Update Job: " + getTrustJob);
+ try {
+ updateJobs.put(getTrustJob);
+ } catch (InterruptedException ie1) {
+ /* the queue is unbounded so it should never block. */
+ }
+ }
}
/**
* The comment of the trust relation
*/
public void setTrust(OwnIdentity truster, Identity trustee, Integer score, String comment) {
- updateJobs.add(new SetTrustJob(truster, trustee, score, comment));
+ SetTrustJob setTrustJob = new SetTrustJob(truster, trustee, score, comment);
+ if (updateJobs.contains(setTrustJob)) {
+ updateJobs.remove(setTrustJob);
+ }
+ logger.log(Level.FINER, "Adding Trust Update Job: " + setTrustJob);
+ try {
+ updateJobs.put(setTrustJob);
+ } catch (InterruptedException e) {
+ /* the queue is unbounded so it should never block. */
+ }
}
//