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 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(); }
final List<T> items = input.getAll(); if(items != null) { n = items.size();
} finally { try { itemInput.close(); } catch (final IOException ignored) {
n = itemInput.get(itemsBuff, batchSize); } catch (final EOFException e) { break;
try { while (n < countLimit) { m = itemInput.get(itemBuff, countLimit - n); if (m < 0) { Loggers.MSG.info("Loaded {} items, limit reached", n);
input.get(itemsBuff, capacity - itemsBuff.size());