Package me.ahoo.cosid.segment
Class DefaultIdSegment
java.lang.Object
me.ahoo.cosid.segment.DefaultIdSegment
- All Implemented Interfaces:
Comparable<IdSegment>
,Grouped
,IdSegment
Default Id Segment.
-
Field Summary
Fields inherited from interface me.ahoo.cosid.segment.IdSegment
SEQUENCE_OVERFLOW, TIME_TO_LIVE_FOREVER
-
Constructor Summary
ConstructorDescriptionDefaultIdSegment
(long maxId, long step) DefaultIdSegment
(long maxId, long step, long fetchTime, long ttl, GroupedKey group) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface me.ahoo.cosid.segment.IdSegment
compareTo, ensureNextIdSegment, isAvailable, isExpired, isOverflow, isOverflow
-
Field Details
-
OVERFLOW
-
-
Constructor Details
-
DefaultIdSegment
public DefaultIdSegment(long maxId, long step) -
DefaultIdSegment
-
-
Method Details
-
group
-
getFetchTime
public long getFetchTime()Description copied from interface:IdSegment
ID segment fetch time. unitTimeUnit.SECONDS
- Specified by:
getFetchTime
in interfaceIdSegment
- Returns:
- fetch time
-
getTtl
public long getTtl()Description copied from interface:IdSegment
the id segment time to live. unitTimeUnit.SECONDS
-
getMaxId
public long getMaxId() -
getOffset
public long getOffset() -
getSequence
public long getSequence()- Specified by:
getSequence
in interfaceIdSegment
-
getStep
public long getStep() -
incrementAndGet
public long incrementAndGet()- Specified by:
incrementAndGet
in interfaceIdSegment
-
toString
-