1. /*
  2. * @(#)Lease.java 1.12 03/01/23
  3. *
  4. * Copyright 2003 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. * @param id VMID associated with this lease
  30. * @param duration lease duration
  31. */
  32. public Lease(VMID id, long duration)
  33. {
  34. vmid = id;
  35. value = duration;
  36. }
  37. /**
  38. * Returns the client VMID associated with the lease.
  39. * @return client VMID
  40. */
  41. public VMID getVMID()
  42. {
  43. return vmid;
  44. }
  45. /**
  46. * Returns the lease duration.
  47. * @return lease duration
  48. */
  49. public long getValue()
  50. {
  51. return value;
  52. }
  53. }