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

pack-priv final Class IdleTimeoutManager

extends Object
Class Inheritance
Imports
java.time.Duration, java.util.Objects, .Optional, java.util.concurrent.CompletableFuture, java.util.concurrent.atomic.AtomicBoolean, .AtomicLong, .AtomicReference, java.util.concurrent.locks.ReentrantLock, java.util.function.Supplier, jdk.internal.net.http.common.Deadline, .Log, .Logger, .TimeLine, jdk.internal.net.http.quic.packets.QuicPacket.PacketNumberSpace, jdk.internal.net.quic.QuicTLSEngine

Keeps track of activity on a QuicConnectionImpl and manages the idle timeout of the QUIC connection

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
pack-priv class
pack-priv class
pack-priv abstract class

Field Summary

Modifier and TypeField and Description
private boolean
private final QuicConnectionImpl
private final Logger
private final ReentrantLock
private final AtomicLong
private IdleTimeoutManager.IdleTimeoutEvent
private volatile long
private long
private static final long
private IdleTimeoutManager.PingEvent
private final AtomicBoolean
private final ReentrantLock
private IdleTimeoutManager.StreamDataBlockedEvent
private final AtomicReference<Supplier<Boolean>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
appLayerMaxIdle(final Duration maxIdle, final Supplier<Boolean> trafficGenerationCheck)

private void
checkUpdateIdleTimeout(final long newIdleTimeoutMillis)

private long
private static void
pack-priv Optional<Long>

Returns:

the idle timeout in milliseconds or empty
getIdleTimeout
()

Returns the idle timeout duration, in milliseconds, negotiated for the connection represented by this IdleTimeoutManager.

private void
pack-priv void
localIdleTimeout(final long timeoutMillis)

pack-priv void
pack-priv void
peerIdleTimeout(final long timeoutMillis)

private void
pack-priv void
pack-priv void
start()

Starts the idle timeout management for the connection.

private void
private void
private void
private void
private void
private void
private TimeLine
pack-priv boolean

Returns:

true if the connection has been successfully reserved. false otherwise; in which case the connection must not be handed out from the pool.
tryReserveForUse
()

Attempts to notify the idle connection management that this connection should be considered "in use".

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

chosenForIdleTerminationback to summary
private boolean chosenForIdleTermination
connectionback to summary
private final QuicConnectionImpl connection
debugback to summary
private final Logger debug
idleTerminationLockback to summary
private final ReentrantLock idleTerminationLock
idleTimeoutDurationMsback to summary
private final AtomicLong idleTimeoutDurationMs
idleTimeoutEventback to summary
private IdleTimeoutManager.IdleTimeoutEvent idleTimeoutEvent
lastPacketActivityNanosback to summary
private volatile long lastPacketActivityNanos
lastUsageReservationNanosback to summary
private long lastUsageReservationNanos
NO_IDLE_TIMEOUTback to summary
private static final long NO_IDLE_TIMEOUT
pingEventback to summary
private IdleTimeoutManager.PingEvent pingEvent
shutdownback to summary
private final AtomicBoolean shutdown
stateLockback to summary
private final ReentrantLock stateLock
streamDataBlockedEventback to summary
private IdleTimeoutManager.StreamDataBlockedEvent streamDataBlockedEvent
trafficGenerationCheckback to summary
private final AtomicReference<Supplier<Boolean>> trafficGenerationCheck

Constructor Detail

IdleTimeoutManagerback to summary
pack-priv IdleTimeoutManager(final QuicConnectionImpl connection)

Method Detail

appLayerMaxIdleback to summary
pack-priv void appLayerMaxIdle(final Duration maxIdle, final Supplier<Boolean> trafficGenerationCheck)
checkUpdateIdleTimeoutback to summary
private void checkUpdateIdleTimeout(final long newIdleTimeoutMillis)
computeInactivityMillisback to summary
private long computeInactivityMillis()
disableTimedEventback to summary
private static void disableTimedEvent(final QuicTimerQueue timer, final IdleTimeoutManager.TimedEvent te)
getIdleTimeoutback to summary
pack-priv Optional<Long> getIdleTimeout()

Returns the idle timeout duration, in milliseconds, negotiated for the connection represented by this IdleTimeoutManager. The negotiated idle timeout of a connection is the minimum of the idle connection timeout that is advertised by the endpoint represented by this IdleTimeoutManager and the idle connection timeout advertised by the peer. If neither endpoints have advertised any idle connection timeout then this method returns an empty value.

Returns:Optional<Long>

the idle timeout in milliseconds or empty

idleTimedOutback to summary
private void idleTimedOut()
localIdleTimeoutback to summary
pack-priv void localIdleTimeout(final long timeoutMillis)
markActiveback to summary
pack-priv void markActive()
peerIdleTimeoutback to summary
pack-priv void peerIdleTimeout(final long timeoutMillis)
requireSuccessfulHandshakeback to summary
private void requireSuccessfulHandshake()
shutdownback to summary
pack-priv void shutdown()
startback to summary
pack-priv void start()

Starts the idle timeout management for the connection. This should be called after the handshake is complete for the connection.

Exceptions
IllegalStateException:
if handshake hasn't yet completed or if the handshake has failed for the connection
startIdleTerminationTimerback to summary
private void startIdleTerminationTimer()
startPingTimerback to summary
private void startPingTimer()
startStreamDataBlockedTimerback to summary
private void startStreamDataBlockedTimer()
stopIdleTerminationTimerback to summary
private void stopIdleTerminationTimer()
stopPingTimerback to summary
private void stopPingTimer()
stopStreamDataBlockedTimerback to summary
private void stopStreamDataBlockedTimer()
timeLineback to summary
private TimeLine timeLine()
tryReserveForUseback to summary
pack-priv boolean tryReserveForUse()

Attempts to notify the idle connection management that this connection should be considered "in use". This way the idle connection management doesn't close this connection during the time the connection is handed out from the pool and any new stream created on that connection.

Returns:boolean

true if the connection has been successfully reserved. false otherwise; in which case the connection must not be handed out from the pool.

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

pack-priv final Class IdleTimeoutManager.IdleTimeoutEvent

extends TimedEvent
Class Inheritance

Field Summary

Inherited from jdk.internal.net.http.quic.IdleTimeoutManager.TimedEvent:
deadlineeventIdnextDeadline

Constructor Summary

AccessConstructor and Description
private
IdleTimeoutEvent(final Deadline deadline)

Method Summary

Modifier and TypeMethod and Description
public Deadline
private Deadline
maybePostponeDeadline(final long expectedIdleDurationMs)

private void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from jdk.internal.net.http.quic.IdleTimeoutManager.TimedEvent:
deadlineeventIdrefreshDeadline

Constructor Detail

IdleTimeoutEventback to summary
private IdleTimeoutEvent(final Deadline deadline)

Method Detail

handleback to summary
public Deadline handle()

Implements abstract jdk.internal.net.http.quic.IdleTimeoutManager.TimedEvent.handle.

Implements jdk.internal.net.http.quic.QuicTimedEvent.handle.

Doc from jdk.internal.net.http.quic.QuicTimedEvent.handle.

Handles the triggered event. Returns a new deadline, if the event needs to be rescheduled, or Deadline.MAX otherwise.

Annotations
@Override
maybePostponeDeadlineback to summary
private Deadline maybePostponeDeadline(final long expectedIdleDurationMs)
terminateNowback to summary
private void terminateNow()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
jdk.internal.net.http.quic back to summary

pack-priv final Class IdleTimeoutManager.PingEvent

extends TimedEvent
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final long
private final long
Inherited from jdk.internal.net.http.quic.IdleTimeoutManager.TimedEvent:
deadlineeventIdnextDeadline

Constructor Summary

AccessConstructor and Description
private
PingEvent(final Deadline deadline, final long pingFrequencyMillis)

Method Summary

Modifier and TypeMethod and Description
public Deadline
private boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from jdk.internal.net.http.quic.IdleTimeoutManager.TimedEvent:
deadlineeventIdrefreshDeadline

Field Detail

idleTimeoutNanosback to summary
private final long idleTimeoutNanos
pingFrequencyNanosback to summary
private final long pingFrequencyNanos

Constructor Detail

PingEventback to summary
private PingEvent(final Deadline deadline, final long pingFrequencyMillis)

Method Detail

handleback to summary
public Deadline handle()

Implements abstract jdk.internal.net.http.quic.IdleTimeoutManager.TimedEvent.handle.

Implements jdk.internal.net.http.quic.QuicTimedEvent.handle.

Doc from jdk.internal.net.http.quic.QuicTimedEvent.handle.

Handles the triggered event. Returns a new deadline, if the event needs to be rescheduled, or Deadline.MAX otherwise.

Annotations
@Override
shouldInitiateAppLayerCheckback to summary
private boolean shouldInitiateAppLayerCheck()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
jdk.internal.net.http.quic back to summary

pack-priv final Class IdleTimeoutManager.StreamDataBlockedEvent

extends TimedEvent
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final long
Inherited from jdk.internal.net.http.quic.IdleTimeoutManager.TimedEvent:
deadlineeventIdnextDeadline

Constructor Summary

AccessConstructor and Description
private
StreamDataBlockedEvent(final Deadline deadline, final long timeoutMillis)

Method Summary

Modifier and TypeMethod and Description
public Deadline
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from jdk.internal.net.http.quic.IdleTimeoutManager.TimedEvent:
deadlineeventIdrefreshDeadline

Field Detail

timeoutMillisback to summary
private final long timeoutMillis

Constructor Detail

StreamDataBlockedEventback to summary
private StreamDataBlockedEvent(final Deadline deadline, final long timeoutMillis)

Method Detail

handleback to summary
public Deadline handle()

Implements abstract jdk.internal.net.http.quic.IdleTimeoutManager.TimedEvent.handle.

Implements jdk.internal.net.http.quic.QuicTimedEvent.handle.

Doc from jdk.internal.net.http.quic.QuicTimedEvent.handle.

Handles the triggered event. Returns a new deadline, if the event needs to be rescheduled, or Deadline.MAX otherwise.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
jdk.internal.net.http.quic back to summary

pack-priv abstract sealed Class IdleTimeoutManager.TimedEvent

extends Object
implements QuicTimedEvent
permits IdleTimeoutEvent, StreamDataBlockedEvent, PingEvent
Class Inheritance
All Implemented Interfaces
jdk.internal.net.http.quic.QuicTimedEvent
Known Direct Subclasses
jdk.internal.net.http.quic.IdleTimeoutManager.IdleTimeoutEvent, jdk.internal.net.http.quic.IdleTimeoutManager.StreamDataBlockedEvent, jdk.internal.net.http.quic.IdleTimeoutManager.PingEvent

Field Summary

Modifier and TypeField and Description
protected volatile Deadline
protected final long
protected volatile Deadline

Constructor Summary

AccessConstructor and Description
private
TimedEvent(final Deadline deadline)

Method Summary

Modifier and TypeMethod and Description
public final Deadline
deadline()

Implements jdk.internal.net.http.quic.QuicTimedEvent.deadline.

Returns the deadline at which the event should be triggered, or Deadline#MAX if the event does not need to be scheduled.

public final long
eventId()

Implements jdk.internal.net.http.quic.QuicTimedEvent.eventId.

An event id, obtained at construction time from QuicTimerQueue#newEventId().

public abstract Deadline
handle()

Redeclares jdk.internal.net.http.quic.QuicTimedEvent.handle.

Handles the triggered event.

public final Deadline
refreshDeadline()

Implements jdk.internal.net.http.quic.QuicTimedEvent.refreshDeadline.

Called to cause an event to refresh its deadline.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

deadlineback to summary
protected volatile Deadline deadline
eventIdback to summary
protected final long eventId
nextDeadlineback to summary
protected volatile Deadline nextDeadline

Constructor Detail

TimedEventback to summary
private TimedEvent(final Deadline deadline)

Method Detail

deadlineback to summary
public final Deadline deadline()

Implements jdk.internal.net.http.quic.QuicTimedEvent.deadline.

Doc from jdk.internal.net.http.quic.QuicTimedEvent.deadline.

Returns the deadline at which the event should be triggered, or Deadline#MAX if the event does not need to be scheduled.

Annotations
@Override
eventIdback to summary
public final long eventId()

Implements jdk.internal.net.http.quic.QuicTimedEvent.eventId.

Doc from jdk.internal.net.http.quic.QuicTimedEvent.eventId.

An event id, obtained at construction time from QuicTimerQueue#newEventId(). This is used to implement a total order among subclasses.

Annotations
@Override
handleback to summary
public abstract Deadline handle()

Redeclares jdk.internal.net.http.quic.QuicTimedEvent.handle.

Doc from jdk.internal.net.http.quic.QuicTimedEvent.handle.

Handles the triggered event. Returns a new deadline, if the event needs to be rescheduled, or Deadline.MAX otherwise.

Annotations
@Override
refreshDeadlineback to summary
public final Deadline refreshDeadline()

Implements jdk.internal.net.http.quic.QuicTimedEvent.refreshDeadline.

Doc from jdk.internal.net.http.quic.QuicTimedEvent.refreshDeadline.

Called to cause an event to refresh its deadline. This method is called by the QuicTimerQueue when rescheduling an event.

Annotations
@Override