All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.webconcepts.net.ServiceThread

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----COM.webconcepts.net.ServiceThread

public class ServiceThread
extends Thread
The MultiThreadServer framework allows you to develop the client-handling code separately from the core server systems. Clients are handled by objects that extend this class. ServiceThread negotiates the initial connection with the client, and then passes control to the service() method, which is a no-op in this class.

See Also:
MultiThreadServer

Constructor Index

 o ServiceThread()

Method Index

 o getServer()
gets the host server for this thread
 o handleServiceException(Exception)
This method is called in case there are any exceptions while the thread is running
 o run()
run() loops continuously until the thread dies or is shut down.
 o service(InputStream, OutputStream)
This empty method is called whenever a client connects to this service thread; objects that implement a particular network protocol should define this method to communicate with the client via the streams.
 o setServer(MultiThreadServer)
sets a reference back to the host server object

Constructors

 o ServiceThread
 public ServiceThread()

Methods

 o setServer
 public void setServer(MultiThreadServer server)
sets a reference back to the host server object

Parameters:
server - the host server
 o getServer
 public MultiThreadServer getServer()
gets the host server for this thread

Returns:
the host server reference
 o run
 public void run()
run() loops continuously until the thread dies or is shut down. It accept()s clients as they make requests and dispatches the service() method to handle them

Overrides:
run in class Thread
 o service
 public void service(InputStream in,
                     OutputStream out) throws Exception
This empty method is called whenever a client connects to this service thread; objects that implement a particular network protocol should define this method to communicate with the client via the streams.

Parameters:
in - the client input stream
out - a stream that writes back to the client
Throws: if
there are any unrecoverable network or I/O errors
 o handleServiceException
 public void handleServiceException(Exception e)
This method is called in case there are any exceptions while the thread is running

Parameters:
e - the exception thrown

All Packages  Class Hierarchy  This Package  Previous  Next  Index