CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.io.nio
Class MappedBufferManager

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.io.nio.AbstractBufferManager
          extended by com.tangosol.io.nio.MappedBufferManager
All Implemented Interfaces:
ByteBufferManager

public class MappedBufferManager
extends AbstractBufferManager

Manages a ByteBuffer on a file.

Since:
Coherence 2.2
Author:
cp 2002.09.18
See Also:
ByteBuffer

Field Summary
static int DEFAULT_MAX_SIZE
          Default maximum size for a memory mapped file.
static int DEFAULT_MIN_SIZE
          Default minimum size for a memory mapped file.
 
Constructor Summary
MappedBufferManager()
          Construct a MappedBufferManager using defaults.
MappedBufferManager(int cbInitial, int cbMaximum, File file)
          Construct a MappedBufferManager that supports a buffer of a certain initial and maximum size.
 
Method Summary
protected  void allocateBuffer()
          Allocate a new buffer, copying old data if there is any.
 void close()
          Close the underlying resources.
protected  void configureFile(File file)
          Configure the buffer manager based on the passed file, which may be null to imply a default temp file, a directory to imply that a file be created in that directory, or it may be the temp file itself.
protected  void finalize()
          Perform cleanup during garbage collection.
protected  RandomAccessFile getFile()
          Obtain the RandomAccessFile that the buffer is constructed on.
protected  void setFile(RandomAccessFile file)
          Specify the RandomAccessFile that the buffer will be constructed on.
 
Methods inherited from class com.tangosol.io.nio.AbstractBufferManager
calibrate, getBuffer, getCapacity, getGrowthThreshold, getMaxCapacity, getMaxIncrement, getMinCapacity, getShrinkageThreshold, grow, setBuffer, setCapacity, setGrowthThreshold, setMaxCapacity, setMinCapacity, setShrinkageThreshold, shrink
 

Field Detail

DEFAULT_MIN_SIZE

public static final int DEFAULT_MIN_SIZE
Default minimum size for a memory mapped file.

See Also:
Constant Field Values

DEFAULT_MAX_SIZE

public static final int DEFAULT_MAX_SIZE
Default maximum size for a memory mapped file.

See Also:
Constant Field Values
Constructor Detail

MappedBufferManager

public MappedBufferManager()
Construct a MappedBufferManager using defaults.


MappedBufferManager

public MappedBufferManager(int cbInitial,
                           int cbMaximum,
                           File file)
Construct a MappedBufferManager that supports a buffer of a certain initial and maximum size.

Parameters:
cbInitial - the initial size
cbMaximum - the maximum size
file - the file to use, or the directory to use, or null to generate a temporary file in the default location
Method Detail

configureFile

protected void configureFile(File file)
Configure the buffer manager based on the passed file, which may be null to imply a default temp file, a directory to imply that a file be created in that directory, or it may be the temp file itself.

Parameters:
file - the file to use, or the directory to use, or null to generate a temporary file in the default location

getFile

protected RandomAccessFile getFile()
Obtain the RandomAccessFile that the buffer is constructed on.

Returns:
the RandomAccessFile object

setFile

protected void setFile(RandomAccessFile file)
Specify the RandomAccessFile that the buffer will be constructed on.

Parameters:
file - the RandomAccessFile object

allocateBuffer

protected void allocateBuffer()
Allocate a new buffer, copying old data if there is any.

Specified by:
allocateBuffer in class AbstractBufferManager
See Also:
FileChannel.map()

close

public void close()
Close the underlying resources.


finalize

protected void finalize()
Perform cleanup during garbage collection.


CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation