KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > rmi > dgc > Lease


1 /*
2  * @(#)Lease.java 1.13 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package java.rmi.dgc;
8
9 /**
10  * A lease contains a unique VM identifier and a lease duration. A
11  * Lease object is used to request and grant leases to remote object
12  * references.
13  */

14 public final class Lease implements java.io.Serializable JavaDoc {
15
16     /**
17      * @serial Virtual Machine ID with which this Lease is associated.
18      * @see #getVMID
19      */

20     private VMID JavaDoc vmid;
21
22     /**
23      * @serial Duration of this lease.
24      * @see #getValue
25      */

26     private long value;
27     /** indicate compatibility with JDK 1.1.x version of class */
28     private static final long serialVersionUID = -5713411624328831948L;
29
30     /**
31      * Constructs a lease with a specific VMID and lease duration. The
32      * vmid may be null.
33      * @param id VMID associated with this lease
34      * @param duration lease duration
35      */

36     public Lease(VMID JavaDoc id, long duration)
37     {
38     vmid = id;
39     value = duration;
40     }
41
42     /**
43      * Returns the client VMID associated with the lease.
44      * @return client VMID
45      */

46     public VMID JavaDoc getVMID()
47     {
48     return vmid;
49     }
50
51     /**
52      * Returns the lease duration.
53      * @return lease duration
54      */

55     public long getValue()
56     {
57     return value;
58     }
59 }
60
Popular Tags