ARTEMIS-2667 NPE w/clearing non-durable dupl ID cache
This commit is contained in:
parent
b0b6734b39
commit
402dda2161
|
@ -301,7 +301,7 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache {
|
||||||
public void clear() throws Exception {
|
public void clear() throws Exception {
|
||||||
logger.debug("DuplicateIDCacheImpl(" + this.address + ")::clear removing duplicate ID data");
|
logger.debug("DuplicateIDCacheImpl(" + this.address + ")::clear removing duplicate ID data");
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (ids.size() > 0) {
|
if (ids.size() > 0 && persist) {
|
||||||
long tx = storageManager.generateID();
|
long tx = storageManager.generateID();
|
||||||
for (Pair<ByteArrayHolder, Long> id : ids) {
|
for (Pair<ByteArrayHolder, Long> id : ids) {
|
||||||
storageManager.deleteDuplicateIDTransactional(tx, id.getB());
|
storageManager.deleteDuplicateIDTransactional(tx, id.getB());
|
||||||
|
|
|
@ -95,6 +95,8 @@ public class DuplicateCacheTest extends StorageManagerTestBase {
|
||||||
Assert.assertTrue(latch.await(1, TimeUnit.MINUTES));
|
Assert.assertTrue(latch.await(1, TimeUnit.MINUTES));
|
||||||
|
|
||||||
Assert.assertFalse(cache.contains(id));
|
Assert.assertFalse(cache.contains(id));
|
||||||
|
|
||||||
|
cache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -119,5 +121,6 @@ public class DuplicateCacheTest extends StorageManagerTestBase {
|
||||||
cache.addToCache(bytes, null);
|
cache.addToCache(bytes, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cache.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue