@Override protected void implCloseChannel() throws IOException { FileUtil.cleanup(null, channel, inputStream); } }
@Override protected void implCloseChannel() throws IOException { FileUtil.cleanup(null, channel, inputStream); } }
/** * Close the <code>OutputHandler</code>. * @throws IOException */ public void close() throws IOException { if(!alreadyClosed) { FileUtil.cleanup(LOG, istream, in); in = null; istream = null; alreadyClosed = true; if (this.buf.refCnt() > 0) { this.buf.release(); } } } }
/** * Close the <code>OutputHandler</code>. * @throws IOException */ public void close() throws IOException { if(!alreadyClosed) { FileUtil.cleanup(LOG, istream, in); in = null; istream = null; alreadyClosed = true; if (this.buf.refCnt() > 0) { this.buf.release(); } } } }
private boolean createLockFile() throws IOException { boolean result = false; FSDataOutputStream lockOutput = null; Path lockFile = new Path(activePath, HAConstants.ACTIVE_LOCK_FILE); try { lockOutput = fs.create(lockFile, false); lockOutput.close(); fs.deleteOnExit(lockFile); result = true; } catch (FileAlreadyExistsException e) { LOG.info(String.format("Lock file already exists at (%s)", lockFile.toString())); result = false; } catch (Exception e) { throw new IOException("Lock file creation is failed - " + e.getMessage()); } finally { FileUtil.cleanup(LOG, lockOutput); } return result; }
private void createMasterFile(Path path, StringBuilder sb) throws IOException { FSDataOutputStream out = null; try { out = fs.create(path, false); out.writeUTF(sb.toString()); out.close(); fs.deleteOnExit(path); } catch (Exception e) { throw new IOException("File creation is failed - " + e.getMessage()); } finally { FileUtil.cleanup(LOG, out); } }
private void createMasterFile(Path path, StringBuilder sb) throws IOException { FSDataOutputStream out = null; try { out = fs.create(path, false); out.writeUTF(sb.toString()); out.close(); fs.deleteOnExit(path); } catch (Exception e) { throw new IOException("File creation is failed - " + e.getMessage()); } finally { FileUtil.cleanup(LOG, out); } }
private boolean createLockFile() throws IOException { boolean result = false; FSDataOutputStream lockOutput = null; Path lockFile = new Path(activePath, HAConstants.ACTIVE_LOCK_FILE); try { lockOutput = fs.create(lockFile, false); lockOutput.close(); fs.deleteOnExit(lockFile); result = true; } catch (FileAlreadyExistsException e) { LOG.info(String.format("Lock file already exists at (%s)", lockFile.toString())); result = false; } catch (Exception e) { throw new IOException("Lock file creation is failed - " + e.getMessage()); } finally { FileUtil.cleanup(LOG, lockOutput); } return result; }
@Override public void shutdown() { FileUtil.cleanup(LOG, stdin, stdout, stderr, inputHandler, outputHandler); stdin = null; stdout = stderr = null; inputHandler = null; outputHandler = null; try { int exitCode = process.waitFor(); if (systemConf.get(TajoConstants.TEST_KEY, Boolean.FALSE.toString()).equalsIgnoreCase(Boolean.TRUE.toString())) { LOG.warn("Process exit code: " + exitCode); } else { if (LOG.isDebugEnabled()) { LOG.debug("Process exit code: " + exitCode); } } } catch (InterruptedException e) { LOG.warn(e.getMessage(), e); } if (LOG.isDebugEnabled()) { LOG.debug("PythonScriptExecutor shuts down"); } }
@Override public void shutdown() { FileUtil.cleanup(LOG, stdin, stdout, stderr, inputHandler, outputHandler); stdin = null; stdout = stderr = null; inputHandler = null; outputHandler = null; try { int exitCode = process.waitFor(); if (systemConf.get(TajoConstants.TEST_KEY, Boolean.FALSE.toString()).equalsIgnoreCase(Boolean.TRUE.toString())) { LOG.warn("Process exit code: " + exitCode); } else { if (LOG.isDebugEnabled()) { LOG.debug("Process exit code: " + exitCode); } } } catch (InterruptedException e) { LOG.warn(e.getMessage(), e); } if (LOG.isDebugEnabled()) { LOG.debug("PythonScriptExecutor shuts down"); } }