ARTEMIS-2667 NPE w/clearing non-durable dupl ID cache

This commit is contained in:
Justin Bertram 2020-03-18 21:02:59 -05:00 committed by Clebert Suconic
parent b0b6734b39
commit 402dda2161
2 changed files with 4 additions and 1 deletions

View File

@ -301,7 +301,7 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache {
public void clear() throws Exception {
logger.debug("DuplicateIDCacheImpl(" + this.address + ")::clear removing duplicate ID data");
synchronized (this) {
if (ids.size() > 0) {
if (ids.size() > 0 && persist) {
long tx = storageManager.generateID();
for (Pair<ByteArrayHolder, Long> id : ids) {
storageManager.deleteDuplicateIDTransactional(tx, id.getB());

View File

@ -95,6 +95,8 @@ public class DuplicateCacheTest extends StorageManagerTestBase {
Assert.assertTrue(latch.await(1, TimeUnit.MINUTES));
Assert.assertFalse(cache.contains(id));
cache.clear();
}
@Test
@ -119,5 +121,6 @@ public class DuplicateCacheTest extends StorageManagerTestBase {
cache.addToCache(bytes, null);
}
cache.clear();
}
}