01 /*
02 * Copyright 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25 package java.rmi.dgc;
26
27 /**
28 * A lease contains a unique VM identifier and a lease duration. A
29 * Lease object is used to request and grant leases to remote object
30 * references.
31 */
32 public final class Lease implements java.io.Serializable {
33
34 /**
35 * @serial Virtual Machine ID with which this Lease is associated.
36 * @see #getVMID
37 */
38 private VMID vmid;
39
40 /**
41 * @serial Duration of this lease.
42 * @see #getValue
43 */
44 private long value;
45 /** indicate compatibility with JDK 1.1.x version of class */
46 private static final long serialVersionUID = -5713411624328831948L;
47
48 /**
49 * Constructs a lease with a specific VMID and lease duration. The
50 * vmid may be null.
51 * @param id VMID associated with this lease
52 * @param duration lease duration
53 */
54 public Lease(VMID id, long duration) {
55 vmid = id;
56 value = duration;
57 }
58
59 /**
60 * Returns the client VMID associated with the lease.
61 * @return client VMID
62 */
63 public VMID getVMID() {
64 return vmid;
65 }
66
67 /**
68 * Returns the lease duration.
69 * @return lease duration
70 */
71 public long getValue() {
72 return value;
73 }
74 }
|