protected void shutdown()

in src/java/org/apache/fulcrum/yaafi/cli/Main.java [595:639]


    protected void shutdown()
    {
        if( !this.isInitialized())
        {
            return;
        }

        this.getLogger().debug( "Terminating " + this.getClass().getName() );

        try
        {
            // wait for the shutdown thread

            if( this.shutdownThread != null )
            {
                try
                {
                    this.getLogger().debug( "Waiting for shutdown handler thread to terminate" );
                    this.shutdownThread.join(JOIN_TIME);
                    this.shutdownThread = null;
                    this.getLogger().debug( "Shutdown handler thread is terminated" );
                }
                catch (InterruptedException e)
                {
                    // nothing to do
                }
            }

            // dispose the service container

            if( this.getServiceContainer() != null )
            {
                this.getServiceContainer().dispose();
                this.container = null;
            }

            this.setInitialized(false);
        }

        catch (Exception e)
        {
            String msg = "Failed to terminate " + this.getClass().getName();
            this.getLogger().error(msg,e);
        }
    }