protected PLZFOutputStream(final OutputStream outputStream, final int bufferSize, int nThreads) { super(outputStream); _outputStreamClosed = false; compressExecutor = new ThreadPoolExecutor(nThreads, nThreads, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); // unbounded ((ThreadPoolExecutor)compressExecutor).allowCoreThreadTimeOut(true); writeExecutor = Executors.newSingleThreadExecutor(); // unbounded blockManager = new BlockManager(nThreads * 2, bufferSize); // this is where the bounds will be enforced! _outputBuffer = blockManager.getBlockFromPool(); }
protected PLZFOutputStream(final OutputStream outputStream, final int bufferSize, int nThreads) { super(outputStream); _outputStreamClosed = false; compressExecutor = new ThreadPoolExecutor(nThreads, nThreads, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); // unbounded ((ThreadPoolExecutor)compressExecutor).allowCoreThreadTimeOut(true); writeExecutor = Executors.newSingleThreadExecutor(); // unbounded blockManager = new BlockManager(nThreads * 2, bufferSize); // this is where the bounds will be enforced! _outputBuffer = blockManager.getBlockFromPool(); }
protected PLZFOutputStream(final OutputStream outputStream, final int bufferSize, int nThreads) { super(outputStream); _outputStreamClosed = false; compressExecutor = new ThreadPoolExecutor(nThreads, nThreads, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); // unbounded ((ThreadPoolExecutor)compressExecutor).allowCoreThreadTimeOut(true); writeExecutor = Executors.newSingleThreadExecutor(); // unbounded blockManager = new BlockManager(nThreads * 2, bufferSize); // this is where the bounds will be enforced! _outputBuffer = blockManager.getBlockFromPool(); }
/** * Compress and write the current block to the OutputStream */ protected void writeCompressedBlock() throws IOException { if (_position == 0) { return; } Future<LZFChunk> lzfFuture = compressExecutor.submit(new CompressTask(_outputBuffer, 0, _position, blockManager)); writeExecutor.execute(new WriteTask(out, lzfFuture, this)); _outputBuffer = blockManager.getBlockFromPool(); _position = 0; checkWriteException(); }
/** * Compress and write the current block to the OutputStream */ protected void writeCompressedBlock() throws IOException { if (_position == 0) { return; } Future<LZFChunk> lzfFuture = compressExecutor.submit(new CompressTask(_outputBuffer, 0, _position, blockManager)); writeExecutor.execute(new WriteTask(out, lzfFuture, this)); _outputBuffer = blockManager.getBlockFromPool(); _position = 0; checkWriteException(); }
/** * Compress and write the current block to the OutputStream */ protected void writeCompressedBlock() throws IOException { if (_position == 0) { return; } Future<LZFChunk> lzfFuture = compressExecutor.submit(new CompressTask(_outputBuffer, 0, _position, blockManager)); writeExecutor.execute(new WriteTask(out, lzfFuture, this)); _outputBuffer = blockManager.getBlockFromPool(); _position = 0; checkWriteException(); }