sync(); } else { writeFileHeader();
/** * Writes vector to the cluster directory. */ private void writeVectorToCluster(Writer writer, WeightedVectorWritable point) throws IOException { writer.append(new LongWritable(uniqueVectorId++), new VectorWritable(point.getVector())); writer.sync(); }
/** * Writes vector to the cluster directory. */ private void writeVectorToCluster(Writer writer, WeightedVectorWritable point) throws IOException { writer.append(new LongWritable(uniqueVectorId++), new VectorWritable(point.getVector())); writer.sync(); }
/** * Writes records from RawKeyValueIterator into a file represented by the * passed writer * @param records the RawKeyValueIterator * @param writer the Writer created earlier * @throws IOException */ public void writeFile(RawKeyValueIterator records, Writer writer) throws IOException { while(records.next()) { writer.appendRaw(records.getKey().getData(), 0, records.getKey().getLength(), records.getValue()); } writer.sync(); }
@Override public long append(HdfsOutputStream hdfsostr, Object key, Object value, TypeConverter typeConverter) { try { Holder<Integer> keySize = new Holder<>(); Writable keyWritable = getWritable(key, typeConverter, keySize); Holder<Integer> valueSize = new Holder<>(); Writable valueWritable = getWritable(value, typeConverter, valueSize); Writer writer = (SequenceFile.Writer) hdfsostr.getOut(); writer.append(keyWritable, valueWritable); writer.sync(); return keySize.value + valueSize.value; } catch (Exception ex) { throw new RuntimeCamelException(ex); } }
@Override public void sync() throws IOException { seqFileWriter.sync(); } }
/** * create a sync point */ public void sync() throws IOException { innerWriter.sync(); }
/** * Writes vector to the cluster directory. */ private void writeVectorToCluster(Writer writer, WeightedVectorWritable point) throws IOException { writer.append(new LongWritable(uniqueVectorId++), new VectorWritable(point.getVector())); writer.sync(); }
synchronized void checkAndWriteSync() throws IOException { if (sync != null && out.getPos() >= lastSyncPos+SYNC_INTERVAL) { // time to emit sync sync(); } }
/** * create a sync point */ public void sync() throws IOException { innerWriter.sync(); }
synchronized void checkAndWriteSync() throws IOException { if (sync != null && out.getPos() >= lastSyncPos+SYNC_INTERVAL) { // time to emit sync sync(); } }
synchronized void checkAndWriteSync() throws IOException { if (sync != null && out.getPos() >= lastSyncPos+SYNC_INTERVAL) { // time to emit sync sync(); } }
synchronized void checkAndWriteSync() throws IOException { if (sync != null && out.getPos() >= lastSyncPos+SYNC_INTERVAL) { // time to emit sync sync(); } }
@Override public void sync() throws IOException { writer.sync(); hflushOrSync(outStream); }
synchronized void checkAndWriteSync() throws IOException { if (sync != null && out.getPos() >= lastSyncPos+SYNC_INTERVAL) { // time to emit sync sync(); } }
synchronized void checkAndWriteSync() throws IOException { if (sync != null && out.getPos() >= lastSyncPos+SYNC_INTERVAL) { // time to emit sync sync(); } }
/** Compress and flush contents to dfs */ @Override public synchronized void sync() throws IOException { if (noBufferedRecords > 0) { super.sync(); // No. of records WritableUtils.writeVInt(out, noBufferedRecords); // Write 'keys' and lengths writeBuffer(keyLenBuffer); writeBuffer(keyBuffer); // Write 'values' and lengths writeBuffer(valLenBuffer); writeBuffer(valBuffer); // Flush the file-stream out.flush(); // Reset internal states keyLenBuffer.reset(); keyBuffer.reset(); valLenBuffer.reset(); valBuffer.reset(); noBufferedRecords = 0; } }
/** * Writes records from RawKeyValueIterator into a file represented by the * passed writer * @param records the RawKeyValueIterator * @param writer the Writer created earlier * @throws IOException */ public void writeFile(RawKeyValueIterator records, Writer writer) throws IOException { while(records.next()) { writer.appendRaw(records.getKey().getData(), 0, records.getKey().getLength(), records.getValue()); } writer.sync(); }
synchronized void checkAndWriteSync() throws IOException { if (sync != null && out.getPos() >= lastSyncPos+this.syncInterval) { // time to emit sync sync(); } }
@Override public void sync() throws IOException { writer.sync(); hflushOrSync(outStream); }