updateFeatures(userFeatures, itemFeatures, value, generation);
FastByIDMap<FastIDSet> knownItemIDs = generation.getKnownItemIDs();
if (knownItemIDs != null) {
FastIDSet userKnownItemIDs;
ReadWriteLock knownItemLock = generation.getKnownItemLock();
Lock knownItemReadLock = knownItemLock.readLock();
knownItemReadLock.lock();
try {
userKnownItemIDs = knownItemIDs.get(userID);
if (userKnownItemIDs == null) {
userKnownItemIDs = new FastIDSet();
Lock knownItemWriteLock = knownItemLock.writeLock();
knownItemReadLock.unlock();
knownItemWriteLock.lock();
try {
knownItemIDs.put(userID, userKnownItemIDs);
} finally {
knownItemReadLock.lock();
knownItemWriteLock.unlock();
}
}
} finally {
knownItemReadLock.unlock();
}
synchronized (userKnownItemIDs) {
userKnownItemIDs.add(itemID);
}
}
updateClusters(userID, userFeatures, generation.getUserClusters(), generation.getUserClustersLock().readLock());
updateClusters(itemID, itemFeatures, generation.getItemClusters(), generation.getItemClustersLock().readLock());