org.redkale.net

## 类 Server<K extends java.io.Serializable,C extends Context,R extends Request<C>,P extends Response<C,R>,S extends Servlet<C,R,P>>

- java.lang.Object
- - org.redkale.net.Server<K,C,R,P,S>

- 类型参数:
    `K` - 请求ID的数据类型， 例如HTTP协议请求标识为url，请求ID的数据类型就是String
    `C` - Context
    `R` - Request
    `P` - Response
    `S` - Servlet
  直接已知子类:
    HttpServer, SncpServer

      public abstract class Server<K extends java.io.Serializable,C extends Context,R extends Request<C>,P extends Response<C,R>,S extends Servlet<C,R,P>>
      extends java.lang.Object

  详情见: https://redkale.org

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `protected java.net.InetSocketAddress` | `address`
    `protected int` | `backlog`
    `protected int` | `bufferCapacity`
    `protected int` | `bufferPoolSize`
    `protected java.nio.charset.Charset` | `charset`
    `protected AnyValue` | `config`
    `protected C` | `context`
    `protected java.util.concurrent.ExecutorService` | `executor`
    `protected java.util.logging.Logger` | `logger`
    `protected int` | `maxbody`
    `protected java.lang.String` | `name`
    `protected PrepareServlet<K,C,R,P,S>` | `prepare`
    `protected java.lang.String` | `protocol`
    `protected int` | `readTimeoutSecond`
    `static java.lang.String` | `RESNAME_SERVER_ROOT`
    `protected int` | `responsePoolSize`
    `protected ProtocolServer` | `serverChannel`
    `protected long` | `serverStartTime`
    `protected int` | `threads`
    `protected WatchFactory` | `watch`
    `protected int` | `writeTimeoutSecond`

  - ### 构造器概要

    构造器
    限定符 | 构造器和说明
    --- | ---
    `protected` | `Server(long serverStartTime, java.lang.String protocol, PrepareServlet<K,C,R,P,S> servlet, WatchFactory watch)`

  - ### 方法概要

    所有方法 静态方法 实例方法 抽象方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `addServlet(S servlet, java.lang.Object attachment, AnyValue conf, K... mappings)`
    `protected abstract C` | `createContext()`
    `protected java.text.Format` | `createFormat()`
    `void` | `destroy(AnyValue config)`
    `C` | `getContext()`
    `java.util.logging.Logger` | `getLogger()`
    `java.lang.String` | `getName()`
    `PrepareServlet<K,C,R,P,S>` | `getPrepareServlet()`
    `java.lang.String` | `getProtocol()`
    `java.net.InetSocketAddress` | `getSocketAddress()`
    `void` | `init(AnyValue config)`
    `static java.net.URL[]` | `loadLib(java.util.logging.Logger logger, java.lang.String lib)`
    `void` | `shutdown()`
    `void` | `start()`

    - ### 从类继承的方法 java.lang.Object

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

- - ### 字段详细资料

    - #### RESNAME_SERVER_ROOT

          public static final java.lang.String RESNAME_SERVER_ROOT

      另请参阅:
        常量字段值

    - #### logger

          protected final java.util.logging.Logger logger

    - #### serverStartTime

          protected final long serverStartTime

    - #### watch

          protected final WatchFactory watch

    - #### name

          protected java.lang.String name

    - #### protocol

          protected final java.lang.String protocol

    - #### prepare

          protected final PrepareServlet<K extends java.io.Serializable,C extends Context,R extends Request<C>,P extends Response<C,R>,S extends Servlet<C,R,P>> prepare

    - #### context

          protected C extends Context context

    - #### config

          protected AnyValue config

    - #### charset

          protected java.nio.charset.Charset charset

    - #### address

          protected java.net.InetSocketAddress address

    - #### backlog

          protected int backlog

    - #### serverChannel

          protected ProtocolServer serverChannel

    - #### bufferCapacity

          protected int bufferCapacity

    - #### threads

          protected int threads

    - #### executor

          protected java.util.concurrent.ExecutorService executor

    - #### bufferPoolSize

          protected int bufferPoolSize

    - #### responsePoolSize

          protected int responsePoolSize

    - #### maxbody

          protected int maxbody

    - #### readTimeoutSecond

          protected int readTimeoutSecond

    - #### writeTimeoutSecond

          protected int writeTimeoutSecond

  - ### 构造器详细资料

    - #### Server

          protected Server(long serverStartTime,
                           java.lang.String protocol,
                           PrepareServlet<K,C,R,P,S> servlet,
                           WatchFactory watch)

  - ### 方法详细资料

    - #### init

          public void init(AnyValue config)
                    throws java.lang.Exception

      抛出:
        `java.lang.Exception`

    - #### destroy

          public void destroy(AnyValue config)
                       throws java.lang.Exception

      抛出:
        `java.lang.Exception`

    - #### getSocketAddress

          public java.net.InetSocketAddress getSocketAddress()

    - #### getName

          public java.lang.String getName()

    - #### getProtocol

          public java.lang.String getProtocol()

    - #### getLogger

          public java.util.logging.Logger getLogger()

    - #### getPrepareServlet

          public PrepareServlet<K,C,R,P,S> getPrepareServlet()

    - #### getContext

          public C getContext()

    - #### addServlet

          public void addServlet(S servlet,
                                 java.lang.Object attachment,
                                 AnyValue conf,
                                 K... mappings)

    - #### start

          public void start()
                     throws java.io.IOException

      抛出:
        `java.io.IOException`

    - #### createContext

          protected abstract C createContext()

    - #### shutdown

          public void shutdown()
                        throws java.io.IOException

      抛出:
        `java.io.IOException`

    - #### createFormat

          protected java.text.Format createFormat()

    - #### loadLib

          public static java.net.URL[] loadLib(java.util.logging.Logger logger,
                                               java.lang.String lib)
                                        throws java.lang.Exception

      抛出:
        `java.lang.Exception`