jaugment2.jini.leases
Class SimpleLandlord

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

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

Helper-class for leases.

See Also:
Serialized Form

Inner Class Summary
private  class SimpleLandlord.myCookie
           
private static interface SimpleLandlord.SimpleLandlordListener
           
private  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.SimpleLandlordListener 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.SimpleLandlordListener listener)
           
 
Method Summary
 void cancel(java.lang.Object cookie)
           
 java.util.Map cancelAll(java.lang.Object[] cookie)
           
(package private)  net.jini.core.lease.Lease grantLease(int type, java.lang.Object storeMe, long requestedDuration)
           
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

leaseFactory

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

listener

private SimpleLandlord.SimpleLandlordListener listener

running

private boolean running

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.SimpleLandlordListener listener)
               throws java.rmi.RemoteException
Method Detail

grantLease

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

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