Adobe COLDFUSION 9 Manual page 1334

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
public void stop()
{
// Set the status variable to indicate that the server is stopping.
status = STOPPING;
// The listening variable is used as a switch to stop listener activity.
listening=false;
// Close the listener thread sockets.
Enumeration e = socketRegistry.elements();
while (e.hasMoreElements()) {
try
{
((SocketServerThread)e.nextElement()).socket.close();
}
catch (IOException e1)
{
// We don't care if a close failed.
//log.error(e1);
}
}
// Close and release the serverSocket instance that gets requests from the
// network.
if (serverSocket != null) {
try
{
serverSocket.close();
}
catch (IOException e1)
{
}
//Release the serverSocket.
serverSocket = null;
}
// Shutdown succeeded; set the status variable.
status = STOPPED;
}
The restart method
In most cases, you implement the
but you could be able to optimize this process for some services. The following code shows the SocketGateway class
method:
restart
public void restart() {
stop();
start();
}
Responding to incoming messages
One or more listener threads respond to incoming messages (events). The threads must include code to dispatch the
messages to ColdFusion event gateway services, as follows:
1
Create a CFEvent instance.
Create a Map instance that contains the message and any other event gateway-specific information, and pass it to
2
the CFEvent
method.
setData
method by calling the
restart
Last updated 8/5/2010
method and the
stop
start
1329
method consecutively,

Advertisement

Table of Contents
loading

Table of Contents