Ticker Type — netty Architecture
Architecture documentation for the Ticker type/interface in Ticker.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD d4c916df_d091_feed_ced3_14d744668d12["Ticker"] 8e82d44b_16d0_9a62_cde9_288dd8f965bb["Ticker.java"] d4c916df_d091_feed_ced3_14d744668d12 -->|defined in| 8e82d44b_16d0_9a62_cde9_288dd8f965bb style d4c916df_d091_feed_ced3_14d744668d12 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
common/src/main/java/io/netty/util/concurrent/Ticker.java lines 23–74
public interface Ticker {
/**
* Returns the singleton {@link Ticker} that returns the values from the real system clock source.
* However, note that this is not the same as {@link System#nanoTime()} because we apply a fixed offset
* to the {@link System#nanoTime() nanoTime}.
*/
static Ticker systemTicker() {
return SystemTicker.INSTANCE;
}
/**
* Returns a newly created mock {@link Ticker} that allows the caller control the flow of time.
* This can be useful when you test time-sensitive logic without waiting for too long or introducing
* flakiness due to non-deterministic nature of system clock.
*/
static MockTicker newMockTicker() {
return new DefaultMockTicker();
}
/**
* The initial value used for delay and computations based upon a monotonic time source.
* @return initial value used for delay and computations based upon a monotonic time source.
*/
long initialNanoTime();
/**
* The time elapsed since initialization of this class in nanoseconds. This may return a negative number just like
* {@link System#nanoTime()}.
*/
long nanoTime();
/**
* Waits until the given amount of time goes by.
*
* @param delay the amount of delay.
* @param unit the {@link TimeUnit} of {@code delay}.
*
* @see Thread#sleep(long)
*/
void sleep(long delay, TimeUnit unit) throws InterruptedException;
/**
* Waits until the given amount of time goes by.
*
* @param delayMillis the number of milliseconds.
*
* @see Thread#sleep(long)
*/
default void sleepMillis(long delayMillis) throws InterruptedException {
sleep(delayMillis, TimeUnit.MILLISECONDS);
}
}
Source
Frequently Asked Questions
What is the Ticker type?
Ticker is a type/interface in the netty codebase, defined in common/src/main/java/io/netty/util/concurrent/Ticker.java.
Where is Ticker defined?
Ticker is defined in common/src/main/java/io/netty/util/concurrent/Ticker.java at line 23.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free