ENTERPRISE JAVAHow to Use Jini Distributed Leasing

ENTERPRISE JAVA
How to Use Jini Distributed Leasing

Kathy Kozel

Listing 2. Interfaces for the lease grantor (Kennel) and the mobile object (Trainable).


import net.jini.core.lookup.*;
import net.jini.core.event.*;
import net.jini.core.lease.*;
import java.util.*;
import java.io.*;
import java.rmi.*;

public interface Kennel extends Remote {
        public Confirmation bookRoom(Trainable theTrainable,
                                     long duration) throws RemoteException;

       public long extendStay(String theID, int theRoomNum, 
                               long requestedDuration) throws RemoteException;
  
  public void cancelStay(String theID, int theRoomNum)
                               throws RemoteException;
  public Trainable takeTrainableHome(String theID, int theRoomNum)
                                           throws RemoteException;
}

public interface Trainable {
    public void train();
}