public void stop() {
        /*
         * Sets the shutdown flag. Future sends to the batcher are not accepted.
         * The processors wait for the current messages in the queue and with
         * the processor or collector to complete
         */
        isShutDown = true;
        
        int waitTimeinMillis = CONFIGURATION.getBatcherWaitTimeBeforeShutdown(this.name);
        long timeToWait = waitTimeinMillis + System.currentTimeMillis();
        while ((queue.size() > 0 || batch.size() > 0)
                && (System.currentTimeMillis() < timeToWait)) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                break;
            }
        }
        try {
            shouldCollectorShutdown = true;
            processor.shutdownNow();
            /*
             * processor.awaitTermination(10000, TimeUnit.SECONDS); if
             * (!processor.isShutdown()) { processor.shutdownNow(); }
             */
        } catch (Throwable e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
public void stop ( ) { isShutDown = true ; int waitTimeinMillis = CONFIGURATION . getBatcherWaitTimeBeforeShutdown ( this . name ) ; long timeToWait = waitTimeinMillis + System . currentTimeMillis ( ) ; while ( ( queue . size ( ) > 0 || batch . size ( ) > 0 ) && ( System . currentTimeMillis ( ) < timeToWait ) ) { try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { break ; } } try { shouldCollectorShutdown = true ; processor . shutdownNow ( ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } }
Stops the batcher. The Batcher has to wait for the other processes like
the Collector and the Executor to complete. It waits until it is notified
that the other processes have completed gracefully. The collector waits
until there are no more messages in the queue(tries 3 times waiting for
0.5 seconds each) and then shuts down gracefully.