@Test public void manageTransactionsToBeFixed_shouldRespectTheInputGlobalLimit() { AtomicInteger limit = new AtomicInteger(4); AtomicInteger transactionCount = new AtomicInteger(); IOpenBitSet transactions = new SolrOpenBitSetAdapter(); range(1, 7).forEach(transactions::set); Consumer<Long> counter = tx -> transactionCount.incrementAndGet(); admin.manageTransactionsToBeFixed(transactions, tx -> 0, counter, limit); assertEquals(-1, limit.get()); assertEquals(4, transactionCount.get()); }
NamedList<Object> manageTransactionsToBeFixed( IOpenBitSet transactions, LongToIntFunction nodesCounter, Consumer<Long> scheduler, AtomicInteger limit) { final NamedList<Object> transactionsList = new SimpleOrderedMap<>(); long txid = -1; while ((txid = transactions.nextSetBit(txid + 1)) != -1 && limit.decrementAndGet() >= 0) { transactionsList.add(String.valueOf(txid), nodesCounter.applyAsInt(txid)); scheduler.accept(txid); } return transactionsList; }
AlfrescoCoreAdminHandler extends CoreAdminHandler { NamedList<Object> manageTransactionsToBeFixed( IOpenBitSet transactions, LongToIntFunction nodesCounter, Consumer<Long> scheduler, AtomicInteger limit) { final NamedList<Object> transactionsList = new SimpleOrderedMap<>(); long txid = -1; while ((txid = transactions.nextSetBit(txid + 1)) != -1 && limit.decrementAndGet() >= 0) { transactionsList.add(String.valueOf(txid), nodesCounter.applyAsInt(txid)); scheduler.accept(txid); } return transactionsList; } }
AlfrescoCoreAdminHandler extends CoreAdminHandler { NamedList<Object> manageTransactionsToBeFixed( IOpenBitSet transactions, LongToIntFunction nodesCounter, Consumer<Long> scheduler, AtomicInteger limit) { final NamedList<Object> transactionsList = new SimpleOrderedMap<>(); long txid = -1; while ((txid = transactions.nextSetBit(txid + 1)) != -1 && limit.decrementAndGet() >= 0) { transactionsList.add(String.valueOf(txid), nodesCounter.applyAsInt(txid)); scheduler.accept(txid); } return transactionsList; } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); }
AlfrescoCoreAdminHandler extends CoreAdminHandler { NamedList<Object> manageTransactionsToBeFixed( IOpenBitSet transactions, LongToIntFunction nodesCounter, Consumer<Long> scheduler, AtomicInteger limit) { final NamedList<Object> transactionsList = new SimpleOrderedMap<>(); long txid = -1; while ((txid = transactions.nextSetBit(txid + 1)) != -1 && limit.decrementAndGet() >= 0) { transactionsList.add(String.valueOf(txid), nodesCounter.applyAsInt(txid)); scheduler.accept(txid); } return transactionsList; } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); @Override void shutdown(); ConcurrentHashMap<String, InformationServer> getInformationServers(); TrackerRegistry getTrackerRegistry(); SolrTrackerScheduler getScheduler(); }
AlfrescoCoreAdminHandler extends CoreAdminHandler { NamedList<Object> manageTransactionsToBeFixed( IOpenBitSet transactions, LongToIntFunction nodesCounter, Consumer<Long> scheduler, AtomicInteger limit) { final NamedList<Object> transactionsList = new SimpleOrderedMap<>(); long txid = -1; while ((txid = transactions.nextSetBit(txid + 1)) != -1 && limit.decrementAndGet() >= 0) { transactionsList.add(String.valueOf(txid), nodesCounter.applyAsInt(txid)); scheduler.accept(txid); } return transactionsList; } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); @Override void shutdown(); ConcurrentHashMap<String, InformationServer> getInformationServers(); TrackerRegistry getTrackerRegistry(); SolrTrackerScheduler getScheduler(); static final String ALFRESCO_DEFAULTS; }