public void stop()

in spring-taskqueue/src/main/java/org/apache/archiva/components/taskqueue/execution/ThreadedTaskQueueExecutor.java [322:357]


    public void stop( )
    {
        executorRunnable.shutdown( );

        int maxSleep = 10 * 1000; // 10 seconds

        int interval = 1000;

        long endTime = System.currentTimeMillis( ) + maxSleep;

        while ( !executorRunnable.isDone( ) && executorRunnable.isAlive( ) )
        {
            if ( System.currentTimeMillis( ) > endTime )
            {
                logger.warn( "Timeout waiting for executor thread '{}' to stop, aborting", name );
                break;
            }

            logger.info( "Waiting until task executor '{}' is idling...", name );

            try
            {
                synchronized (executorRunnable)
                {
                    executorRunnable.wait( interval );
                }
            }
            catch ( InterruptedException ex )
            {
                // ignore
            }

            // notify again, just in case.
            executorRunnable.shutdown( );
        }
    }