From c0cf7cefd19db070552cbfea02a6638607704aae Mon Sep 17 00:00:00 2001 From: Christopher Eby Date: Thu, 22 Dec 2011 02:43:47 -0600 Subject: [PATCH] Fix race condition in CoverView --- src/org/kreed/vanilla/Cache.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/kreed/vanilla/Cache.java b/src/org/kreed/vanilla/Cache.java index cc1a467c..79a4e229 100644 --- a/src/org/kreed/vanilla/Cache.java +++ b/src/org/kreed/vanilla/Cache.java @@ -105,7 +105,7 @@ public class Cache { * * @param key The key of the item to touch. */ - public void touch(long key) + public synchronized void touch(long key) { long[] keys = mKeys; Object[] values = mValues; @@ -129,7 +129,7 @@ public class Cache { * @return The item that was discarded, or null if the cache is not full. */ @SuppressWarnings("unchecked") - public E discardOldest() + public synchronized E discardOldest() { int count = count(); // Cache is not full. @@ -151,7 +151,7 @@ public class Cache { * existing key in the cache. * @param value The item. */ - public void put(long key, E value) + public synchronized void put(long key, E value) { int count = count(); Assert.assertFalse(count == mKeys.length); // must not be full