@Override public final void close() throws IOException { itemInfoOutput.close(); } }
@Override public final int put(final List<T> items) throws IOException { return put(items, 0, items.size()); }
private static <I extends Item> List<I> getItems(final Input<I> itemInput, final int n) throws InterruptRunException, IOException { final List<I> items = new ArrayList<>(n); // prepare the items buffer try { itemInput.get(items, n); // get the items from the input } catch (final EOFException e) { return null; } return items; }
@Override public final boolean put(final O ioResult) throws IOException { if (ioResult == null) { // poison close(); return true; } return itemInfoOutput.put(ioResult.item().toString()); }
if(n > 0) { if(n == 1) { if(output.put(deferredItems.get(0))) { deferredItems.clear(); n = output.put(deferredItems, 0, Math.min(n, batchSize)); deferredItems.removeRange(0, n); final List<T> items = input.getAll(); if(items != null) { n = items.size(); if(n == 1) { final T item = items.get(0); if(!output.put(item)) { deferredItems.add(item); final int m = output.put(items, 0, Math.min(n, batchSize)); if(m < n) {
srcBuff = (T[]) o; srcBuffPos = 0; return get(dstBuff, dstCountLimit); } else { // there are single item has been got from the stream if(dstCountLimit > 0) {
@Override protected final void doClose() throws InterruptRunException, IOException { recycleQueue.clear(); // the item input may be instantiated by the load generator builder which has no reference to it // so the load // generator builder should close it if (itemInput != null) { try { inputLock.tryLock(Fiber.WARN_DURATION_LIMIT_NANOS, TimeUnit.NANOSECONDS); itemInput.close(); } catch (final InterruptedException e) { throw new InterruptRunException(e); } catch (final Exception e) { LogUtil.exception(Level.WARN, e, "{}: failed to close the item input", toString()); } } // ops builder is instantiated by the load generator builder which forgets it so the load // generator should // close it opsBuilder.close(); }
@Override public final boolean put(final O ioResult) throws IOException { if(ioResult == null) { // poison close(); return true; } return itemInfoOutput.put(ioResult.getItem().toString()); }
@Override public final void close() throws IOException { itemInfoOutput.close(); } }
try { while (n < countLimit) { m = itemInput.get(itemBuff, countLimit - n); if (m < 0) { Loggers.MSG.info("Loaded {} items, limit reached", n);
@Override @SuppressWarnings("unchecked") public final T get() throws IOException { if(srcBuff != null && srcBuffPos < srcBuff.length) { return srcBuff[srcBuffPos ++]; } else { try { final Object o = itemsSrc.readUnshared(); if(o instanceof Object[]) { srcBuff = (T[]) o; srcBuffPos = 0; return get(); } else { return (T) o; } } catch(final ClassNotFoundException | ClassCastException e) { throw new InvalidClassException(e.getMessage()); } } }
@Override public final int put(final List<O> ioResults) throws IOException { final List<String> itemsInfo = new ArrayList<>(ioResults.size()); for (final O nextIoResult : ioResults) { if (nextIoResult == null) { // poison try { return itemInfoOutput.put(itemsInfo); } finally { close(); } } itemsInfo.add(nextIoResult.item().toString()); } return itemInfoOutput.put(itemsInfo); }
@Override public final int put(final List<O> ioResults) throws IOException { final List<String> itemsInfo = new ArrayList<>(ioResults.size()); for(final O nextIoResult : ioResults) { if(nextIoResult == null) { // poison try { return itemInfoOutput.put(itemsInfo); } finally { close(); } } itemsInfo.add(nextIoResult.getItem().toString()); } return itemInfoOutput.put(itemsInfo); }
@Override public final int put(final List<O> ioResults, final int from, final int to) throws IOException { final int n = to - from; final List<String> itemsInfo = new ArrayList<>(n); O ioResult; for (int i = from; i < to; i++) { ioResult = ioResults.get(i); if (ioResult == null) { // poison try { return itemInfoOutput.put(itemsInfo, 0, i); } finally { close(); } } itemsInfo.add(ioResult.item().toString()); } return itemInfoOutput.put(itemsInfo, 0, n); }
@Override public final int put(final List<O> ioResults, final int from, final int to) throws IOException { final int n = to - from; final List<String> itemsInfo = new ArrayList<>(n); O ioResult; for(int i = from; i < to; i ++) { ioResult = ioResults.get(i); if(ioResult == null) { // poison try { return itemInfoOutput.put(itemsInfo, 0, i); } finally { close(); } } itemsInfo.add(ioResult.getItem().toString()); } return itemInfoOutput.put(itemsInfo, 0, n); }
for (final O latestOpResult : latestSuccOpResultByItem.values()) { try { if (!opsResultsOutput.put(latestOpResult)) { Loggers.ERR.debug( "{}: item info output fails to ingest, blocking the closing method", id); while (!opsResultsOutput.put(latestOpResult)) { Thread.sleep(1); opsResultsOutput.put((O) null); Loggers.MSG.debug("{}: poisoned the items output", id); } catch (final IOException e) {