O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Designing Servers to Use Dynamic Class Loading

If you spend much time creating socket-based network programs, it won't take long for you to notice a simple pattern. You usually create a main class that listens for incoming socket connections. You then create a separate class (or an inner class) to handle the new connection in a separate thread. Because the only thing that really changes is the way you handle the clients, why not create a generic socket service to make it easier to create socket applications?

You start by creating a common interface for client handlers, like the one shown in Listing 40.4.

Code Listing 40.4. Source Code for ClientHandler.java
 package usingj2ee.dynclass; import java.net.*; public interface ClientHandler extends ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required