@Override public void closeAndReopenExpiredSession(TezSessionPoolSession session) throws Exception { // By definition, this session is not in use and can no longer be in use, so it only // affects the session pool. We can handle this inline. tezAmPool.replaceSession(ensureOwnedSession(session)); }
@Override public void destroy(TezSessionState session) throws Exception { WmTezSession wmTezSession = ensureOwnedSession(session); resetGlobalTezSession(wmTezSession); currentLock.lock(); try { current.toDestroy.add(wmTezSession); notifyWmThreadUnderLock(); } finally { currentLock.unlock(); } }
@Override public void returnAfterUse(TezSessionPoolSession session) throws Exception { WmTezSession wmTezSession = ensureOwnedSession(session); resetGlobalTezSession(wmTezSession); currentLock.lock(); try { wmTezSession.createAndSetReturnFuture(); current.toReturn.add(wmTezSession); notifyWmThreadUnderLock(); } finally { currentLock.unlock(); } }
@Override public TezSessionState reopen(TezSessionState session) throws Exception { WmTezSession wmTezSession = ensureOwnedSession(session); HiveConf sessionConf = wmTezSession.getConf(); if (sessionConf == null) { // TODO: can this ever happen? LOG.warn("Session configuration is null for " + wmTezSession); sessionConf = new HiveConf(conf, WorkloadManager.class); } SettableFuture<WmTezSession> future = SettableFuture.create(); currentLock.lock(); try { if (current.toReopen.containsKey(wmTezSession)) { throw new AssertionError("The session is being reopened more than once " + session); } current.toReopen.put(wmTezSession, future); notifyWmThreadUnderLock(); } finally { currentLock.unlock(); } return future.get(); }