edu.jhu.cnds.Frugal
Class FrugalManagerServer

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--edu.jhu.cnds.Frugal.FrugalManagerServer

public class FrugalManagerServer
extends java.rmi.server.UnicastRemoteObject
implements FrugalServiceRemote

A server class, designed to register Frugal Manager implementations with lookup services.

This class also takes responsibility for updating Frugal Resource classes with information about the global maximum load and the number of Frugal Resources available. Obviously, the Frugal Manager defines the global state relative to the lookup services and groups it monitors itself. If there are several FrugalManagerServers running, viewing different but intersecting sets of groups and services, the Frugal Resource classes they manage in common can display inconsistent information. The Frugal Managers will continue to behave correctly relative to the world they know of. Frugal Resources have no functional reason to monitor the lookup services. They use the global state only to display their cost to users using lookup browsers. Therefore, this behavior is not likely to change.

Version:
2.0
Author:
R. Sean Borgstrom
See Also:
Serialized Form

Field Summary
protected  net.jini.lookup.JoinManager isabella
          Workhorse server class from Sun.
protected  net.jini.lease.LeaseRenewalManager serviceLease
          LeaseRenewalManager for this class' leases.
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
FrugalManagerServer(java.lang.String[] argv)
          Loads persistent data, creates an implementation of the Frugal Manager service, and registers it.
 
Method Summary
 void checkpoint()
          Saves recent changes to this class' persistent data.
 void dock()
          Kills the service.
 java.lang.Object getAdmin()
          Returns an administrative interface for the relevant Frugal Manager.
 net.jini.lookup.JoinManager getIsabella()
          Returns this class' JoinManager.
 java.io.File getMonument()
          Returns the persistent storage for this server.
protected  void inform(FrugalResourceRemote r)
          Informs a Frugal Resource of the global state.
static void main(java.lang.String[] argv)
          Starts the server running.
 void setMonument(java.io.File monument)
          Sets the persistent storage for this server.
protected  void startAdjutant()
          Initializes a FrugalManagerEars class that watches for Frugal Resources.
protected  void update()
          Updates known Frugal Resources every minute with information about the global state.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serviceLease

protected transient net.jini.lease.LeaseRenewalManager serviceLease
LeaseRenewalManager for this class' leases.

isabella

protected net.jini.lookup.JoinManager isabella
Workhorse server class from Sun.
Constructor Detail

FrugalManagerServer

public FrugalManagerServer(java.lang.String[] argv)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException,
                           java.rmi.RemoteException
Loads persistent data, creates an implementation of the Frugal Manager service, and registers it.
Parameters:
argv - These should be the same arguments as those passed to main.
Method Detail

main

public static void main(java.lang.String[] argv)
Starts the server running. Invoke with -f [logfile] on the first execution to create the persistent storage logfile and store a unique ID string. Otherwise, invoke with [logfile] to read from persistent storage.
Parameters:
argv - List of command-line argument strings.

startAdjutant

protected void startAdjutant()
                      throws java.rmi.RemoteException
Initializes a FrugalManagerEars class that watches for Frugal Resources.

update

protected void update()
               throws java.io.IOException
Updates known Frugal Resources every minute with information about the global state. Two Managers accessing different groups and lookup services will have different pictures of the global state. In this case, the entry beans of various Frugal Resources might display inconsistent information. However, the Managers will not behave inconsistently - their behavior remains correct.

dock

public void dock()
Kills the service.

getMonument

public java.io.File getMonument()
Returns the persistent storage for this server.
Returns:
The file where the server stores its ID and other persistent attributes.

setMonument

public void setMonument(java.io.File monument)
Sets the persistent storage for this server.
Parameters:
monument - The new persistent storage location.

getIsabella

public net.jini.lookup.JoinManager getIsabella()
Returns this class' JoinManager.
Returns:
A workhorse class for service registration.

getAdmin

public java.lang.Object getAdmin()
                          throws java.rmi.RemoteException
Returns an administrative interface for the relevant Frugal Manager.
Returns:
An administrative interface for the relevant Frugal Manager.

checkpoint

public void checkpoint()
                throws java.io.IOException,
                       java.lang.ClassNotFoundException
Saves recent changes to this class' persistent data.

inform

protected void inform(FrugalResourceRemote r)
               throws java.rmi.RemoteException
Informs a Frugal Resource of the global state.
Parameters:
r - A Frugal Resource that may not yet know the global state.