private final Map<String, String> properties = Collections.synchronizedMap(new HashMap<String, String>());
/** Cached trust. */
+ /* synchronize on itself. */
private final WritableCache<OwnIdentity, Trust> trustCache = new MemoryCache<OwnIdentity, Trust>(new ValueRetriever<OwnIdentity, Trust>() {
@Override
@Override
public Trust getTrust(OwnIdentity ownIdentity) {
try {
- return trustCache.get(ownIdentity);
+ synchronized (trustCache) {
+ return trustCache.get(ownIdentity);
+ }
} catch (CacheException ce1) {
logger.log(Level.WARNING, "Could not get trust for OwnIdentity: " + ownIdentity, ce1);
return null;
* The trust received for this identity
*/
void setTrustPrivate(OwnIdentity ownIdentity, Trust trust) {
- trustCache.put(ownIdentity, trust);
+ synchronized (trustCache) {
+ trustCache.put(ownIdentity, trust);
+ }
}
//