OwnIdentity ownIdentity = ownIdentityAddedEvent.ownIdentity();
logger.log(Level.FINEST, String.format("Adding OwnIdentity: %s", ownIdentity));
if (ownIdentity.hasContext("Sone")) {
+ database.storeIdentity(ownIdentity);
addLocalSone(ownIdentity);
}
}
Identity identity = identityAddedEvent.identity();
logger.log(Level.FINEST, String.format("Adding Identity: %s", identity));
trustedIdentities.put(identityAddedEvent.ownIdentity(), identity);
+ database.storeIdentity(identity);
addRemoteSone(identity);
}
@Subscribe
public void identityUpdated(IdentityUpdatedEvent identityUpdatedEvent) {
final Identity identity = identityUpdatedEvent.identity();
+ database.storeIdentity(identity);
soneDownloaders.execute(new Runnable() {
@Override
}
@Override
+ public void storeIdentity(Identity identitiy) {
+ lock.writeLock().lock();
+ try {
+ identities.put(identitiy.getId(), identitiy);
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ @Override
public Function<String, Optional<Sone>> getSone() {
return new Function<String, Optional<Sone>>() {
@Override