Top Description Inners Fields Constructors Methods
com.sun.webkit.network

pack-priv final Class ByteBufferPool

Additional top-level class in compilation unit: ByteBufferAllocator.

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer, java.util.Queue, java.util.concurrent.ConcurrentLinkedQueue, .Semaphore

A pool of byte buffers that can be shared by multiple concurrent clients.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
ByteBufferPool.ByteBufferAllocatorImpl

The allocator implementation.

Field Summary

Modifier and TypeField and Description
private final int
bufferSize

The size of each byte buffer.

private final Queue<ByteBuffer>
byteBuffers

The shared collection of byte buffers.

Constructor Summary

AccessConstructor and Description
private
ByteBufferPool(int bufferSize)

Creates a new pool.

Method Summary

Modifier and TypeMethod and Description
pack-priv ByteBufferAllocator
newAllocator(int maxBufferCount)

Creates a new allocator associated with this pool.

pack-priv static ByteBufferPool
newInstance(int bufferSize)

Creates a new pool.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferSizeback to summary
private final int bufferSize

The size of each byte buffer.

byteBuffersback to summary
private final Queue<ByteBuffer> byteBuffers

The shared collection of byte buffers.

Constructor Detail

ByteBufferPoolback to summary
private ByteBufferPool(int bufferSize)

Creates a new pool.

Method Detail

newAllocatorback to summary
pack-priv ByteBufferAllocator newAllocator(int maxBufferCount)

Creates a new allocator associated with this pool. The allocator will allow its client to allocate and release buffers and will ensure that there are no more than maxBufferCount buffers allocated through this allocator at any given time moment.

newInstanceback to summary
pack-priv static ByteBufferPool newInstance(int bufferSize)

Creates a new pool.

com.sun.webkit.network back to summary

private final Class ByteBufferPool.ByteBufferAllocatorImpl

extends Object
implements ByteBufferAllocator
Class Inheritance
  • java.lang.Object
  • com.sun.webkit.network.ByteBufferPool.ByteBufferAllocatorImpl
All Implemented Interfaces
com.sun.webkit.network.ByteBufferAllocator

The allocator implementation.

Field Summary

Modifier and TypeField and Description
private final Semaphore
semaphore

The semaphore used to limit the number of buffers allocated through this allocator.

Constructor Summary

AccessConstructor and Description
private
ByteBufferAllocatorImpl(int maxBufferCount)

Creates a new allocator.

Method Summary

Modifier and TypeMethod and Description
public ByteBuffer
allocate()

Implements com.sun.webkit.network.ByteBufferAllocator.allocate.

Allocates a byte buffer.

public void
release(ByteBuffer byteBuffer)

Implements com.sun.webkit.network.ByteBufferAllocator.release.

Releases a byte buffer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

semaphoreback to summary
private final Semaphore semaphore

The semaphore used to limit the number of buffers allocated through this allocator.

Constructor Detail

ByteBufferAllocatorImplback to summary
private ByteBufferAllocatorImpl(int maxBufferCount)

Creates a new allocator.

Method Detail

allocateback to summary
public ByteBuffer allocate() throws InterruptedException

Implements com.sun.webkit.network.ByteBufferAllocator.allocate.

Doc from com.sun.webkit.network.ByteBufferAllocator.allocate.

Allocates a byte buffer.

Annotations
@Override
releaseback to summary
public void release(ByteBuffer byteBuffer)

Implements com.sun.webkit.network.ByteBufferAllocator.release.

Doc from com.sun.webkit.network.ByteBufferAllocator.release.

Releases a byte buffer.

Annotations
@Override