## net.i2p.router
Class InNetMessagePool

    java.lang.Object
      net.i2p.router.InNetMessagePool

All Implemented Interfaces:
  Service

    public class InNetMessagePool

extends Object
implements Service

Manage a pool of inbound InNetMessages. This pool is filled by the Network communication system when it receives messages, and various jobs periodically retrieve them for processing.

Field Summary
`static boolean` `DEFAULT_DISPATCH_THREADED`
`static String` `PROP_DISPATCH_THREADED` If set to true, we will have two additional threads - one for dispatching tunnel data messages, and another for dispatching tunnel gateway messages.

Constructor Summary
`InNetMessagePool(RouterContext context)`

Method Summary
`int` `add(I2NPMessage messageBody, RouterIdentity fromRouter, Hash fromRouterHash)` Add a new message to the pool.
`int` `handleReplies(I2NPMessage messageBody)`
`HandlerJobBuilder` `registerHandlerJobBuilder(int i2npMessageType, HandlerJobBuilder builder)`
`void` `renderStatusHTML(Writer out)`
`void` `restart()` Perform a soft restart.
`void` `shutdown()` Instruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully.
`void` `startup()` Instruct the service that it should start normal operation.
`HandlerJobBuilder` `unregisterHandlerJobBuilder(int i2npMessageType)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PROP_DISPATCH_THREADED

    public static final String PROP_DISPATCH_THREADED

  If set to true, we will have two additional threads - one for dispatching tunnel data messages, and another for dispatching tunnel gateway messages. These will not use the JobQueue but will operate sequentially. Otherwise, if this is set to false, the messages will be queued up in the jobQueue, using the jobQueue's single thread.

  See Also:
    Constant Field Values

### DEFAULT_DISPATCH_THREADED

    public static final boolean DEFAULT_DISPATCH_THREADED

See Also:
  Constant Field Values

Constructor Detail

### InNetMessagePool

    public InNetMessagePool(RouterContext context)

Method Detail

### registerHandlerJobBuilder

    public HandlerJobBuilder registerHandlerJobBuilder(int i2npMessageType,
                                                       HandlerJobBuilder builder)

  Returns:
    previous builder for this message type, or null
  Throws:
    `AIOOBE` - if i2npMessageType is greater than MAX_I2NP_MESSAGE_TYPE

### unregisterHandlerJobBuilder

    public HandlerJobBuilder unregisterHandlerJobBuilder(int i2npMessageType)

  Returns:
    previous builder for this message type, or null
  Throws:
    `AIOOBE` - if i2npMessageType is greater than MAX_I2NP_MESSAGE_TYPE

### add

    public int add(I2NPMessage messageBody,
                   RouterIdentity fromRouter,
                   Hash fromRouterHash)

  Add a new message to the pool. If there is a HandlerJobBuilder for the inbound message type, the message is loaded into a job created by that builder and queued up for processing instead (though if the builder doesn't create a job, it is added to the pool)

  Returns:
    -1 for some types of errors but not all; 0 otherwise (was queue length, long ago)

### handleReplies

    public int handleReplies(I2NPMessage messageBody)

### renderStatusHTML

    public void renderStatusHTML(Writer out)

  Specified by:
    `renderStatusHTML` in interface `Service`

### restart

    public void restart()

  Description copied from interface: `Service`
  Perform a soft restart.

  Specified by:
    `restart` in interface `Service`

### shutdown

    public void shutdown()

  Description copied from interface: `Service`
  Instruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully. It should not depend on other components at this point. This call DOES block.

  Specified by:
    `shutdown` in interface `Service`

### startup

    public void startup()

  Description copied from interface: `Service`
  Instruct the service that it should start normal operation. This call DOES block until the service is ready.

  Specified by:
    `startup` in interface `Service`