User Guide
Gateway interface 975
stop
Description
Stops a gateway if it is running.
Category
Event Gateway Development
Syntax
public void stop()
See also
restart
, start, “The stop method” in Chapter 45, “Creating Custom Event Gateways” in
ColdFusion MX Developer’s Guide
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 MX 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 MX 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;
}