Lock clustersReadLock) {
if (featureVector == null || clusters == null || clusters.isEmpty()) {
return;
}
IDCluster closestCentroid;
clustersReadLock.lock();
try {
closestCentroid = findClosestCentroid(featureVector, clusters);
} finally {
clustersReadLock.unlock();
}
if (closestCentroid == null) {
return;
}
FastIDSet newMembers = closestCentroid.getMembers();
boolean removeFromCurrentCluster;
synchronized (newMembers) {
// Wasn't already present, so was present elsewhere; find and remove it
removeFromCurrentCluster = newMembers.add(id);