org.apache.ignite.internal.util.nio

## Class GridNioServer.Builder<T>

- java.lang.Object
- - org.apache.ignite.internal.util.nio.GridNioServer.Builder<T>

Enclosing class:
  GridNioServer<T>

    public static class GridNioServer.Builder<T>
    extends Object

Constructs a new instance of `GridNioServer`.

### Constructor Summary

Constructors
Constructor and Description
`Builder()`

### Method Summary

All Methods Instance Methods Concrete Methods
`GridNioServer.Builder<T>` `address(InetAddress addr)`
`GridNioServer<T>` `build()` Finishes building the instance.
`GridNioServer.Builder<T>` `byteOrder(ByteOrder byteOrder)`
`GridNioServer.Builder<T>` `daemon(boolean daemon)`
`GridNioServer.Builder<T>` `directBuffer(boolean directBuf)`
`GridNioServer.Builder<T>` `directMode(boolean directMode)`
`GridNioServer.Builder<T>` `filters(GridNioFilter... filters)`
`GridNioServer.Builder<T>` `idleTimeout(long idleTimeout)`
`GridNioServer.Builder<T>` `igniteInstanceName(String igniteInstanceName)`
`GridNioServer.Builder<T>` `listener(GridNioServerListener<T> lsnr)`
`GridNioServer.Builder<T>` `logger(IgniteLogger log)`
`GridNioServer.Builder<T>` `messageQueueSizeListener(IgniteBiInClosure<GridNioSession,Integer> msgQueueLsnr)`
`GridNioServer.Builder<T>` `metricsListener(GridNioMetricsListener metricsLsnr)`
`GridNioServer.Builder<T>` `port(int port)`
`GridNioServer.Builder<T>` `readWriteSelectorsAssign(boolean readWriteSelectorsAssign)`
`GridNioServer.Builder<T>` `selectorCount(int selectorCnt)`
`GridNioServer.Builder<T>` `selectorSpins(long selectorSpins)`
`GridNioServer.Builder<T>` `sendQueueLimit(int sndQueueLimit)`
`GridNioServer.Builder<T>` `serverName(String srvName)`
`GridNioServer.Builder<T>` `skipRecoveryPredicate(IgnitePredicate<Message> skipRecoveryPred)`
`GridNioServer.Builder<T>` `socketReceiveBufferSize(int sockRcvBufSize)`
`GridNioServer.Builder<T>` `socketSendBufferSize(int sockSndBufSize)`
`GridNioServer.Builder<T>` `tcpNoDelay(boolean tcpNoDelay)`
`GridNioServer.Builder<T>` `writerFactory(GridNioMessageWriterFactory writerFactory)`
`GridNioServer.Builder<T>` `writeTimeout(long writeTimeout)`

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

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

### Constructor Detail

#### Builder

    public Builder()

### Method Detail

#### build

    public GridNioServer<T> build()
                           throws IgniteCheckedException

Finishes building the instance.

Returns:
  Final instance of `GridNioServer`.
Throws:
  `IgniteCheckedException` - If NIO client worker creation failed or address is already in use.

#### readWriteSelectorsAssign

    public GridNioServer.Builder<T> readWriteSelectorsAssign(boolean readWriteSelectorsAssign)

Parameters:
  `readWriteSelectorsAssign` - `True` to assign in/out connections even/odd workers.
Returns:
  This for chaining.

#### address

    public GridNioServer.Builder<T> address(InetAddress addr)

Parameters:
  `addr` - Local address.
Returns:
  This for chaining.

#### port

    public GridNioServer.Builder<T> port(int port)

Parameters:
  `port` - Local port. If `-1` passed then server will not be accepting connections and only outgoing connections will be possible.
Returns:
  This for chaining.

#### logger

    public GridNioServer.Builder<T> logger(IgniteLogger log)

Parameters:
  `log` - Logger.
Returns:
  This for chaining.

#### selectorCount

    public GridNioServer.Builder<T> selectorCount(int selectorCnt)

Parameters:
  `selectorCnt` - Selector count.
Returns:
  This for chaining.

#### igniteInstanceName

    public GridNioServer.Builder<T> igniteInstanceName(@Nullable
                                                       String igniteInstanceName)

Parameters:
  `igniteInstanceName` - Ignite instance name.
Returns:
  This for chaining.

#### serverName

    public GridNioServer.Builder<T> serverName(@Nullable
                                               String srvName)

Parameters:
  `srvName` - Logical server name for threads identification.
Returns:
  This for chaining.

#### selectorSpins

    public GridNioServer.Builder<T> selectorSpins(long selectorSpins)

Parameters:
  `selectorSpins` - Defines how many non-blocking `selector.selectNow()` should be made before falling into `selector.select(long)` in NIO server. Long value. Default is `0`. Can be set to `Long.MAX_VALUE` so selector threads will never block.
Returns:
  This for chaining.

#### tcpNoDelay

    public GridNioServer.Builder<T> tcpNoDelay(boolean tcpNoDelay)

Parameters:
  `tcpNoDelay` - If TCP_NODELAY option should be set to accepted sockets.
Returns:
  This for chaining.

#### directBuffer

    public GridNioServer.Builder<T> directBuffer(boolean directBuf)

Parameters:
  `directBuf` - Whether to use direct buffer.
Returns:
  This for chaining.

#### byteOrder

    public GridNioServer.Builder<T> byteOrder(ByteOrder byteOrder)

Parameters:
  `byteOrder` - Byte order to use.
Returns:
  This for chaining.

#### listener

    public GridNioServer.Builder<T> listener(GridNioServerListener<T> lsnr)

Parameters:
  `lsnr` - NIO server listener.
Returns:
  This for chaining.

#### socketSendBufferSize

    public GridNioServer.Builder<T> socketSendBufferSize(int sockSndBufSize)

Parameters:
  `sockSndBufSize` - Socket send buffer size.
Returns:
  This for chaining.

#### socketReceiveBufferSize

    public GridNioServer.Builder<T> socketReceiveBufferSize(int sockRcvBufSize)

Parameters:
  `sockRcvBufSize` - Socket receive buffer size.
Returns:
  This for chaining.

#### sendQueueLimit

    public GridNioServer.Builder<T> sendQueueLimit(int sndQueueLimit)

Parameters:
  `sndQueueLimit` - Send queue limit.
Returns:
  This for chaining.

#### directMode

    public GridNioServer.Builder<T> directMode(boolean directMode)

Parameters:
  `directMode` - Whether direct mode is used.
Returns:
  This for chaining.

#### metricsListener

    public GridNioServer.Builder<T> metricsListener(GridNioMetricsListener metricsLsnr)

Parameters:
  `metricsLsnr` - Metrics listener.
Returns:
  This for chaining.

#### filters

    public GridNioServer.Builder<T> filters(GridNioFilter... filters)

Parameters:
  `filters` - NIO filters.
Returns:
  This for chaining.

#### idleTimeout

    public GridNioServer.Builder<T> idleTimeout(long idleTimeout)

Parameters:
  `idleTimeout` - Idle timeout.
Returns:
  This for chaining.

#### writeTimeout

    public GridNioServer.Builder<T> writeTimeout(long writeTimeout)

Parameters:
  `writeTimeout` - Write timeout.
Returns:
  This for chaining.

#### daemon

    public GridNioServer.Builder<T> daemon(boolean daemon)

Parameters:
  `daemon` - Daemon flag to create threads.
Returns:
  This for chaining.

#### writerFactory

    public GridNioServer.Builder<T> writerFactory(GridNioMessageWriterFactory writerFactory)

Parameters:
  `writerFactory` - Writer factory.
Returns:
  This for chaining.

#### skipRecoveryPredicate

    public GridNioServer.Builder<T> skipRecoveryPredicate(IgnitePredicate<Message> skipRecoveryPred)

Parameters:
  `skipRecoveryPred` - Skip recovery predicate.
Returns:
  This for chaining.

#### messageQueueSizeListener

    public GridNioServer.Builder<T> messageQueueSizeListener(IgniteBiInClosure<GridNioSession,Integer> msgQueueLsnr)

Parameters:
  `msgQueueLsnr` - Message queue size listener.
Returns:
  Instance of this builder for chaining.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.4.0
Release Date | : March 5 2018