All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.habanero.ClientListener

java.lang.Object
   |
   +----ncsa.habanero.Communicator
           |
           +----ncsa.habanero.ClientListener

public class ClientListener
extends Communicator
implements Runnable, Marshallable
This is the Client-side portion of our centralized Arbitrator. It listens for connections from client-side Arbitrators, and once it gets them waits for ActionRequests. Upon receiving an ActionRequest, it decides if it is valid, and if so creates an ActionGranted which it passes to its Router.


Variable Index

 o connection
 o frozen
 o thread

Constructor Index

 o ClientListener()
 o ClientListener(Collobject, String)
 o ClientListener(Session)

Method Index

 o addToManager(CommManager, String)
 o checkTemperature()
This routine blocks while the variable frozen is > 0.
 o freezeInput()
 o getSession()
 o handleInput(MarshallInput)
This is called when input is made available.
 o listen()
Listen on input and handle it.
 o makeManager(Session)
 o readAMessage(MarshallInput)
 o run()
Listen on input and handle it.
 o sendQuestion(Answerable)
 o start()
 o stop()
 o thawInput()

Variables

 o connection
 protected DeferredIO connection
 o frozen
 protected int frozen
 o thread
 protected transient Thread thread

Constructors

 o ClientListener
 public ClientListener(Session s) throws IOException
 o ClientListener
 public ClientListener(Collobject c,
                       String sib) throws IOException
 o ClientListener
 public ClientListener()

Methods

 o start
 public void start()
Overrides:
start in class Communicator
 o addToManager
 protected boolean addToManager(CommManager m,
                                String key)
Overrides:
addToManager in class Communicator
 o makeManager
 public CommManager makeManager(Session s)
Overrides:
makeManager in class Communicator
 o run
 public void run()
Listen on input and handle it.

 o listen
 public void listen()
Listen on input and handle it.

 o handleInput
 protected boolean handleInput(MarshallInput in)
This is called when input is made available. First, it checks the frozen instance variable, and if it is supposed to be frozen, goes into wait. When it is not frozen, it unmarshalls the ActionGranted and sends it to its Serializer. If it cannot unmarshall properly, it prints an error and exits, because someone really ought to fix the problem. This routine cannot be synchronized, because it is always blocking in unmarshall, but it calls checkTemperature to block if input should be frozen.

 o readAMessage
 public static boolean readAMessage(MarshallInput in)
 o freezeInput
 public synchronized void freezeInput()
 o thawInput
 public synchronized void thawInput()
 o checkTemperature
 protected synchronized void checkTemperature()
This routine blocks while the variable frozen is > 0.

 o stop
 public synchronized void stop()
Returns:
stops the CentralArbitrator from running
Overrides:
stop in class Communicator
 o getSession
 public Session getSession()
 o sendQuestion
 public void sendQuestion(Answerable a)

All Packages  Class Hierarchy  This Package  Previous  Next  Index