diff --git shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java index abe8cc2..98d21f0 100644 --- shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java +++ shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java @@ -293,8 +293,8 @@ public void run() { LOGGER.info("Starting expired delegation token remover thread, " + "tokenRemoverScanInterval=" + tokenRemoverScanInterval / (60 * 1000) + " min(s)"); - try { - while (running) { + while (running) { + try { long now = System.currentTimeMillis(); if (lastMasterKeyUpdate + keyUpdateInterval < now) { try { @@ -316,10 +316,18 @@ public void run() { .error("InterruptedExcpetion recieved for ExpiredTokenRemover thread " + ie); } + } catch (Throwable t) { + LOGGER.error("ExpiredTokenRemover thread received unexpected exception. " + + t, t); + // Wait 5 seconds too in case of an exception, so we do not end up in busy waiting for + // the solution for this exception + try { + Thread.sleep(5000); // 5 seconds + } catch (InterruptedException ie) { + LOGGER.error("InterruptedExcpetion recieved for ExpiredTokenRemover thread during " + + "wait in excpetion sleep" + ie); + } } - } catch (Throwable t) { - LOGGER.error("ExpiredTokenRemover thread received unexpected exception. " - + t, t); } } }