jaugment2.jini
Class SimpleLandlord

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--jaugment2.jini.SimpleLandlord

public class SimpleLandlord
extends java.rmi.server.UnicastRemoteObject
implements com.sun.jini.lease.landlord.Landlord, com.sun.jini.lease.landlord.LocalLandlord

a very simple LandLord

See Also:
Serialized Form

Inner Class Summary
static class SimpleLandlord.EventRegistration
           
static interface SimpleLandlord.LeaseListener
           
private static class SimpleLandlord.myCookie
           
private static class SimpleLandlord.storedItem
          an abstract item stored by our lease-management-code
 
Inner classes inherited from class com.sun.jini.lease.landlord.Landlord
com.sun.jini.lease.landlord.Landlord.RenewResults
 
Field Summary
private  java.util.Hashtable[] cookie2item
           
private  int cookieval
           
private  com.sun.jini.lease.landlord.LandlordLeaseFactory leaseFactory
           
private  java.lang.Thread leasethread
           
private  SimpleLandlord.LeaseListener listener
           
private  int maxduration
           
private  boolean running
           
private  java.util.TreeSet[] sets
          Array of sorted mappings of storedItem sorted by absolute expiration-time, mapped from cookies(for renewal).
private  int typenum
           
private  com.sun.jini.lease.landlord.LandlordUtil util
           
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
csf, port, portFactoryParamTypes, portParamTypes, serialVersionUID, ssf
 
Fields inherited from class java.rmi.server.RemoteServer
log, logname, serialVersionUID
 
Fields inherited from class java.rmi.server.RemoteObject
ref, serialVersionUID
 
Constructor Summary
SimpleLandlord(SimpleLandlord.LeaseListener listener)
           
SimpleLandlord(SimpleLandlord.LeaseListener listener, int typenum)
           
SimpleLandlord(SimpleLandlord.LeaseListener listener, int typenum, int maxduration)
           
 
Method Summary
 void cancel(java.lang.Object cookie)
           
 java.util.Map cancelAll(java.lang.Object[] cookie)
           
 net.jini.core.lease.Lease grantLease(int type, java.lang.Object storeMe, long requestedDuration)
           
 void initLandlord()
           
private  long policy(long d)
           
 long renew(java.lang.Object cookie, long duration)
           
 com.sun.jini.lease.landlord.Landlord.RenewResults renewAll(java.lang.Object[] cookies, long[] durations)
           
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
, clone, exportObject, exportObject, exportObject, exportObject, readObject, reexport, 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, writeObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

running

private boolean running

listener

private SimpleLandlord.LeaseListener listener

leaseFactory

private com.sun.jini.lease.landlord.LandlordLeaseFactory leaseFactory

util

private com.sun.jini.lease.landlord.LandlordUtil util

typenum

private int typenum

maxduration

private int maxduration

leasethread

private java.lang.Thread leasethread

sets

private java.util.TreeSet[] sets
Array of sorted mappings of storedItem sorted by absolute expiration-time, mapped from cookies(for renewal). The array is indexed by type.

cookie2item

private java.util.Hashtable[] cookie2item

cookieval

private int cookieval
Constructor Detail

SimpleLandlord

public SimpleLandlord(SimpleLandlord.LeaseListener listener)
               throws java.rmi.RemoteException

SimpleLandlord

public SimpleLandlord(SimpleLandlord.LeaseListener listener,
                      int typenum)
               throws java.rmi.RemoteException

SimpleLandlord

public SimpleLandlord(SimpleLandlord.LeaseListener listener,
                      int typenum,
                      int maxduration)
               throws java.rmi.RemoteException
Method Detail

grantLease

public net.jini.core.lease.Lease grantLease(int type,
                                            java.lang.Object storeMe,
                                            long requestedDuration)
                                     throws java.rmi.RemoteException,
                                            net.jini.core.lease.LeaseDeniedException

initLandlord

public void initLandlord()
                  throws java.rmi.RemoteException

policy

private long policy(long d)

renew

public long renew(java.lang.Object cookie,
                  long duration)
           throws net.jini.core.lease.LeaseDeniedException,
                  net.jini.core.lease.UnknownLeaseException
Specified by:
renew in interface com.sun.jini.lease.landlord.Landlord

cancel

public void cancel(java.lang.Object cookie)
            throws net.jini.core.lease.UnknownLeaseException
Specified by:
cancel in interface com.sun.jini.lease.landlord.Landlord

renewAll

public com.sun.jini.lease.landlord.Landlord.RenewResults renewAll(java.lang.Object[] cookies,
                                                                  long[] durations)
                                                           throws java.rmi.RemoteException
Specified by:
renewAll in interface com.sun.jini.lease.landlord.Landlord

cancelAll

public java.util.Map cancelAll(java.lang.Object[] cookie)
                        throws java.rmi.RemoteException
Specified by:
cancelAll in interface com.sun.jini.lease.landlord.Landlord