1. /*
  2. * @(#)Lease.java 1.10 00/02/02
  3. *
  4. * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.rmi.dgc;
  11. /**
  12. * A lease contains a unique VM identifier and a lease duration. A
  13. * Lease object is used to request and grant leases to remote object
  14. * references.
  15. */
  16. public final class Lease implements java.io.Serializable {
  17. /**
  18. * @serial Virtual Machine ID with which this Lease is associated.
  19. * @see #getVMID
  20. */
  21. private VMID vmid;
  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. * Constructs a lease with a specific VMID and lease duration. The
  31. * vmid may be null.
  32. * @param id VMID associated with this lease
  33. * @param duration lease duration
  34. */
  35. public Lease(VMID id, long duration)
  36. {
  37. vmid = id;
  38. value = duration;
  39. }
  40. /**
  41. * Returns the client VMID associated with the lease.
  42. * @return client VMID
  43. */
  44. public VMID getVMID()
  45. {
  46. return vmid;
  47. }
  48. /**
  49. * Returns the lease duration.
  50. * @return lease duration
  51. */
  52. public long getValue()
  53. {
  54. return value;
  55. }
  56. }