Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Modify workaround for OryxProject#304
Browse files Browse the repository at this point in the history
  • Loading branch information
srowen committed Sep 30, 2016
1 parent 7d9a84b commit c92b815
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.koloboke.collect.ObjCursor;
import com.koloboke.collect.map.ObjIntMap;
import com.koloboke.collect.map.ObjObjMap;
import com.koloboke.collect.map.hash.HashObjIntMaps;
Expand Down Expand Up @@ -362,16 +363,18 @@ void retainRecentAndKnownItems(Collection<String> users, Collection<String> item
try (AutoLock al = knownItemsLock.autoReadLock()) {
knownItems.values().forEach(knownItemsForUser -> {
synchronized (knownItemsForUser) {
try {
knownItemsForUser.removeIf(notKeptOrRecent);
} catch (ClassCastException cce) {
// TODO remove this temporary debugging catch block!
// see https://github.com/OryxProject/oryx/issues/304
log.warn("Caught unexpected error updating knownItemsForUser", cce);
for (Object o : knownItemsForUser) {
log.info("{} {}", o.getClass(), o);
// knownItemsForUser.removeIf(notKeptOrRecent);
// TODO remove this temporary hack workaround and restore above
// see https://github.com/OryxProject/oryx/issues/304
ObjCursor<?> cursor = knownItemsForUser.cursor();
while (cursor.moveNext()) {
Object o = cursor.elem();
if (!(o instanceof String)) {
log.warn("Found non-String collection: {}", o);
cursor.remove();
} else if (notKeptOrRecent.test((String) o)) {
cursor.remove();
}
throw cce;
}
}
});
Expand Down

0 comments on commit c92b815

Please sign in to comment.