protected void writeBuffer() throws IOException { if (_fileCursor < 0 || _bufferSize <= 0) return; // the old file will be overwritten Path path = getFilePath(_fileCursor); // System.out.println( "write buffer: "+path.toString() ); LocalFileUtils.writeBlockSequenceToLocal(path.toString(), _buffer, _bufferSize); }
protected void loadBuffer() throws IOException { _bufferSize = 0; if (_bufferMap != null) _bufferMap.clear(); Path path = getFilePath(_fileCursor); if (_fs.exists(path)) { // System.out.println( "load buffer: "+path.toString() ); _bufferSize = LocalFileUtils.readBlockSequenceFromLocal(path.toString(), _buffer, _bufferMap); } }
@Override public void map( LongWritable key, Text value, OutputCollector<Writable, Writable> out, Reporter reporter) throws IOException { try { String task = value.toString(); LOG.info("Running cleanup task: " + task + " (" + _dir + ") ... "); int count = LocalFileUtils.cleanupRcWorkingDirectory(_dir); LOG.info("Done - deleted " + count + " files."); } catch (Exception ex) { // throw IO exception to adhere to API specification throw new IOException("Failed to execute cleanup task.", ex); } }