## 类的使用
org.redkale.util.ObjectPool

- 使用ObjectPool的程序包
  程序包 | 说明
  --- | ---
  org.redkale.convert.bson | 提供BSON的序列化和反解析功能
  org.redkale.convert.json | 提供JSON的序列化和反解析功能
  org.redkale.net | 网络TCP/UDP基础服务包
  org.redkale.net.http | HTTP协议包,提供HTTP协议服务器
  org.redkale.net.sncp | SNCP协议包,提供SNCP协议服务器

- - ### org.redkale.convert.bson中ObjectPool的使用

    返回ObjectPool的org.redkale.convert.bson中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `static ObjectPool<BsonReader>` | BsonReader.`createPool(int max)`
    `static ObjectPool<BsonWriter>` | BsonWriter.`createPool(int max)`

  - ### org.redkale.convert.json中ObjectPool的使用

    返回ObjectPool的org.redkale.convert.json中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `static ObjectPool<JsonReader>` | JsonReader.`createPool(int max)`
    `static ObjectPool<JsonWriter>` | JsonWriter.`createPool(int max)`

  - ### org.redkale.net中ObjectPool的使用

    声明为ObjectPool的org.redkale.net中的字段
    限定符和类型 | 字段和说明
    --- | ---
    `protected ObjectPool<java.nio.ByteBuffer>` | Context.`bufferPool`
    `protected ObjectPool<java.nio.ByteBuffer>` | Transport.`bufferPool`
    `protected ObjectPool<Response>` | Context.`responsePool`

    参数类型为ObjectPool的org.redkale.net中的构造器
    构造器和说明
    `Context(long serverStartTime, java.util.logging.Logger logger, java.util.concurrent.ExecutorService executor, int bufferCapacity, ObjectPool<java.nio.ByteBuffer> bufferPool, ObjectPool<Response> responsePool, int maxbody, java.nio.charset.Charset charset, java.net.InetSocketAddress address, PrepareServlet prepare, WatchFactory watch, int readTimeoutSecond, int writeTimeoutSecond)`
    `Context(long serverStartTime, java.util.logging.Logger logger, java.util.concurrent.ExecutorService executor, int bufferCapacity, ObjectPool<java.nio.ByteBuffer> bufferPool, ObjectPool<Response> responsePool, int maxbody, java.nio.charset.Charset charset, java.net.InetSocketAddress address, PrepareServlet prepare, WatchFactory watch, int readTimeoutSecond, int writeTimeoutSecond)`
    `Transport(java.lang.String name, java.lang.String protocol, WatchFactory watch, ObjectPool<java.nio.ByteBuffer> transportBufferPool, java.nio.channels.AsynchronousChannelGroup transportChannelGroup, java.net.InetSocketAddress clientAddress, java.util.Collection<java.net.InetSocketAddress> addresses)`
    `Transport(java.lang.String name, WatchFactory watch, ObjectPool<java.nio.ByteBuffer> transportBufferPool, java.nio.channels.AsynchronousChannelGroup transportChannelGroup, java.net.InetSocketAddress clientAddress, java.util.Collection<java.net.InetSocketAddress> addresses)`

  - ### org.redkale.net.http中ObjectPool的使用

    返回ObjectPool的org.redkale.net.http中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `static ObjectPool<Response>` | HttpResponse.`createPool(java.util.concurrent.atomic.AtomicLong creatCounter, java.util.concurrent.atomic.AtomicLong cycleCounter, int max, Creator<Response> creator)`
    `protected ObjectPool<Response>` | HttpContext.`getResponsePool()`

    参数类型为ObjectPool的org.redkale.net.http中的构造器
    构造器和说明
    `HttpContext(long serverStartTime, java.util.logging.Logger logger, java.util.concurrent.ExecutorService executor, int bufferCapacity, ObjectPool<java.nio.ByteBuffer> bufferPool, ObjectPool<Response> responsePool, int maxbody, java.nio.charset.Charset charset, java.net.InetSocketAddress address, PrepareServlet prepare, WatchFactory watch, int readTimeoutSecond, int writeTimeoutSecond)`
    `HttpContext(long serverStartTime, java.util.logging.Logger logger, java.util.concurrent.ExecutorService executor, int bufferCapacity, ObjectPool<java.nio.ByteBuffer> bufferPool, ObjectPool<Response> responsePool, int maxbody, java.nio.charset.Charset charset, java.net.InetSocketAddress address, PrepareServlet prepare, WatchFactory watch, int readTimeoutSecond, int writeTimeoutSecond)`

  - ### org.redkale.net.sncp中ObjectPool的使用

    返回ObjectPool的org.redkale.net.sncp中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `static ObjectPool<Response>` | SncpResponse.`createPool(java.util.concurrent.atomic.AtomicLong creatCounter, java.util.concurrent.atomic.AtomicLong cycleCounter, int max, Creator<Response> creator)`

    参数类型为ObjectPool的org.redkale.net.sncp中的构造器
    构造器和说明
    `SncpContext(long serverStartTime, java.util.logging.Logger logger, java.util.concurrent.ExecutorService executor, int bufferCapacity, ObjectPool<java.nio.ByteBuffer> bufferPool, ObjectPool<Response> responsePool, int maxbody, java.nio.charset.Charset charset, java.net.InetSocketAddress address, PrepareServlet prepare, WatchFactory watch, int readTimeoutSecond, int writeTimeoutSecond)`
    `SncpContext(long serverStartTime, java.util.logging.Logger logger, java.util.concurrent.ExecutorService executor, int bufferCapacity, ObjectPool<java.nio.ByteBuffer> bufferPool, ObjectPool<Response> responsePool, int maxbody, java.nio.charset.Charset charset, java.net.InetSocketAddress address, PrepareServlet prepare, WatchFactory watch, int readTimeoutSecond, int writeTimeoutSecond)`