7.3. Lease Maps
Applications often need to manage many leases. Lease maps provide a convenient means of maintaining a collection of leases and renewing or cancelling all of them with one operation.
7.3.1. Creating a Lease Map
To create a LeaseMap object, you call the createLeaseMap method on a Lease object. Here is the signature of the method:
LeaseMap createLeaseMap(long duration);
This method creates and returns a new lease map—a container for a set of leases, each of which has an associated lease renewal time. The method takes the duration parameter, pairs it with the lease the method was called on, and adds the lease/duration pair to the new lease map.
For example, consider the following code:
long duration = 1000 * 60; // 1 minute LeaseMap ...