To Cliser Home

Cliser: The Java ServiceThread Class

To Cliser Architecture

The Cliser ThreadManager is based upon the Prototype pattern, and so its constructor must be passed an instance of the kind of thread it is to manage. The ServiceThread class provides a superclass from which classes for such threads can be derived. In order for ThreadManager to replicate such threads, the ServiceThread class implements Java's Cloneable interface.

Cliser's Java ServiceThread Class

Because it is a subclass of CommunicatorUser and Java does not support multiple inheritance, the ServiceThread class also implements Java's Runnable interface. To do so, it overrides the run() method as follows:

  abstract public void performService();

  public void run()
  {
    for (;;)
    {
      this.performService();
      this.awaitNextJob();
    }
  }
The run() method thus leaves definition of the performService() up to each subclass. The code generator generates a stub for this method, so that completing the definition of performService() is about all that must be done to complete a Cliser-generated Java concurrent (multithreaded) server.

The ServiceThread class provides two synchronization operations:


Up to the Cliser class libraries Up to the CommunicatorUser class hierarchy Back to the Client hierarchy Back to the Server hierarchy Up to the Cliser source code generators

This page maintained by Joel Adams (adams@calvin.edu).