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 160d9bca060..c5bcdf4d452 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 @@ -1478,8 +1478,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 7921926149d..43a6792fd1f 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 @@ -63,20 +63,14 @@ 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 ServerContext ctx; private volatile LongConsumer zombieCountConsumer = null; 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)); } @@ -98,7 +92,7 @@ public long createSession(Session session, boolean reserve) { } public long getMaxIdleTime() { - return maxIdle; + return ctx.getConfiguration().getTimeInMillis(Property.TSERV_SESSION_MAXIDLE); } /** @@ -294,7 +288,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()) {