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
-
ServiceThread()
-
-
getServer()
- gets the host server for this thread
-
handleServiceException(Exception)
- This method is called in case there are any exceptions while the thread is
running
-
run()
- run() loops continuously until the thread dies or is shut down.
-
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.
-
setServer(MultiThreadServer)
-
sets a reference back to the host server object
ServiceThread
public ServiceThread()
setServer
public void setServer(MultiThreadServer server)
- sets a reference back to the host server object
- Parameters:
- server - the host server
getServer
public MultiThreadServer getServer()
- gets the host server for this thread
- Returns:
- the host server reference
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
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
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