You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Janek Bogucki <ja...@yahoo.co.uk> on 2002/02/04 01:49:31 UTC

Should StandardCluster.stop() throw a LifecycleException?

Hi,

Should StandardCluster.stop() throw a LifecycleException?

StandardCluster.stop () does not throw a LifecycleException when stop () is invoked on an instance
which has not been started. A message is logged but then the code proceeds and a
NullPointerException could result.

(I don't understand this class well enough to say whether this is really a bug or not, I could
well be missing something here...)

-Janek

    /**
     * Gracefully terminate the active use of the public methods of this
     * component.  This method should be the last one called on a given
     * instance of this component.
     *
     * @exception IllegalStateException if this component has not been started
     * @exception LifecycleException if this component detects a fatal error
     *  that needs to be reported
     */
    public void stop() throws LifecycleException {
        // Validate and update our current component state
        if (!started)
            log(sm.getString("standardCluster.notStarted"));

        try {
            multicastSocket.leaveGroup(multicastAddress);
            multicastSocket = null;
        } catch (IOException e) {
            log(sm.getString("standardCluster.leaveException",
                             multicastAddress));
        }

        if (debug > 1)
            log(sm.getString("standardCluster.leaveGroup",
                             multicastAddress));

        lifecycle.fireLifecycleEvent(STOP_EVENT, null);
        started = false;

        // Stop the background reaper thread
        threadStop();
    }


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>