HDFS-15792. Addendum: ClasscastException while loading FSImage. Contributed by Renukaprasad C.

This commit is contained in:
He Xiaoqiao 2021-02-02 13:50:48 +08:00
parent a163aa7394
commit 1b893e10ae
No known key found for this signature in database
GPG Key ID: A80CC124E9A0FA63
1 changed files with 15 additions and 14 deletions

View File

@ -23,15 +23,14 @@ import org.junit.Assert;
import org.junit.Test;
/**
* Verify ReferenceCount map in concurrent scenarios
*
* Verify ReferenceCount map in concurrent scenarios.
*/
public class TestReferenceCountMap {
//Add these number of references in loop
public static final int LOOP_COUNTER = 10000;
//Use 2 global features
AclFeature aclFeature1 = new AclFeature(new int[]{1});
AclFeature aclFeature2 = new AclFeature(new int[]{2});
private AclFeature aclFeature1 = new AclFeature(new int[]{1});
private AclFeature aclFeature2 = new AclFeature(new int[]{2});
@Test
public void testReferenceCountMap() throws Exception {
@ -74,8 +73,10 @@ public class TestReferenceCountMap {
putThread1.join();
putThread2.join();
Assert.assertEquals(2 * LOOP_COUNTER, countMap.getReferenceCount(aclFeature1));
Assert.assertEquals(2 * LOOP_COUNTER, countMap.getReferenceCount(aclFeature2));
Assert.assertEquals(2 * LOOP_COUNTER,
countMap.getReferenceCount(aclFeature1));
Assert.assertEquals(2 * LOOP_COUNTER,
countMap.getReferenceCount(aclFeature2));
removeThread1.start();
removeThread1.join();
@ -84,8 +85,8 @@ public class TestReferenceCountMap {
}
class PutThread extends Thread {
ReferenceCountMap<AclFeature> referenceCountMap;
public PutThread(ReferenceCountMap<AclFeature> referenceCountMap){
private ReferenceCountMap<AclFeature> referenceCountMap;
PutThread(ReferenceCountMap<AclFeature> referenceCountMap) {
this.referenceCountMap = referenceCountMap;
}
@Override
@ -98,8 +99,8 @@ public class TestReferenceCountMap {
};
class RemoveThread extends Thread {
ReferenceCountMap<AclFeature> referenceCountMap;
public RemoveThread(ReferenceCountMap<AclFeature> referenceCountMap){
private ReferenceCountMap<AclFeature> referenceCountMap;
RemoveThread(ReferenceCountMap<AclFeature> referenceCountMap) {
this.referenceCountMap = referenceCountMap;
}
@Override