/** * Check if a session has timed out, and if it has close the session. */ @Override public boolean triggerTimeout(long sessionTimeout) { if (hasTimedOut(activeJobs, lastSparkJobCompletionTime, sessionTimeout)) { closeLock.writeLock().lock(); try { if (hasTimedOut(activeJobs, lastSparkJobCompletionTime, sessionTimeout)) { LOG.warn("Closing Spark session " + getSessionId() + " because a Spark job has not " + "been run in the past " + sessionTimeout / 1000 + " seconds"); close(); return true; } } finally { closeLock.writeLock().unlock(); } } return false; }