Source code: com/fetish/directory/tool/FetishLease.java
1 package com.fetish.directory.tool;
2
3 import java.rmi.Remote;
4 import java.rmi.RemoteException;
5 import net.jini.core.lease.Lease;
6 import net.jini.core.lease.LeaseMap;
7 import net.jini.core.lease.UnknownLeaseException;
8 import net.jini.core.lease.LeaseDeniedException;
9
10 /**
11 * Interface for the Fetish leases.
12 * Fetish leases wrap Jini leases and modifies their behavior to make the
13 * FADA aware of lease renewal and cancellation.
14 */
15
16 public interface FetishLease extends Remote {
17 /**
18 * Cancel this Fetish lease.
19 * The service proxy associated with this FetishLease will be deleted
20 * from both the FADA registry and the underlying Jini registry.
21 * @throws RemoteException There is a communication error with the FADA
22 * or Jini Lookup Service
23 * @throws UnknownLeaseException This lease has been already cancelled or
24 * has expired, it is unrelated to any service registration.
25 */
26 void cancel() throws RemoteException, UnknownLeaseException;
27
28 /**
29 * Renew this Fetish lease for the specified amount of milliseconds.
30 * Tries to obtain a Fetish lease of the requested duration.
31 * It is safe to call this method with Lease.ANY as a parameter, meaning
32 * to get a lease time at the Jini Lookup Service will.
33 * @throws RemoteException There is a communication error with the FADA
34 * or Jini Lookup Service
35 * @throws UnknownLeaseException This lease has been already cancelled or
36 * has expired, it is unrelated to any service registration.
37 * @throws LeaseDeniedException The Jini Lookup service is unwilling to
38 * grant such an amount of time. This Fetish lease remains untouched.
39 * Try to ask for a smaller amount of time, or Lease.ANY
40 */
41 long renew(long duration) throws RemoteException, UnknownLeaseException, LeaseDeniedException;
42 }