All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.habanero.CentralArbitrator

java.lang.Object
   |
   +----ncsa.habanero.ModelObject
           |
           +----ncsa.habanero.granted.Arbitrator
                   |
                   +----ncsa.habanero.CentralArbitrator

public class CentralArbitrator
extends Arbitrator
This is the server-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 granter
 o serializer

Constructor Index

 o CentralArbitrator()
 o CentralArbitrator(Arbitrator)

Method Index

 o arbitrate(ActionRequest)
 o getLock(Lock)
 o getLock(Lock, Key)
 o getSerializer()
 o getSession()
Return the Session which this object is in.
 o getTicketGranter()
 o init(Arbitrator)
 o releaseLock(Key)
 o route_to_everyone(ActionGranted)
 o stop()

Variables

 o granter
 protected TicketGranter granter
 o serializer
 protected Serializer serializer

Constructors

 o CentralArbitrator
 public CentralArbitrator(Arbitrator parent) throws IOException
Parameters:
parent - the parent arbitrator
port - the TCP port for the arbitrator to listen on
Returns:
CentralArbitrator listens on a TCP port for incoming connections, adds them to a list as they come in, and creates routers for each of them. New connections each have a thread spawned off for them so that multiple clients on those connections can speak to the CentralArbitrator concurrently. NOTE: This does not handle race conditions.
 o CentralArbitrator
 protected CentralArbitrator()
Returns:
Only use this if you are going to call init immmediately after

Methods

 o route_to_everyone
 public synchronized void route_to_everyone(ActionGranted granted)
Parameters:
granted - the action that can be sent to everyone
Returns:
The extra indirection of this routine is provided if the router is not local to this object. In that case, this routine could be overridden to send the ActionGranted back to the client, or to some other routing machine.
 o init
 public void init(Arbitrator parent) throws IOException
Parameters:
parent - the parent arbitrator
r - the router
Returns:
sets up the arbitrator
 o getLock
 public synchronized Key getLock(Lock lkNew)
Parameters:
lkNew - - the new lock that is requested
Returns:
returns the key that allows you to use this lock
Overrides:
getLock in class Arbitrator
 o getLock
 public synchronized Key getLock(Lock lkNew,
                                 Key oldKey)
Parameters:
lkNew - the new lock that is requested
oldKey - the key that gives us permission to get this lock
Returns:
A central arbitrator can't give anyone a key, since all actions are allowed
Overrides:
getLock in class Arbitrator
 o releaseLock
 public synchronized void releaseLock(Key lkFinished)
Parameters:
lkFinished - the key that we have finished using
Returns:
does nothing, since a central arbitrator doesn't limit actions
Overrides:
releaseLock in class Arbitrator
 o arbitrate
 public synchronized boolean arbitrate(ActionRequest request)
Parameters:
request - the action which someone wants performed
request - the ActionRequest we want to grant
Returns:
By default, the arbitrate routine merely calls a routine which should ask the router to route the ActionGranted to everyone. This should be overridden by arbitrators which do real work. However, if the action implements ArbitratorAction, it takes over the routing responsibility instead.
Overrides:
arbitrate in class Arbitrator
 o getTicketGranter
 public TicketGranter getTicketGranter()
Returns:
This arbitrator's TicketGranter
Overrides:
getTicketGranter in class Arbitrator
 o getSerializer
 public Serializer getSerializer()
Returns:
This arbitrator's Serializer
Overrides:
getSerializer in class Arbitrator
 o stop
 public synchronized void stop()
Returns:
stops the CentralArbitrator from running
Overrides:
stop in class Arbitrator
 o getSession
 public Session getSession()
Return the Session which this object is in.

Overrides:
getSession in class Arbitrator

All Packages  Class Hierarchy  This Package  Previous  Next  Index