O'Reilly logo

Java RMI by William Grosso

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

Evolving the Application

At this point, we’re done with the first version of the application. We’ve successfully used sockets to implement the networking portion of a simple, distributed printing application. But the words “first version” are very important. There’s a long list of features we haven’t implemented—some because we were lazy, others because they probably wouldn’t be requested in the first version of an application. For example:

  • Users will want more than one printer to be available.

  • Users will want to have a print queue. Important documents should be moved to the top of a print queue; less urgent jobs should wait until the printer isn’t busy.

  • If we’re going to have a print queue, it would be nice to be able to explicitly access the queue, both to see the entire queue, and to make queries about our job. It should also be possible to cancel a print request that is in the queue but hasn’t already been sent to the printer.

  • As we scale to more users, application responsiveness will become important. This is especially true on a LAN, as it is almost certainly faster to send a document than it is to print it. Hence, we should decouple printing a document from receiving it over the wire. In particular, the current implementation of ServerNetworkWrapper’s accept( ) method, shown here, will force the client applications to wait until an existing print job is finished before they can send a document:

    public void accept( ) { while (true) { Socket clientSocket = null; try { clientSocket ...

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