}
}
try {
WriteResult writeResult = dbCollection.update(query.get(), update, false, true, WriteConcern.SAFE);
if (writeResult.getError() != null) {
throw new MicroKernelException("Update failed: " + writeResult.getError());
}
// update cache
for (Entry<String, NodeDocument> entry : cachedDocs.entrySet()) {
Lock lock = getAndLock(entry.getKey());
try {
if (entry.getValue() == null) {
// make sure concurrently loaded document is invalidated
nodesCache.invalidate(entry.getKey());
} else {
applyToCache(Collection.NODES, entry.getValue(),
new UpdateOp(entry.getKey(), updateOp));
}
} finally {
lock.unlock();
}
}
} catch (MongoException e) {
throw new MicroKernelException(e);
}
} finally {
end("update", start);
}
}