A Multithreaded Server In Java
Building Upon Frameworks
Mani Malarvannan
Developing frameworks is a challenging task. Several issues need to be addressed during the design stage. But the potential benefits of a framework are many. Once you have a framework for a particular problem domain, then by customizing the framework and reusing the analysis, design, and implementation you can create several new applications for that domain. In this article I'll explore the design of a framework for a multithreaded server.
There are several ways to design a client/server application in Java. If you have an HTML client, you can use servlets, which are good replacements for CGI scripts, to implement your server (see "Webmaster's Domain," Web Techniques, April 1998). But HTML is not useful if you need a sophisticated GUI at the client side. In these types of situations you need an applet to talk to the server. This can be accomplished in several ways. Depending upon your server implementation, an applet can communicate with the server using common object request broker architecture (CORBA), Remote Method Invocation (RMI), or sockets. Among these approaches, CORBA is useful if you need cross-platform integration of client and server, RMI for large-scale client/server applications, and sockets for small client/server applications that can have direct TCP/IP connection from the client to the server.
A small socket-based client/server application lets you bypass the HTTP server and talk directly with your own server using TCP/IP, increasing the overall efficiency of the application.