Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.netty.handler.ssl
Class SslBufferPool

    java.lang.Object
      org.jboss.netty.handler.ssl.SslBufferPool

    public class SslBufferPool

extends Object

A `ByteBuffer` pool dedicated for `SslHandler` performance improvement.

In most cases, you won't need to create a new pool instance because `SslHandler` has a default pool instance internally.

The reason why `SslHandler` requires a buffer pool is because the current `SSLEngine` implementation always requires a 17KiB buffer for every 'wrap' and 'unwrap' operation. In most cases, the actual size of the required buffer is much smaller than that, and therefore allocating a 17KiB buffer for every 'wrap' and 'unwrap' operation wastes a lot of memory bandwidth, resulting in the application performance degradation.

Version:
  $Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $
Author:
  The Netty Project, Trustin Lee

Constructor Summary
`SslBufferPool()` Creates a new buffer pool whose size is `18113536`, which can hold `1024` buffers.
`SslBufferPool(int maxPoolSize)` Creates a new buffer pool.

Method Summary
`int` | `getMaxPoolSize()` Returns the maximum size of this pool in byte unit.
`int` | `getUnacquiredPoolSize()` Returns the number of bytes which were allocated but have not been acquired yet.

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

Constructor Detail

### SslBufferPool

    public SslBufferPool()

  Creates a new buffer pool whose size is `18113536`, which can hold `1024` buffers.

### SslBufferPool

    public SslBufferPool(int maxPoolSize)

  Creates a new buffer pool.

  Parameters:
    `maxPoolSize` - the maximum number of bytes that this pool can hold

Method Detail

### getMaxPoolSize

    public int getMaxPoolSize()

  Returns the maximum size of this pool in byte unit. The returned value can be somewhat different from what was specified in the constructor.

### getUnacquiredPoolSize

    public int getUnacquiredPoolSize()

  Returns the number of bytes which were allocated but have not been acquired yet. You can estimate how optimal the specified maximum pool size is from this value. If it keeps returning `0`, it means the pool is getting exhausted. If it keeps returns a unnecessarily big value, it means the pool is wasting the heap space.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.