From 29ed4157b30d9720337d576ad48c28e9d1c47114 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 c4fd11cbc40..604cf118957 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 @@ -2480,9 +2480,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); }