From 5d64f062d8515f561a0f87513c7e0c1724dae055 Mon Sep 17 00:00:00 2001 From: satanson Date: Sun, 18 Aug 2019 09:47:06 +0800 Subject: [PATCH] HBASE-22870 reflection fails to access a private nested class Signed-off-by Reid Chan (cherry picked from commit 7697d48cd7b636396d5f73be43326a4501a9ea43) --- .../org/apache/hadoop/hbase/regionserver/HRegionServer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index ef360850a45..4bf7c50f79b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -1073,9 +1073,11 @@ public class HRegionServer extends HasThread implements Timer abortMonitor = new Timer("Abort regionserver monitor", true); TimerTask abortTimeoutTask = null; try { - abortTimeoutTask = + Constructor timerTaskCtor = Class.forName(conf.get(ABORT_TIMEOUT_TASK, SystemExitWhenAbortTimeout.class.getName())) - .asSubclass(TimerTask.class).getDeclaredConstructor().newInstance(); + .asSubclass(TimerTask.class).getDeclaredConstructor(); + timerTaskCtor.setAccessible(true); + abortTimeoutTask = timerTaskCtor.newInstance(); } catch (Exception e) { LOG.warn("Initialize abort timeout task failed", e); }