From 7697d48cd7b636396d5f73be43326a4501a9ea43 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 --- .../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 61361be75f9..a0a6b4cbc5f 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 @@ -2475,9 +2475,11 @@ public class HRegionServer extends HasThread implements this.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); }