/** {@inheritDoc} */ @Override public void flush(HadoopIgfsStreamDelegate delegate) throws IOException { try { IgfsOutputStream stream = delegate.target(); stream.flush(); } catch (IllegalStateException | IOException e) { HadoopIgfsStreamEventListener lsnr = lsnrs.get(delegate); if (lsnr != null) lsnr.onError(e.getMessage()); if (e instanceof IllegalStateException) throw new IOException("Failed to flush data to IGFS stream because Grid is stopping.", e); else throw e; } }
@Override public Void call() throws Exception { IgniteFileSystem igfs = attacker.fileSystem(IGFS_NAME); try (IgfsOutputStream out = igfs.create(path, true)) { writeStartLatch.await(); out.write(new byte[1024]); out.flush(); } return null; } });
/** * Writes data to the file of the specified index and closes the output stream. * * @param igfs0 IGFS. * @param ios The output stream * @param fileIdx Th eindex of the file. * @throws IOException On error. */ void writeChunks0(IgfsEx igfs0, IgfsOutputStream ios, int fileIdx) throws IOException { try { byte[] data = createChunk(fileSize, fileIdx); writeFileChunks(ios, data); } finally { ios.flush(); U.closeQuiet(ios); awaitFileClose(igfs0, filePath(fileIdx)); } }
out.flush();