stop

Description

Stops a gateway if it is running.

Category

Event Gateway Development

Syntax

public void stop()

See also

restart, start, Starting, stopping, and restarting the event gateway in the Developing ColdFusion Applications

Usage

Stops a gateway by performing any required clean-up operations. This method stops any listener thread or threads that monitor the gateway’s event source and releases any other resources. The ColdFusion Administrator calls this function when it stops a gateway instance.

This method should update the status information that is returned by the getStatus method to indicate when the gateway is stopping and when the gateway is stopped.

Example

The following example is the ColdFusion SocketGateway class stop method:

public void stop() 
    { 
        status = STOPPING; 
        listening=false; 
        Enumeration e = socketRegistry.elements(); 
        while (e.hasMoreElements()) { 
            try  
            { 
                ((SocketServerThread)e.nextElement()).socket.close(); 
            } 
            catch (IOException e1) { 
                e1.printStackTrace(); 
            } 
        } 
        if (serverSocket != null) { 
            try 
            { 
                serverSocket.close(); 
            } 
            catch (IOException e1) { 
            } 
            serverSocket = null; 
        } 
        status = STOPPED; 
    }