diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java index 92ce7812bba..42a57a1962a 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java @@ -1557,8 +1557,7 @@ public static boolean isValidTablePropertyKey(String key) { COMPACTOR_MINTHREADS_TIMEOUT, // others - TSERV_NATIVEMAP_ENABLED, TSERV_SCAN_MAX_OPENFILES, MANAGER_RECOVERY_WAL_EXISTENCE_CACHE_TIME, - TSERV_SESSION_MAXIDLE, TSERV_UPDATE_SESSION_MAXIDLE); + TSERV_NATIVEMAP_ENABLED, TSERV_SCAN_MAX_OPENFILES, MANAGER_RECOVERY_WAL_EXISTENCE_CACHE_TIME); /** * Checks if the given property may be changed via Zookeeper, but not recognized until the restart diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java index 564f25c019d..f34e331d7bf 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java @@ -67,8 +67,6 @@ public class SessionManager { private static final Logger log = LoggerFactory.getLogger(SessionManager.class); private final ConcurrentMap sessions = new ConcurrentHashMap<>(); - private final long maxIdle; - private final long maxUpdateIdle; private final BlockingQueue deferredCleanupQueue = new ArrayBlockingQueue<>(5000); private final Long expiredSessionMarker = (long) -1; private final ServerContext ctx; @@ -76,12 +74,8 @@ public class SessionManager { public SessionManager(ServerContext context) { this.ctx = context; - final AccumuloConfiguration aconf = context.getConfiguration(); - maxUpdateIdle = aconf.getTimeInMillis(Property.TSERV_UPDATE_SESSION_MAXIDLE); - maxIdle = aconf.getTimeInMillis(Property.TSERV_SESSION_MAXIDLE); - - Runnable r = () -> sweep(maxIdle, maxUpdateIdle); - + long maxIdle = ctx.getConfiguration().getTimeInMillis(Property.TSERV_SESSION_MAXIDLE); + Runnable r = () -> sweep(ctx); ThreadPools.watchCriticalScheduledTask(context.getScheduledExecutor().scheduleWithFixedDelay(r, 0, Math.max(maxIdle / 2, 1000), MILLISECONDS)); } @@ -103,7 +97,7 @@ public long createSession(Session session, boolean reserve) { } public long getMaxIdleTime() { - return maxIdle; + return ctx.getConfiguration().getTimeInMillis(Property.TSERV_SESSION_MAXIDLE); } /** @@ -299,7 +293,10 @@ private void cleanup(Session session) { cleanup(deferredCleanupQueue, session); } - private void sweep(final long maxIdle, final long maxUpdateIdle) { + private void sweep(final ServerContext context) { + final AccumuloConfiguration conf = context.getConfiguration(); + final long maxUpdateIdle = conf.getTimeInMillis(Property.TSERV_UPDATE_SESSION_MAXIDLE); + final long maxIdle = conf.getTimeInMillis(Property.TSERV_SESSION_MAXIDLE); List sessionsToCleanup = new LinkedList<>(); Iterator iter = sessions.values().iterator(); while (iter.hasNext()) {