private void resetResultReader() { if (resultReader != null) { ServiceUtils.cleanup(LOG, resultReader); resultReader = null; } }
private void tearDownSessionIO() { ServiceUtils.cleanup(LOG, parentSession.getSessionState().out, parentSession.getSessionState().err); }
@Override public void Authenticate(String user, String password) throws AuthenticationException { DirSearch search = null; try { search = createDirSearch(user, password); applyFilter(search, user); } finally { ServiceUtils.cleanup(LOG, search); } }
private void setupSessionIO(SessionState sessionState) { try { LOG.info("Putting temp output to file " + sessionState.getTmpOutputFile().toString() + " and error output to file " + sessionState.getTmpErrOutputFile().toString()); sessionState.in = null; // hive server's session input stream is not used // open a per-session file in auto-flush mode for writing temp results and tmp error output sessionState.out = new SessionStream( new FileOutputStream(sessionState.getTmpOutputFile()), true, StandardCharsets.UTF_8.name()); sessionState.err = new SessionStream( new FileOutputStream(sessionState.getTmpErrOutputFile()), true, StandardCharsets.UTF_8.name()); } catch (IOException e) { LOG.error("Error in creating temp output file ", e); // Close file streams to avoid resource leaking ServiceUtils.cleanup(LOG, parentSession.getSessionState().out, parentSession.getSessionState().err); try { sessionState.in = null; sessionState.out = new SessionStream(System.out, true, StandardCharsets.UTF_8.name()); sessionState.err = new SessionStream(System.err, true, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException ee) { LOG.error("Error creating PrintStream", e); ee.printStackTrace(); sessionState.out = null; sessionState.err = null; } } }
private void resetResultReader() { if (resultReader != null) { ServiceUtils.cleanup(LOG, resultReader); resultReader = null; } }
private void tearDownSessionIO() { if (closeSessionStreams) { ServiceUtils.cleanup(LOG, parentSession.getSessionState().out, parentSession.getSessionState().err); } }
@Override public void Authenticate(String user, String password) throws AuthenticationException { DirSearch search = null; try { search = createDirSearch(user, password); applyFilter(search, user); } finally { ServiceUtils.cleanup(LOG, search); } }
private void setupSessionIO(SessionState sessionState) { try { LOG.info("Putting temp output to file " + sessionState.getTmpOutputFile().toString() + " and error output to file " + sessionState.getTmpErrOutputFile().toString()); sessionState.in = null; // hive server's session input stream is not used // open a per-session file in auto-flush mode for writing temp results and tmp error output sessionState.out = new PrintStream(new FileOutputStream(sessionState.getTmpOutputFile()), true, CharEncoding.UTF_8); sessionState.err = new PrintStream(new FileOutputStream(sessionState.getTmpErrOutputFile()), true,CharEncoding.UTF_8); } catch (IOException e) { LOG.error("Error in creating temp output file ", e); // Close file streams to avoid resource leaking ServiceUtils.cleanup(LOG, parentSession.getSessionState().out, parentSession.getSessionState().err); closeSessionStreams = false; try { sessionState.in = null; sessionState.out = new PrintStream(System.out, true, CharEncoding.UTF_8); sessionState.err = new PrintStream(System.err, true, CharEncoding.UTF_8); } catch (UnsupportedEncodingException ee) { LOG.error("Error creating PrintStream", e); ee.printStackTrace(); sessionState.out = null; sessionState.err = null; } } }