class LeaseTable extends Object
Internally we keep two tables of client leases, one mapping client leases to client lease wrappers, the other a list of client lease wrappers whose leases could not be unpacked (aka "deformed wrappers") when they were added (and thus could not be put in the map). This bifurcation is not exposed to the client.
Unless otherwise noted the methods of this class are not thread safe.
Modifier and Type | Field and Description |
---|---|
private DeformedLeaseList |
deformedLeases
The list we store deformed wrappers in.
|
private Map |
leaseTable
The map we use to map client leases to wrappers.
|
Constructor and Description |
---|
LeaseTable() |
Modifier and Type | Method and Description |
---|---|
(package private) ClientLeaseWrapper |
get(Lease clientLease)
Find the client lease wrapper associated with the passed lease.
|
(package private) void |
put(ClientLeaseWrapper clw)
Add a mapping from lease wrapper to client lease.
|
(package private) void |
remove(ClientLeaseWrapper clw)
Remove a lease from the table.
|
private final DeformedLeaseList deformedLeases
private final Map leaseTable
ClientLeaseWrapper get(Lease clientLease)
clientLease
- the lease we need the wrapper fornull
if we don't know about this leasevoid put(ClientLeaseWrapper clw)
clw
- client lease wrapper, and client lease to add to
tablevoid remove(ClientLeaseWrapper clw)
clw
- client lease wrapper for the lease we want to
removeCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.