net.i2p.router.tunnel.pool

## Class PooledTunnelCreatorConfig

- java.lang.Object
- - net.i2p.router.tunnel.TunnelCreatorConfig
  - - net.i2p.router.tunnel.pool.PooledTunnelCreatorConfig

- All Implemented Interfaces:
    TunnelInfo

      public class PooledTunnelCreatorConfig
      extends TunnelCreatorConfig

  Data about a tunnel we created

- - ### Field Summary

    - ### Fields inherited from class net.i2p.router.tunnel.TunnelCreatorConfig

      `_context, MAX_CONSECUTIVE_TEST_FAILURES, REPLY_IV_LENGTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PooledTunnelCreatorConfig(RouterContext ctx, int length, boolean isInbound, Hash destination, TunnelPool pool)` Creates a new instance of PooledTunnelCreatorConfig

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearLastResort()` Clear the last resort status - tunnel has recovered or been replaced.
    `Properties` | `getOptions()`
    `TunnelId` | `getPairedGW()` The ID of the gateway of the paired tunnel used to send/receive the build request
    `TunnelPool` | `getTunnelPool()`
    `boolean` | `isLastResort()` Check if this tunnel is the last resort (only tunnel in pool).
    `boolean` | `isRecentlyActive(long maxIdleMs)` Check if this tunnel has been recently active (used within the last minute or has processed messages since last check).
    `void` | `recordActivity()` Record that this tunnel was selected/used.
    `void` | `setLastResort()` Mark this tunnel as the last resort - the only tunnel remaining in the pool.
    `void` | `setPairedGW(TunnelId gw)` The ID of the gateway of the paired tunnel used to send/receive the build request
    `void` | `testJobSuccessful(int ms)` called from TestJob
    `boolean` | `tunnelFailed()` The tunnel failed a test, so (maybe) stop using it
    `void` | `tunnelFailedFirstHop()` We failed to contact the first hop for an outbound tunnel, so immediately stop using it.

    - ### Methods inherited from class net.i2p.router.tunnel.TunnelCreatorConfig

      `getAESReplyIV, getAESReplyKey, getBlankHash, getChaChaReplyAD, getChaChaReplyKey, getConfig, getConsecutiveFailures, getDestination, getEndpoint, getExpiration, getFarEnd, getGarlicReplyKeys, getGateway, getLastLatency, getLength, getPeer, getPriority, getProcessedMessagesCount, getReceiveTunnelId, getReplyMessageId, getReplyOrder, getSendTunnelId, getTestStatus, getTunnelFailed, getTunnelFailures, getVerifiedBytesTransferred, incrementProcessedMessages, incrementVerifiedBytesTransferred, isDuplicate, isEC, isInbound, setAESReplyKeys, setBlankHash, setChaChaReplyKeys, setDuplicate, setExpiration, setGarlicReplyKeys, setPeer, setPriority, setReplyMessageId, setReplyOrder, setReused, setTestFailed, setTestStarted, testSuccessful, toString, toStringFull, tunnelFailedCompletely, wasReused`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PooledTunnelCreatorConfig

          public PooledTunnelCreatorConfig(RouterContext ctx,
                                           int length,
                                           boolean isInbound,
                                           Hash destination,
                                           TunnelPool pool)

      Creates a new instance of PooledTunnelCreatorConfig
      Parameters:
        `destination` - may be null
        `pool` - non-null

  - ### Method Detail

    - #### clearLastResort

          public void clearLastResort()

      Clear the last resort status - tunnel has recovered or been replaced.

    - #### getOptions

          public Properties getOptions()

      Overrides:
        `getOptions` in class `TunnelCreatorConfig`
      Returns:
        non-null

    - #### getPairedGW

          public TunnelId getPairedGW()

      The ID of the gateway of the paired tunnel used to send/receive the build request
      Returns:
        for paired inbound, the GW rcv tunnel ID; for paired outbound, the GW send tunnel ID. null if not previously set

    - #### getTunnelPool

          public TunnelPool getTunnelPool()

      Returns:
        non-null

    - #### isLastResort

          public boolean isLastResort()

      Check if this tunnel is the last resort (only tunnel in pool).
      Returns:
        true if this is the last remaining tunnel

    - #### isRecentlyActive

          public boolean isRecentlyActive(long maxIdleMs)

      Check if this tunnel has been recently active (used within the last minute or has processed messages since last check).
      Parameters:
        `maxIdleMs` - maximum idle time in milliseconds
      Returns:
        true if tunnel is actively being used

    - #### recordActivity

          public void recordActivity()

      Record that this tunnel was selected/used. Called by TunnelPool when tunnel is selected.

    - #### setLastResort

          public void setLastResort()

      Mark this tunnel as the last resort - the only tunnel remaining in the pool. It should not be removed until a replacement is built.

    - #### setPairedGW

          public void setPairedGW(TunnelId gw)

      The ID of the gateway of the paired tunnel used to send/receive the build request
      Parameters:
        `gw` - for paired inbound, the GW rcv tunnel ID; for paired outbound, the GW send tunnel ID.

    - #### testJobSuccessful

          public void testJobSuccessful(int ms)

      called from TestJob

    - #### tunnelFailed

          public boolean tunnelFailed()

      The tunnel failed a test, so (maybe) stop using it
      Overrides:
        `tunnelFailed` in class `TunnelCreatorConfig`
      Returns:
        false if we stopped using it, true if still ok

    - #### tunnelFailedFirstHop

          public void tunnelFailedFirstHop()

      We failed to contact the first hop for an outbound tunnel, so immediately stop using it. For outbound non-zero-hop tunnels only.