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.
-
granter
-
-
serializer
-
-
CentralArbitrator()
-
-
CentralArbitrator(Arbitrator)
-
-
arbitrate(ActionRequest)
-
-
getLock(Lock)
-
-
getLock(Lock, Key)
-
-
getSerializer()
-
-
getSession()
- Return the Session which this object is in.
-
getTicketGranter()
-
-
init(Arbitrator)
-
-
releaseLock(Key)
-
-
route_to_everyone(ActionGranted)
-
-
stop()
-
granter
protected TicketGranter granter
serializer
protected Serializer serializer
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.
CentralArbitrator
protected CentralArbitrator()
- Returns:
- Only use this if you are going to call init immmediately after
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.
init
public void init(Arbitrator parent) throws IOException
- Parameters:
- parent - the parent arbitrator
- r - the router
- Returns:
- sets up the arbitrator
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
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
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
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
getTicketGranter
public TicketGranter getTicketGranter()
- Returns:
- This arbitrator's TicketGranter
- Overrides:
- getTicketGranter in class Arbitrator
getSerializer
public Serializer getSerializer()
- Returns:
- This arbitrator's Serializer
- Overrides:
- getSerializer in class Arbitrator
stop
public synchronized void stop()
- Returns:
- stops the CentralArbitrator from running
- Overrides:
- stop in class Arbitrator
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