Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

idleExpiryManager


Currently, we have an idleExpiryManager that uses the LRU algorithm evicting the oldest idle connected socket channels. Similarly, we can instantiate a new LinkedHashMap to keep those socket channels initiating the connection and evict the timeout channels.

...

Currently, all the channels will be kept on the same LRU map. We will split the connected socket channels and connecting socket channels into different LRU map (we will call them "lruConnectingConnections" and "lruConnectedConnections" later).


Here's the state transition:

When the socket channel is initiating the connection, we will put the socket channel to the lruConnectingConnections.

When the connection is successfully built, we will move the channel from lruConnectingConnections from lruConnectingConnections into lruConnectedConnections.

In each selector poll, we will remove the oldest timeout socket channel in both lruConnectingConnections both lruConnectingConnections and lruConnectedConnections, if possible.

LeastLoadedNodeProvider

...