summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTom Taylor <tomtaylor@google.com>2012-03-05 14:47:27 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-05 14:47:27 -0800
commitc1717569db5a637b054e552e255b2bbf36f7a3f1 (patch)
tree92cd35551d6953b75fc80c44f9d29cf009613c92 /core/java
parent74e8d6261aa064748049f3e85c8e72c82363134c (diff)
parent2dc6c7fa48d749773e5ccbc98633d7cf9d35e7ac (diff)
Merge "Remove deleted pdu items from the updated cache"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/com/google/android/mms/pdu/PduPersister.java12
-rw-r--r--core/java/com/google/android/mms/util/PduCache.java4
2 files changed, 16 insertions, 0 deletions
diff --git a/core/java/com/google/android/mms/pdu/PduPersister.java b/core/java/com/google/android/mms/pdu/PduPersister.java
index 7037b6128c29..b04f8908515e 100644
--- a/core/java/com/google/android/mms/pdu/PduPersister.java
+++ b/core/java/com/google/android/mms/pdu/PduPersister.java
@@ -513,6 +513,9 @@ public class PduPersister {
PduCacheEntry cacheEntry;
synchronized(PDU_CACHE_INSTANCE) {
if (PDU_CACHE_INSTANCE.isUpdating(uri)) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "load: " + uri + " blocked by isUpdating()");
+ }
try {
PDU_CACHE_INSTANCE.wait();
} catch (InterruptedException e) {
@@ -840,6 +843,9 @@ public class PduPersister {
// If the cache item is getting updated, wait until it's done updating before
// purging it.
if (PDU_CACHE_INSTANCE.isUpdating(uri)) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "updateHeaders: " + uri + " blocked by isUpdating()");
+ }
try {
PDU_CACHE_INSTANCE.wait();
} catch (InterruptedException e) {
@@ -1002,6 +1008,9 @@ public class PduPersister {
PduCacheEntry cacheEntry;
synchronized(PDU_CACHE_INSTANCE) {
if (PDU_CACHE_INSTANCE.isUpdating(uri)) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "updateParts: " + uri + " blocked by isUpdating()");
+ }
try {
PDU_CACHE_INSTANCE.wait();
} catch (InterruptedException e) {
@@ -1097,6 +1106,9 @@ public class PduPersister {
// If the cache item is getting updated, wait until it's done updating before
// purging it.
if (PDU_CACHE_INSTANCE.isUpdating(uri)) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "persist: " + uri + " blocked by isUpdating()");
+ }
try {
PDU_CACHE_INSTANCE.wait();
} catch (InterruptedException e) {
diff --git a/core/java/com/google/android/mms/util/PduCache.java b/core/java/com/google/android/mms/util/PduCache.java
index 87cb48e53370..de83124bad7b 100644
--- a/core/java/com/google/android/mms/util/PduCache.java
+++ b/core/java/com/google/android/mms/util/PduCache.java
@@ -161,6 +161,7 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
}
private PduCacheEntry purgeSingleEntry(Uri key) {
+ mUpdating.remove(key);
PduCacheEntry entry = super.purge(key);
if (entry != null) {
removeFromThreads(key, entry);
@@ -176,6 +177,7 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
mMessageBoxes.clear();
mThreads.clear();
+ mUpdating.clear();
}
/**
@@ -216,6 +218,7 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
HashSet<Uri> msgBox = mMessageBoxes.remove(msgBoxId);
if (msgBox != null) {
for (Uri key : msgBox) {
+ mUpdating.remove(key);
PduCacheEntry entry = super.purge(key);
if (entry != null) {
removeFromThreads(key, entry);
@@ -240,6 +243,7 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
HashSet<Uri> thread = mThreads.remove(threadId);
if (thread != null) {
for (Uri key : thread) {
+ mUpdating.remove(key);
PduCacheEntry entry = super.purge(key);
if (entry != null) {
removeFromMessageBoxes(key, entry);