BatcherImpl implements Batcher, BatcherMXBean { public <E extends BatchExecutor<E, T>, T extends BatchCommand<E, T>> void submitBatchCommand(BatchCommand<E, T> cmd) { if (queue.state != State.STARTED) throw new IllegalStateException("Batcher is shutting down"); queue.submitBatchCommand(cmd); } BatcherImpl(int numThreads); @SuppressWarnings("rawtypes") void setBatchRunner(BatchRunner batchRunner); synchronized int getNumThreads(); synchronized void setNumThreads(int numThreads); void setStatisticsCollector(RuntimeStatisticsCollector statisticsCollector); void submitBatchCommand(BatchCommand<E, T> cmd); void startup(); void shutdown(); @Override String getDescription(); int getQueueSize();  }
@SuppressWarnings("rawtypes") @Test public final void testSubmitBatchCommand() throws InterruptedException { BatcherImpl batcher = new BatcherImpl(2); batcher.setBatchRunner(new RetryingTxnBatchRunner()); batcher.startup(); try { for (int i = 0; i < 100; i++) { batcher.submitBatchCommand(new TestBatchCommand("Test#" + i)); } Thread.sleep(5000); } finally { batcher.shutdown(); } }