distrit.client
Class InteractiveTaskClient

java.lang.Object
  |
  +--distrit.client.InteractiveTaskClient

public class InteractiveTaskClient
extends java.lang.Object

This is a generic client that will connect to an InteractiveTaskServer, download its task, run it and perform interaction with the server at regular intervals.

The client is pull based in that it is the sole initiator of all communication.

There are two main modes the client can be in:

1. Connecting.

2. Interacting.

The client starts in the first and enters the second once it manages to contact the server. It will fallback onto the first if communication is broken.

Once connection is re-established with the server the client will check that the task the server is sending out is equal to the one it's been running. If it is, then the client resumes interaction mode. If it isn't then the previous task is aborted, the new one started before the client resumes interaction mode.


Constructor Summary
InteractiveTaskClient(java.lang.String hostName, java.lang.String bindingName, java.util.Vector data4Server)
          Creates new InteractiveTaskClient
 
Method Summary
 void connectLoop()
          This method loops forever trying to connect to the server if it isn't and interacting with it if it is connected.
static void main(java.lang.String[] args)
          Method executed when the client is started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InteractiveTaskClient

public InteractiveTaskClient(java.lang.String hostName,
                             java.lang.String bindingName,
                             java.util.Vector data4Server)
Creates new InteractiveTaskClient
Parameters:
hostName - The name of the host where the interactive task server we wish to connect to is residing.
bindingName - The name under which the server is registered in the RMI registry.
data4Server - The main method will make this parameter a Vector containing various strings. The first being the ip address of the client and the rest being the remainding command line arguments after the hostName and bindingName.
Method Detail

connectLoop

public void connectLoop()
                 throws java.lang.InterruptedException
This method loops forever trying to connect to the server if it isn't and interacting with it if it is connected.

main

public static void main(java.lang.String[] args)
Method executed when the client is started.
Parameters:
args[0] - Server host address can be any internet address.
args[1] - Server binding name is RMI registry registration name.
args[2] - If preceded with -i interact loop time in minutes.
args[3] - If preceded with -c connect loop time in minutes.