Noel Enete

This provides the ability to sort more records than can fit in memory to any Jini client.


JSort (Jini Sort) is a virtual sort service that can process multiple sort jobs at once.

The service sorts fixed length records that are submitted in the form of strings. Obviously, the records that are submitted do not need to exist in any file, but they can be built on the fly with special sort fields prepended to each record and removed when the data is returned in order.

The sort order is specified in parameters that are passed to the open() method. Records can be sorted by any number of fields that occupy any position in the submitted records. The fields can even be overlapping. A sort order of ascending or descending is specified for each sort field independently.

If you find bugs in this newly adapted program, I would encourage you to find a fix for the problem and send the fix back to me. It will be incorporated in future versions of Nuggets.

As I use this program, I will be improving its documentation and usability. But I thought the Jini community might like to have another service that could be used by those who need it.

Now, if someone would just write a free standing Jini spell checker and corresponding applet user interface (notepad level editor) that works like the spell checker in MS Word. That may be the only reason I still use that program.


To use the service, the client must have access to the JSortInterface.class file.

The client contacts the service and opens a new sort job. Then releases records, one by one, to the sort service. When the service has all the records, the client invokes the sort method and the service sorts all the records. If there are too many records to fit in memory, the service makes a sortwork file for temporary storage. Then the client returns records, one by one, from the service.

To optimize network performance, there are also methods to release and return blocks of records at a time. The example in Figure 1 demonstrates both methods.

Figure 1: JSortClient

Run Instructions

To run this example:
  • Start Jini from the JiniExample1 directory using the r1.bat, r2.bat, and r3.bat files.
  • Then start the server from \java \nuggets \pages \tools \jsort \server-side (removing the spaces) using r.bat.
  • Then start the client from \java \nuggets \pages \tools \jsort \client-side (removing the spaces) using r.bat.

by Noel Enete . . . . . .