All Packages Class Hierarchy This Package Previous Next Index
Class ncsa.habanero.DynCentralArbitrator
java.lang.Object
|
+----ncsa.habanero.ModelObject
|
+----ncsa.habanero.granted.Arbitrator
|
+----ncsa.habanero.CentralArbitrator
|
+----ncsa.habanero.DynCentralArbitrator
- public class DynCentralArbitrator
- extends CentralArbitrator
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.
-
DynCentralArbitrator(Arbitrator)
-
-
arbitrate(ActionRequest)
-
-
getDelegate()
-
-
getLock(Lock)
-
-
getLock(Lock, Key)
-
-
getSerializer()
-
-
getSession()
- Return the Session which this object is in.
-
getTicketGranter()
-
-
init(Arbitrator)
-
-
releaseLock(Key)
-
-
route_to_everyone(ActionGranted)
-
-
setDelegate(CentralArbitrator)
-
-
stop()
-
DynCentralArbitrator
public DynCentralArbitrator(Arbitrator parent) throws IOException
- Parameters:
- parent - the parent arbitrator
- 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.
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.
- Overrides:
- route_to_everyone in class CentralArbitrator
setDelegate
public void setDelegate(CentralArbitrator arbi)
- Parameters:
- arbi - the arbitrator
- Returns:
- updates the delegate
getDelegate
public CentralArbitrator getDelegate()
- Returns:
- returns the delegate
init
public void init(Arbitrator parent) throws IOException
- Parameters:
- parent - the parent arbitrator
- r - the router
- Returns:
- sets up the arbitrator
- Overrides:
- init in class CentralArbitrator
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 CentralArbitrator
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 CentralArbitrator
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 CentralArbitrator
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 CentralArbitrator
getTicketGranter
public TicketGranter getTicketGranter()
- Returns:
- This arbitrator's TicketGranter
- Overrides:
- getTicketGranter in class CentralArbitrator
getSerializer
public Serializer getSerializer()
- Returns:
- This arbitrator's Serializer
- Overrides:
- getSerializer in class CentralArbitrator
stop
public synchronized void stop()
- Returns:
- stops the CentralArbitrator from running
- Overrides:
- stop in class CentralArbitrator
getSession
public Session getSession()
- Return the Session which this object is in.
- Overrides:
- getSession in class CentralArbitrator
All Packages Class Hierarchy This Package Previous Next Index