All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.habanero.LimitArbitrator

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

public class LimitArbitrator
extends CentralArbitrator
implements Observer
A LimitArbitrator is an arbitrator that forces you to have a lock for all actions except the quit action. The LimitArbitrator provides keys, compares a new lock against older locks, and requires all actions to have keys. Also allows actions or keys to block until allowed.


Variable Index

 o validLockSet

Constructor Index

 o LimitArbitrator()
 o LimitArbitrator(Arbitrator)

Method Index

 o anyBlocks(Action)
 o anyConflicts(Lock, Key)
 o arbitrate(ActionRequest)
These routines should be overridden to do something with the request.
 o blockingGetLock(Lock, Key)
This blocks for up to 5 seconds if it cannot get a lock, then tries again
 o checkLockSet()
 o doArbitration(ActionRequest)
 o findLocker(Key)
 o getLock(Lock, Key)
 o keylessAction(Action)
 o releaseLock(int)
 o releaseLock(Key)
 o releaseOwnedLocks(SessionParticipant)
 o update(Observable, Object)
 o validate(Key)

Variables

 o validLockSet
 protected Vector validLockSet

Constructors

 o LimitArbitrator
 protected LimitArbitrator(Arbitrator parent) throws IOException
Parameters:
parent - the parent arbitrator
r - the router
Returns:
a new arbitrator
 o LimitArbitrator
 protected LimitArbitrator()
Returns:
creates a new arbitrator

Methods

 o doArbitration
 protected boolean doArbitration(ActionRequest request)
 o arbitrate
 public synchronized boolean arbitrate(ActionRequest request)
These routines should be overridden to do something with the request. The result should be an ActionGranted sent to the router.

Parameters:
request - the action request to be performed
Returns:
true if the action was performed, false if it was not able to
Overrides:
arbitrate in class CentralArbitrator
 o getLock
 public synchronized Key getLock(Lock ldNew,
                                 Key oldKey)
Parameters:
ldNew - - the new lock descriptor
oldKey - - the key used to acquire this new lock
Returns:
returns a key for a lock built from the lock descriptor if it is OK to do so
Overrides:
getLock in class CentralArbitrator
 o blockingGetLock
 public synchronized Key blockingGetLock(Lock ldNew,
                                         Key oldKey)
This blocks for up to 5 seconds if it cannot get a lock, then tries again

Overrides:
blockingGetLock in class Arbitrator
 o releaseLock
 public synchronized void releaseLock(Key kFinished)
Parameters:
kFinished - - the key of the lock that is no longer needed
Returns:
releases the lock
Overrides:
releaseLock in class CentralArbitrator
 o releaseLock
 protected synchronized void releaseLock(int kFinished)
Parameters:
kFinished - - the index of the lock that is no longer needed
Returns:
releases the lock
 o releaseOwnedLocks
 protected synchronized void releaseOwnedLocks(SessionParticipant client)
 o validate
 public boolean validate(Key kUse)
Parameters:
kUse - - the key we are going to use
Returns:
determines if the lock is good, and returns true if it has been used
 o anyConflicts
 protected boolean anyConflicts(Lock ldRequest,
                                Key oldKey)
Parameters:
ldRequest - - the description the user is requesting
Returns:
returns true if there is a conflicts with earlier locks
 o keylessAction
 protected boolean keylessAction(Action act)
Parameters:
act - - the action that we are checking to see if anyone objects
Returns:
returns true if a lock objects to the action
 o anyBlocks
 protected boolean anyBlocks(Action act)
Parameters:
act - - the action that we are checking to see if anyone objects
Returns:
returns true if a lock objects to the action
 o findLocker
 protected Locker findLocker(Key key)
Parameters:
kSearch - - the key of the lock we are searching for
Returns:
returns the lock if it exists, and null otherwise
 o checkLockSet
 protected void checkLockSet()
 o update
 public void update(Observable o,
                    Object arg)

All Packages  Class Hierarchy  This Package  Previous  Next  Index