1. /*
  2. * @(#)Lease.java 1.8 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.rmi.dgc;
  8. /**
  9. * A lease contains a unique VM identifier and a lease duration. A
  10. * Lease object is used to request and grant leases to remote object
  11. * references.
  12. */
  13. public final class Lease implements java.io.Serializable {
  14. /**
  15. * @serial Virtual Machine ID with which this Lease is associated.
  16. * @see #getVMID
  17. */
  18. private VMID vmid;
  19. /**
  20. * @serial Duration of this lease.
  21. * @see #getValue
  22. */
  23. private long value;
  24. /** indicate compatibility with JDK 1.1.x version of class */
  25. private static final long serialVersionUID = -5713411624328831948L;
  26. /**
  27. * Constructs a lease with a specific VMID and lease duration. The
  28. * vmid may be null.
  29. */
  30. public Lease(VMID id, long duration)
  31. {
  32. vmid = id;
  33. value = duration;
  34. }
  35. /**
  36. * Returns the client VMID associated with the lease.
  37. */
  38. public VMID getVMID()
  39. {
  40. return vmid;
  41. }
  42. /**
  43. * Returns the lease duration.
  44. */
  45. public long getValue()
  46. {
  47. return value;
  48. }
  49. }