You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by aa...@apache.org on 2021/03/31 19:28:25 UTC
[hadoop] branch trunk updated: Revert "HADOOP-17608. Fix NPE in
TestKMS (#2828)"
This is an automated email from the ASF dual-hosted git repository.
aajisaka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new a94a23a Revert "HADOOP-17608. Fix NPE in TestKMS (#2828)"
a94a23a is described below
commit a94a23ab9efd0ec1a67f16b3d8721ebcf17edd40
Author: Akira Ajisaka <aa...@apache.org>
AuthorDate: Thu Apr 1 04:24:26 2021 +0900
Revert "HADOOP-17608. Fix NPE in TestKMS (#2828)"
This reverts commit d69088a097ff6f6bb25203bdc8ac5b71f8243c97.
---
.../hadoop/crypto/key/kms/server/TestKMS.java | 37 +++++++++++-----------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMS.java b/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMS.java
index dbe685b..3d59e6f 100644
--- a/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMS.java
+++ b/hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMS.java
@@ -18,8 +18,6 @@
package org.apache.hadoop.crypto.key.kms.server;
import java.util.function.Supplier;
-
-import org.apache.commons.lang3.ThreadUtils;
import org.apache.hadoop.thirdparty.com.google.common.cache.LoadingCache;
import org.apache.curator.test.TestingServer;
import org.apache.hadoop.conf.Configuration;
@@ -527,7 +525,6 @@ public class TestKMS {
if (ssl) {
sslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, conf);
try {
- // the first reloader thread is created here
sslFactory.init();
} catch (GeneralSecurityException ex) {
throw new IOException(ex);
@@ -544,29 +541,31 @@ public class TestKMS {
final URI uri = createKMSUri(getKMSUrl());
if (ssl) {
- // the second reloader thread is created here
KeyProvider testKp = createProvider(uri, conf);
- Collection<Thread> reloaderThreads =
- ThreadUtils.findThreadsByName(SSL_RELOADER_THREAD_NAME);
- // now there are two active reloader threads
- assertEquals(2, reloaderThreads.size());
- // Explicitly close the provider so we can verify
- // the second reloader thread is shutdown
+ ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+ while (threadGroup.getParent() != null) {
+ threadGroup = threadGroup.getParent();
+ }
+ Thread[] threads = new Thread[threadGroup.activeCount()];
+ threadGroup.enumerate(threads);
+ Thread reloaderThread = null;
+ for (Thread thread : threads) {
+ if ((thread.getName() != null)
+ && (thread.getName().contains(SSL_RELOADER_THREAD_NAME))) {
+ reloaderThread = thread;
+ }
+ }
+ Assert.assertTrue("Reloader is not alive", reloaderThread.isAlive());
+ // Explicitly close the provider so we can verify the internal thread
+ // is shutdown
testKp.close();
boolean reloaderStillAlive = true;
for (int i = 0; i < 10; i++) {
- for (Thread thread : reloaderThreads) {
- if (!thread.isAlive()) {
- reloaderStillAlive = false;
- break;
- }
- }
+ reloaderStillAlive = reloaderThread.isAlive();
+ if (!reloaderStillAlive) break;
Thread.sleep(1000);
}
Assert.assertFalse("Reloader is still alive", reloaderStillAlive);
- reloaderThreads =
- ThreadUtils.findThreadsByName(SSL_RELOADER_THREAD_NAME);
- assertEquals(1, reloaderThreads.size());
}
if (kerberos) {
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org