org.jacorb.orb

Class BufferManager

public final class BufferManager extends Object

A BufferManager is used to share a pool of buffers and to implement a buffer allocation policy. This reduces the number of memory allocations and deallocations and the overall memory footprint. Buffers are generally created on demand. The BufferManager uses a singleton pattern, so will only be a single shared BuffferManager across all ORBs in a process.

Version: $Id: BufferManager.java,v 1.26 2006/07/20 13:18:20 alphonse.bendt Exp $

Author: Gerald Brose, FU Berlin

Method Summary
static voidconfigure(Configuration configuration)
configures the BufferManager, in turn configures the singleton.
byte[]getBuffer(int initial)
byte[]getBuffer(int initial, boolean cdrStr)
getBuffer returns a new buffer.
static BufferManagergetInstance()
May only be called after configure()
byte[]getPreferredMemoryBuffer()
voidrelease()
voidreturnBuffer(byte[] current)
voidreturnBuffer(byte[] current, boolean cdrStr)
Describe returnBuffer method here.

Method Detail

configure

public static void configure(Configuration configuration)
configures the BufferManager, in turn configures the singleton. Must be called before getInstance() !

getBuffer

public byte[] getBuffer(int initial)

getBuffer

public byte[] getBuffer(int initial, boolean cdrStr)
getBuffer returns a new buffer.

Parameters: initial an int value cdrStr a boolean value to denote if CDROuputStream is caller (may use cache in this situation)

Returns: a byte[] value

getInstance

public static BufferManager getInstance()
May only be called after configure()

Throws: BAD_INV_ORDER if not previously configured

getPreferredMemoryBuffer

public byte[] getPreferredMemoryBuffer()

release

public void release()

returnBuffer

public void returnBuffer(byte[] current)

returnBuffer

public void returnBuffer(byte[] current, boolean cdrStr)
Describe returnBuffer method here.

Parameters: current a byte[] value cdrStr a boolean value value to denote if CDROuputStream is caller (may use cache in this situation)