Class MockTime
java.lang.Object
org.apache.kafka.common.utils.MockTime
- All Implemented Interfaces:
org.apache.kafka.common.utils.Time
A clock that you can manually advance by calling sleep
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.apache.kafka.common.utils.Time
SYSTEM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(MockTime.Listener listener) longlongvoidsetCurrentTimeMs(long newMs) voidsleep(long ms) Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kafka.common.utils.Time
hiResClockMs, timer, timer, waitForFuture, waitObject
-
Constructor Details
-
MockTime
public MockTime() -
MockTime
public MockTime(long autoTickMs) -
MockTime
public MockTime(long autoTickMs, long currentTimeMs, long currentHighResTimeNs) -
MockTime
public MockTime(long autoTickMs, long currentTimeMs, long currentHighResTimeNs, boolean shouldSleep)
-
-
Method Details
-
addListener
-
milliseconds
public long milliseconds()- Specified by:
millisecondsin interfaceorg.apache.kafka.common.utils.Time
-
nanoseconds
public long nanoseconds()- Specified by:
nanosecondsin interfaceorg.apache.kafka.common.utils.Time
-
sleep
public void sleep(long ms) - Specified by:
sleepin interfaceorg.apache.kafka.common.utils.Time
-
setCurrentTimeMs
public void setCurrentTimeMs(long newMs)
-