public IdentifierManager(long lowerbound,
long upperbound)
Parameters:
lowerbound - the lower limit of the id-range to manage. Must be greater than or equal to
MIN_ID.
(lowerbound - 要管理的 id-range 的下限。必须大于或等于 MIN_ID。)
upperbound - the upper limit of the id-range to manage. Must be less then or equal
MAX_ID.
(upperbound - 要管理的 id 范围的上限。必须小于或等于 MAX_ID。)
Method Detail
reserve
public long reserve(long id)
reserveNew
public long reserveNew()
Returns:
a new identifier.
(一个新的标识符。)
Throws:
java.lang.IllegalStateException - if no more identifiers are available, then an Exception is raised.
(java.lang.IllegalStateException - 如果没有更多标识符可用,则引发异常。)
release
public boolean release(long id)
Parameters:
id - the identifier to release. Must be greater than or equal to
lowerbound and must be less than or equal to
upperbound(id - 要释放的标识符。必须大于等于lowerbound且必须小于等于upperbound)
Returns:
true, if the identifier was reserved and has been successfully released, false, if the identifier was not reserved.
(如果标识符被保留并且已成功释放,则为 true;如果未保留标识符,则为 false。)