HBASE-12535 NPE in WALFactory under contention for getInstance()
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
05ced20a34
commit
db2b6421ff
|
@ -187,7 +187,11 @@ public class WALFactory {
|
||||||
if (null != metaProvider) {
|
if (null != metaProvider) {
|
||||||
metaProvider.close();
|
metaProvider.close();
|
||||||
}
|
}
|
||||||
provider.close();
|
// close is called on a WALFactory with null provider in the case of contention handling
|
||||||
|
// within the getInstance method.
|
||||||
|
if (null != provider) {
|
||||||
|
provider.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -152,6 +152,11 @@ public class TestWALFactory {
|
||||||
TEST_UTIL.shutdownMiniCluster();
|
TEST_UTIL.shutdownMiniCluster();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void canCloseSingleton() throws IOException {
|
||||||
|
WALFactory.getInstance(conf).close();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just write multiple logs then split. Before fix for HADOOP-2283, this
|
* Just write multiple logs then split. Before fix for HADOOP-2283, this
|
||||||
* would fail.
|
* would fail.
|
||||||
|
|
Loading…
Reference in New Issue