APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.net.http.common

public final Class TimeSource

extends Object
implements TimeLine
Class Inheritance
All Implemented Interfaces
jdk.internal.net.http.common.TimeLine
Imports
java.time.Instant

A TimeLine based on System#nanoTime() for the purpose of handling timeouts. This time source is intentionally not based on the system clock, in order to not be sensitive to clock skews caused by changes to the wall clock. Consequently, callers should use instants returned by this time source solely for the purpose of comparing them with other instants returned by this same time source. The granularity of instants returned is identical to the granularity of System#nanoTime(). This time source has the same property of monotonicity than the System#nanoTime() it is based on.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private TimeSource.NanoSource
private static volatile TimeSource.NanoSource
private static final TimeSource

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Deadline
instant()

Implements jdk.internal.net.http.common.TimeLine.instant.

Returns the current instant on this alternative timeline.

public static Deadline

Returns:

the current instant obtained from the time source
now
()

Returns the current instant obtained from the time source.

public static TimeSource

Returns:

the time source
source
()

Returns the time source.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

localSourceback to summary
private TimeSource.NanoSource localSource
nanoSourceback to summary
private static volatile TimeSource.NanoSource nanoSource
SOURCEback to summary
private static final TimeSource SOURCE

Constructor Detail

TimeSourceback to summary
private TimeSource()

Method Detail

instantback to summary
public Deadline instant()

Implements jdk.internal.net.http.common.TimeLine.instant.

Doc from jdk.internal.net.http.common.TimeLine.instant.

Returns the current instant on this alternative timeline.

Annotations
@Override
nowback to summary
public static Deadline now()

Returns the current instant obtained from the time source. This is equivalent to calling:

TimeSource.source().instant();
TimeSource.source().instant();
Returns:Deadline

the current instant obtained from the time source

sourceback to summary
public static TimeSource source()

Returns the time source.

Returns:TimeSource

the time source

jdk.internal.net.http.common back to summary

private final Class TimeSource.NanoSource

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Instant
pack-priv final long
pack-priv static final long

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
NanoSource(Instant first, long firstNanos)

Method Summary

Modifier and TypeMethod and Description
pack-priv long
delay(long nanos)

pack-priv Deadline
instant(long nanos)

pack-priv Deadline
instant(long nanos, long delay)

pack-priv boolean
isInWindow(long delay)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

firstback to summary
pack-priv final Instant first
firstNanosback to summary
pack-priv final long firstNanos
TIME_WINDOWback to summary
pack-priv static final long TIME_WINDOW

Constructor Detail

NanoSourceback to summary
pack-priv NanoSource()
NanoSourceback to summary
pack-priv NanoSource(Instant first, long firstNanos)

Method Detail

delayback to summary
pack-priv long delay(long nanos)
instantback to summary
pack-priv Deadline instant(long nanos)
instantback to summary
pack-priv Deadline instant(long nanos, long delay)
isInWindowback to summary
pack-priv boolean isInWindow(long delay)