@Override public void run() { while (true) { // This should not start the actual Tez AM. SessionState ss = DriverUtils.setUpSessionState(conf, user, false); // Wait for the first item to arrive at the queue and process it. try { runOneWorkerIteration(ss, user, conf, true); } catch (InterruptedException e) { closeSession(ss); LOG.info("Worker thread was interrupted and will now exit"); return; } // Keep draining the queue in the same session. try { while (runOneWorkerIteration(ss, user, conf, false)) {} } catch (InterruptedException e) { closeSession(ss); LOG.info("Worker thread was interrupted unexpectedly and will now exit"); return; }; // Close the session before we have to wait again. closeSession(ss); SessionState.detachSession(); } } }
LOG.warn("Failed to close a bad session", e1); } finally { SessionState.detachSession();
private synchronized void releaseBeforeOpLock(boolean userAccess) { if (sessionState != null) { // can be null in-case of junit tests. skip reset. // reset thread name at release time. sessionState.resetThreadName(); } SessionState.detachSession(); if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } if (userAccess) { lastAccessTime = System.currentTimeMillis(); lockedByUser = false; } }
LOG.info("Error removing session resource dir " + resourceDir, e); } finally { detachSession();
@Before public void setUp() throws IOException { /* Only called to create session directories used by the Context class */ SessionState.start(conf); SessionState.detachSession(); context = new Context(conf); }
SessionState.detachSession();
LOG.info("Error removing session resource dir " + resourceDir, e); } finally { detachSession();
SessionState.detachSession();
/** * 1. We'll remove the ThreadLocal SessionState as this thread might now serve * other requests. * 2. We'll cache the ThreadLocal RawStore object for this background thread for an orderly cleanup * when this thread is garbage collected later. * @see org.apache.hive.service.server.ThreadWithGarbageCleanup#finalize() */ protected synchronized void release(boolean userAccess) { SessionState.detachSession(); if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } if (userAccess) { lastAccessTime = System.currentTimeMillis(); } if (opHandleSet.isEmpty()) { lastIdleTime = System.currentTimeMillis(); } else { lastIdleTime = 0; } }
/** * 1. We'll remove the ThreadLocal SessionState as this thread might now serve * other requests. * 2. We'll cache the ThreadLocal RawStore object for this background thread for an orderly cleanup * when this thread is garbage collected later. * @see org.apache.hive.service.server.ThreadWithGarbageCleanup#finalize() */ protected synchronized void release(boolean userAccess) { SessionState.detachSession(); if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } if (userAccess) { lastAccessTime = System.currentTimeMillis(); } if (opHandleSet.isEmpty()) { lastIdleTime = System.currentTimeMillis(); } else { lastIdleTime = 0; } }
/** * 1. We'll remove the ThreadLocal SessionState as this thread might now serve * other requests. * 2. We'll cache the ThreadLocal RawStore object for this background thread for an orderly cleanup * when this thread is garbage collected later. * @see org.apache.hive.service.server.ThreadWithGarbageCleanup#finalize() */ protected synchronized void release(boolean userAccess) { SessionState.detachSession(); if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } if (userAccess) { lastAccessTime = System.currentTimeMillis(); } if (opHandleSet.isEmpty()) { lastIdleTime = System.currentTimeMillis(); } else { lastIdleTime = 0; } }
/** * 1. We'll remove the ThreadLocal SessionState as this thread might now serve * other requests. * 2. We'll cache the ThreadLocal RawStore object for this background thread for an orderly cleanup * when this thread is garbage collected later. * @see org.apache.hive.service.server.ThreadWithGarbageCleanup#finalize() */ protected synchronized void release(boolean userAccess) { SessionState.detachSession(); if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } if (userAccess) { lastAccessTime = System.currentTimeMillis(); } if (opHandleSet.isEmpty()) { lastIdleTime = System.currentTimeMillis(); } else { lastIdleTime = 0; } }
private synchronized void releaseBeforeOpLock(boolean userAccess) { if (sessionState != null) { // can be null in-case of junit tests. skip reset. // reset thread name at release time. sessionState.resetThreadName(); } SessionState.detachSession(); if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } if (userAccess) { lastAccessTime = System.currentTimeMillis(); lockedByUser = false; } }
} finally { LensServerTestUtil.dropHiveTable("test_native_table_command"); SessionState.detachSession();
dropDatabase(DB, mediaType); setCurrentDatabase(prevDb, mediaType); SessionState.detachSession();
LOG.info("Error removing session resource dir " + resourceDir, e); } finally { detachSession();