1 /* 2 * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * 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 */ Lease(VMID id, long duration)54 public Lease(VMID id, long duration) 55 { 56 vmid = id; 57 value = duration; 58 } 59 60 /** 61 * Returns the client VMID associated with the lease. 62 * @return client VMID 63 */ getVMID()64 public VMID getVMID() 65 { 66 return vmid; 67 } 68 69 /** 70 * Returns the lease duration. 71 * @return lease duration 72 */ getValue()73 public long getValue() 74 { 75 return value; 76 } 77 } 78