Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


com.tangosol.io.journal
Class RamJournalRM

java.lang.Object
  extended by com.tangosol.io.journal.AbstractJournalRM
      extended by com.tangosol.io.journal.RamJournalRM

All Implemented Interfaces:
BinaryStoreManager, ClassLoaderAware, JournalMBean, XmlConfigurable, Controllable, Disposable

public class RamJournalRM
extends AbstractJournalRM

A RamJournalRM manages memory buffers for journal-based storage in memory, and acts as a shared resource for any number of journals that share a common configuration. While the RamJournalRM can be used by itself, it is intended to be used with a FlashJournalRM instance: So that large objects can be stored using flash; to allow for spill-over when the amount of total memory allocated to the RAM journal is used; and to handle the case when the journal "garbage collection" is temporarily not able to keep up with demand.

To use the Resource Manager, configure it (either by XML using configure(XmlElement), or by calling the appropriate setter methods such as setFlashJournalRM(FlashJournalRM)). Once configured, start the Resource Manager via the AbstractJournalRM.start() method, and then obtain BinaryStore instances via the AbstractJournalRM.createBinaryStore() method. When a BinaryStore instance is no longer required, dispose of it via the Disposable interface, and similarly stop() or AbstractJournalRM.dispose() of the Resource Manager when it is no longer needed to ensure that any resources it allocated are cleaned up and released.

The limits on the journal are as follows:

Note that with a flash journal backing up the RAM journal, the limits have a different meaning:

Note that, outside of the initial configuration, there is no difference in the use of the RAM journal with or without the flash journal; the combination of the RAM journal with the flash journal is transparent to the clients, with the only obvious difference being the significantly reduced possibility of an exception due to the RAM being exhausted.

Since:
Coherence 3.7
Author:
cp/cf 2010-06-24

Nested Class Summary
protected  class RamJournalRM.BufferPool
          A pooling implementation for WriteBuffer objects.
protected  class RamJournalRM.FlashConsumer
          The FlashConsumer is a conduit between this RamJournalRM and the FlashJournalRM, allowing this journal to read/write to/from the other flash journal, and for the flash journal to notify this journal of lifecycle and other events.
protected  class RamJournalRM.JournalFile
          A JournalFile is created for each RAM buffer used to store the journal contents.
protected  class RamJournalRM.JournalImpl
          A Journal implementation managed by this Journal Resource Manager.

 

Nested classes/interfaces inherited from class com.tangosol.io.journal.AbstractJournalRM
AbstractJournalRM.CollectorDaemon

 

Field Summary
static double DFT_COLLECT_PCT
          Default collection factor (collect files that are 84% or less utilized).
static long DFT_FILE_SIZE
          Default size of a "file" i.e. a buffer (2MB).
static long DFT_POOL_SIZE
          Default pool size (16MB).
static long DFT_TOTAL_SIZE
          Default total size of RAM used (1GB).
static int DFT_VALUE_SIZE
          Default maximum value size (16KB).
protected  long m_cbMaxPool
          The maximum total amount of unused RAM buffers that the journal will pool.
protected  long m_cbMaxRam
          The maximum total amount of RAM that the journal will allocate.
protected  RamJournalRM.FlashConsumer m_flash
          The conduit between this RAM journal resource manager and the flash journal resource manager.
protected  boolean m_fUseNioRam
          The option to use NIO buffers instead of on-heap byte arrays.
protected  FlashJournalRM m_jrnlrm
          A reference to a flash journal resource manager to use to read/write to/from flash for data that doesn't fit in memory.
protected  RamJournalRM.BufferPool m_pool
          The buffer pool.
protected static long MASK_FILE_ID
          The 64-bit bitmask for the file index.
protected static long MASK_LENGTH
          The 64-bit bitmask for the value length.
protected static long MASK_OFFSET
          The 64-bit bitmask for the value offset.
protected static long MASK_RAM_FLAG
          The 64-bit bitmask for the RAM flag.
static long MAX_FILE_SIZE
          Maximum size of a "file" i.e. a buffer (2GB).
static long MAX_POOL_SIZE
          Maximum pool size (64GB).
static long MAX_TOTAL_SIZE
          Maximum total size of RAM used (64GB).
static int MAX_VALUE_SIZE
          Maximum value size (4MB).
static long MIN_FILE_SIZE
          Minimum maximum size of a "file" i.e. a buffer (1MB).
static long MIN_TOTAL_SIZE
          Minimum maximum total size of RAM used (16MB).
protected static int SHIFT_FILE_ID
          The location of the file id within the ticket.
protected static int SHIFT_LENGTH
          The location of the value-length within the ticket.
protected static int SHIFT_OFFSET
          The location of the value-offset within the ticket.
protected static int SHIFT_RAM_FLAG
          The location of the RAM flag within the ticket.

 

Fields inherited from class com.tangosol.io.journal.AbstractJournalRM
m_ajournalfile, m_cbMaxFile, m_cbMaxValue, m_cJournalFiles, m_daemonCollector, m_dflHighestLoadFactor, m_dflLoadFactorGC, m_jrnlfile, m_loader, m_nState, m_setJournals, m_xmlConfig, MASK_COMPACT_FLAG, MASK_COMPACT_LENGTH, MAX_COLLECT_PCT, MIN_COLLECT_PCT, SHIFT_COMPACT_FLAG, SHIFT_COMPACT_LENGTH, STATE_CONFIGURED, STATE_INITIAL, STATE_RUNNING, STATE_STOPPED, STATE_STOPPING

 

Constructor Summary
RamJournalRM(Cluster cluster)
          Construct a RAMJournalRM.

 

Method Summary
protected  void applyConfig(java.lang.String sName, XmlElement xmlConfig)
          Parse the XML configuration for the specified setting name, and configure the Journal Resource Manager accordingly.
 void configure(XmlElement xml)
          Configure the controllable service.
protected  long encodeTicket(int nFile, long of, int cb)
          Encode a file number, offset and length into a "ticket".
protected  int extractFileId(long lTicket)
          Extract a file index (a file ID) from the passed ticket.
protected  int extractLength(long lTicket)
          Extract a file offset from the passed ticket.
protected  long extractOffset(long lTicket)
          Extract a file offset from the passed ticket.
 int getBacklogCount()
          Determine the number of serialized values that have not yet been persisted to disk.
 int getBacklogSize()
          Determine the total size in bytes of the serialized values that have not yet been persisted to disk.
protected  RamJournalRM.BufferPool getBufferPool()
          Obtain the BufferPool instance.
 int getBufferSize()
          Determine the size of the buffers used to write a chunk of data at a time to an underlying journal file.
protected  double getDefaultCollectorLoadFactor()
          Determine the default percentage at which a file is eligible for garbage collection.
protected  long getDefaultMaxFileSize()
          Determine the default maximum file size for this Journal Resource Manager.
protected  int getDefaultMaxValueSize()
          Determine the default maximum value size for this Journal Resource Manager.
protected  java.lang.String getDescription()
          Format the object attributes into a String for inclusion in the String returned from the AbstractJournalRM.toString() method.
protected  long getEvacuationMask()
          Obtain the bit mask that is used to identify tickets that need to be evacuated for a particular file id.
protected  RamJournalRM.FlashConsumer getFlashConsumer()
          Obtain the FlashConsumer object used to read/write flash.
protected  Journal getFlashJournal()
          Obtain the Journal used to read/write flash.
 FlashJournalRM getFlashJournalRM()
          Obtain the FlashJournalRM used to store large values or whatever values don't fit in the configured amount of RAM.
protected  RamJournalRM.JournalFile getJournalFile(int nFileId)
          Obtain a JournalFile by its ID.
 int getMaxBacklogSize()
          Determine the maximum allowable size, in bytes, of the backlog; when the backlog reaches this level, writes are delayed until the backlog drops below its maximum.
protected  int getMaxJournalFiles()
          Determine the maximum number of journal files.
 long getMaxPoolSize()
          Determine the maximum size (in bytes) of the buffers that can be held by the pool.
 long getMaxTotalRam()
          Determine the total amount, in bytes, of RAM that will be used for the Journal.
protected  long getMinCollectorSleepMillis()
          Determine the minimum sleep cycle between collections.
protected  float getPercentageAsFraction(java.lang.String sSize)
          Converts the string argument, while interpreting it as a percentage value in the range of 1-99 to a float.
 int getPoolSize()
          Determine the size (in bytes) of the buffers that are currently available in the pool.
protected  java.lang.String getTicketDescription(long lTicket)
          Format the information encoded in a ticket into a debug string.
protected  RamJournalRM.BufferPool instantiateBufferPool()
          Factory: Instantiate a pool of buffers.
protected  RamJournalRM.FlashConsumer instantiateConsumer()
          Factory: Instantiate a FlashConsumer object.
protected  RamJournalRM.JournalImpl instantiateJournal()
          Factory: Instantiate a JournalImpl object.
protected  RamJournalRM.JournalFile instantiateJournalFile(int nFile)
          Factory: Instantiate a JournalFile or subclass thereof.
protected  boolean isCompact(long lTicket)
          Determine if the ticket is in the compact form.
protected  boolean isDedupEnabled()
          Determine if this journal resource manager should de-dup the keys that its JournalBinaryStore instances are managing.
protected  boolean isFlash(long lTicket)
          Determine if the ticket is neither in compact or RAM form.
 boolean isNioRam()
          Determine if the journal will use direct buffers (NIO RAM) instead of on-heap buffers (byte arrays).
protected  boolean isRam(long lTicket)
          Determine if the ticket is in the RAM form.
protected  boolean isSingleEvacuation()
          Determine if this journal resource manager should only evacuate one single JournalFile (at the most) per collection cycle.
 void setFlashJournalRM(FlashJournalRM jrnlrm)
          Configure the FlashJournalRM to use to store large values, or to store all values once the configured amount of RAM has been filled.
 void setMaxFileSize(long cb)
          Configure the maximum size of the underlying journal files.
 void setMaxPoolSize(long cb)
          Configure the size of the buffers pool.
 void setMaxTotalRam(long cb)
          Configure the total amount of RAM that will be used for the journal.
 void setMaxValueSize(int cb)
          Specify the maximum size, in bytes, of Binary values to store.
 void setNioRam(boolean fUseNioRam)
          Configure the journal to use direct buffers (NIO RAM) versus on-heap buffers (byte arrays) to store the journal data.
protected  void startThreads()
          Create and start the various threads used by this Journal Resource Manager.
 void stop()
          Hard-stop the controllable service.

 

Methods inherited from class com.tangosol.io.journal.AbstractJournalRM
checkInitializing, close, createBinaryStore, createJournal, destroyBinaryStore, dispose, encodeTicket, ensureCurrentJournalFile, extractBinary, getBinaryStoreCount, getCluster, getCollectorDaemon, getCollectorLoadFactor, getConfig, getContextClassLoader, getFileCount, getHighestLoadFactor, getMaxCollectorSleepMillis, getMaxFileSize, getMaxJournalFilesNumber, getMaxValueSize, getState, getStateDescription, getTotalDataSize, getTotalFileSize, instantiateCollectorDaemon, isRunning, iterateJournalFiles, iterateJournals, registerJournal, registerMBean, setCollectorLoadFactor, setConfig, setContextClassLoader, setState, shutdown, start, stopThreads, toString, unregisterJournal, unregisterMBean

 

Field Detail

SHIFT_RAM_FLAG

protected static final int SHIFT_RAM_FLAG
The location of the RAM flag within the ticket.
See Also:
Constant Field Values

MASK_RAM_FLAG

protected static final long MASK_RAM_FLAG
The 64-bit bitmask for the RAM flag.

The RAM flag is the bit that signifies that the ticket was produced by the RAM Journal Resource Manager, as opposed to either a "real" compact ticket or a delegated flash ticket.

See Also:
Constant Field Values

SHIFT_FILE_ID

protected static final int SHIFT_FILE_ID
The location of the file id within the ticket.
See Also:
Constant Field Values

MASK_FILE_ID

protected static final long MASK_FILE_ID
The 64-bit bitmask for the file index. The 9 bits from 61-53.
See Also:
Constant Field Values

SHIFT_OFFSET

protected static final int SHIFT_OFFSET
The location of the value-offset within the ticket.
See Also:
Constant Field Values

MASK_OFFSET

protected static final long MASK_OFFSET
The 64-bit bitmask for the value offset. The 31 bits 52-22.
See Also:
Constant Field Values

SHIFT_LENGTH

protected static final int SHIFT_LENGTH
The location of the value-length within the ticket.
See Also:
Constant Field Values

MASK_LENGTH

protected static final long MASK_LENGTH
The 64-bit bitmask for the value length. The 22 bits 21-0.
See Also:
Constant Field Values

MIN_FILE_SIZE

public static final long MIN_FILE_SIZE
Minimum maximum size of a "file" i.e. a buffer (1MB).
See Also:
Constant Field Values

MAX_FILE_SIZE

public static final long MAX_FILE_SIZE
Maximum size of a "file" i.e. a buffer (2GB).
See Also:
Constant Field Values

DFT_FILE_SIZE

public static final long DFT_FILE_SIZE
Default size of a "file" i.e. a buffer (2MB).
See Also:
Constant Field Values

MIN_TOTAL_SIZE

public static final long MIN_TOTAL_SIZE
Minimum maximum total size of RAM used (16MB).
See Also:
Constant Field Values

MAX_TOTAL_SIZE

public static final long MAX_TOTAL_SIZE
Maximum total size of RAM used (64GB).
See Also:
Constant Field Values

DFT_TOTAL_SIZE

public static final long DFT_TOTAL_SIZE
Default total size of RAM used (1GB).
See Also:
Constant Field Values

MAX_VALUE_SIZE

public static final int MAX_VALUE_SIZE
Maximum value size (4MB).
See Also:
Constant Field Values

DFT_VALUE_SIZE

public static final int DFT_VALUE_SIZE
Default maximum value size (16KB).
See Also:
Constant Field Values

MAX_POOL_SIZE

public static final long MAX_POOL_SIZE
Maximum pool size (64GB).
See Also:
Constant Field Values

DFT_POOL_SIZE

public static final long DFT_POOL_SIZE
Default pool size (16MB).
See Also:
Constant Field Values

DFT_COLLECT_PCT

public static final double DFT_COLLECT_PCT
Default collection factor (collect files that are 84% or less utilized).
See Also:
Constant Field Values

m_cbMaxRam

protected long m_cbMaxRam
The maximum total amount of RAM that the journal will allocate.

m_fUseNioRam

protected boolean m_fUseNioRam
The option to use NIO buffers instead of on-heap byte arrays.

m_cbMaxPool

protected long m_cbMaxPool
The maximum total amount of unused RAM buffers that the journal will pool.

m_pool

protected RamJournalRM.BufferPool m_pool
The buffer pool.

m_jrnlrm

protected FlashJournalRM m_jrnlrm
A reference to a flash journal resource manager to use to read/write to/from flash for data that doesn't fit in memory.

m_flash

protected RamJournalRM.FlashConsumer m_flash
The conduit between this RAM journal resource manager and the flash journal resource manager.

Constructor Detail

RamJournalRM

public RamJournalRM(Cluster cluster)
Construct a RAMJournalRM.
Parameters:
cluster - the Cluster for which the RamJournalRM is storing data

Method Detail

configure

public void configure(XmlElement xml)
Configure the controllable service.

This method can only be called before the controllable service is started.

The Journal Resource Manager supports the following configuration options:

The RAM Journal Resource Manager supports the following additional configuration options:

Note that with a flash journal backing up the RAM journal, some of the settings have a slightly different meaning:

To configure the RAM journal so that it is backed by a flash journal, use the setFlashJournalRM(FlashJournalRM) method to provide a reference to the flash journal before configuring the RAM journal.

Specified by:
configure in interface Controllable
Overrides:
configure in class AbstractJournalRM
Parameters:
xml - an XmlElement carrying configuration information specific to the Controllable object

stop

public void stop()
Hard-stop the controllable service. Use Controllable.shutdown() for normal service termination. Calling this method for a service that has already stopped has no effect.
Specified by:
stop in interface Controllable
Overrides:
stop in class AbstractJournalRM

getBacklogCount

public int getBacklogCount()
Determine the number of serialized values that have not yet been persisted to disk.

This property is specific to a FlashJournalRM implementation.

Returns:
the number of serialized values queued to be written

getBacklogSize

public int getBacklogSize()
Determine the total size in bytes of the serialized values that have not yet been persisted to disk. This value is also referred to as the "backlog".

This property is specific to a FlashJournalRM implementation.

Returns:
the number of bytes queued to be written

getMaxBacklogSize

public int getMaxBacklogSize()
Determine the maximum allowable size, in bytes, of the backlog; when the backlog reaches this level, writes are delayed until the backlog drops below its maximum.

This property is specific to a FlashJournalRM implementation.

Returns:
the maximum allowable size of the backlog

getPoolSize

public int getPoolSize()
Determine the size (in bytes) of the buffers that are currently available in the pool. This is not a measurement of how many buffers are currently in use or how many have been allocated.

This property is specific to a FlashJournalRM implementation.

Returns:
the total size in bytes of all of the buffers that are currently in the buffer pool

getMaxTotalRam

public long getMaxTotalRam()
Determine the total amount, in bytes, of RAM that will be used for the Journal.

This property is specific to a RamJournalRM implementation.

Returns:
the maximum number of bytes that will be allocated for Journal storage

isNioRam

public boolean isNioRam()
Determine if the journal will use direct buffers (NIO RAM) instead of on-heap buffers (byte arrays).

This property is specific to a RamJournalRM implementation.

Returns:
true iff the journal is configured to use NIO "direct buffer" RAM

getMaxPoolSize

public long getMaxPoolSize()
Determine the maximum size (in bytes) of the buffers that can be held by the pool. This is not a limit of how many buffers can be allocated, since some may be in use at any time, but rather how many will be held by the pool (i.e. recycled) as they are released.
Returns:
the maximum size in bytes of all of the buffers that the buffer pool can hold onto

getBufferSize

public int getBufferSize()
Determine the size of the buffers used to write a chunk of data at a time to an underlying journal file.

This property is specific to a FlashJournalRM implementation.

Returns:
the size, in bytes, of each buffer

setMaxValueSize

public void setMaxValueSize(int cb)
Specify the maximum size, in bytes, of Binary values to store. In the case of a stand-along RAM Journal Resource Manager, this property prevents unexpectedly-large values from being stored, and in the case of a RAM journal being combined with a flash journal, this property is used to configure at what size data will automatically be sent straight to the flash journal. In other words, with a flash journal available, the RAM journal will attempt to store all values smaller than MaxValueSize in RAM, and will delegate all larger values to the flash journal.

By default it is set to 16KB, as defined by DFT_VALUE_SIZE, with the maximum supported size being 4MB, as defined by MAX_VALUE_SIZE. The MaxValueSize must be no larger than half of the MaxFileSize.

Note: This value can be modified while the ResourceManager is running.

Specified by:
setMaxValueSize in class AbstractJournalRM
Parameters:
cb - the maximum allowable size for a Binary value, or zero to specify no configured maximum for the value size

setMaxFileSize

public void setMaxFileSize(long cb)
Configure the maximum size of the underlying journal files.

Note: This value can only be set before the ResourceManager is started.

The maximum file size cannot exceed 1/2 of the maximum total RAM setting, since the journal is segmented into files, all of which must add up to a total size smaller than the maximum total RAM setting. If setting both MaxFileSize and MaxTotalRam, set the MaxTotalRam first.

This is an advanced setting.

Specified by:
setMaxFileSize in class AbstractJournalRM
Parameters:
cb - the maximum size, in bytes, for journal files

setMaxTotalRam

public void setMaxTotalRam(long cb)
Configure the total amount of RAM that will be used for the journal.

Note: This value can only be set before the ResourceManager is started.

Parameters:
cb - the maximum number of bytes that will be allocated for journal storage

setNioRam

public void setNioRam(boolean fUseNioRam)
Configure the journal to use direct buffers (NIO RAM) versus on-heap buffers (byte arrays) to store the journal data. The default is that the journal data is kept on heap in byte arrays.
Parameters:
fUseNioRam - pass true to use NIO direct buffers off the heap, or false to use byte arrays on the heap

setMaxPoolSize

public void setMaxPoolSize(long cb)
Configure the size of the buffers pool. The default is defined by DFT_POOL_SIZE, with a maximum defined by MAX_POOL_SIZE and a minimum of zero.

Note: This value can only be set before the ResourceManager is started.

Parameters:
cb - the size, in bytes, for the buffer pool

getFlashJournalRM

public FlashJournalRM getFlashJournalRM()
Obtain the FlashJournalRM used to store large values or whatever values don't fit in the configured amount of RAM.
Returns:
the FlashJournalRM used by this RamJournalRM, or null if none

setFlashJournalRM

public void setFlashJournalRM(FlashJournalRM jrnlrm)
Configure the FlashJournalRM to use to store large values, or to store all values once the configured amount of RAM has been filled.

Note: This value can only be set before the ResourceManager is started.

Parameters:
jrnlrm - a FlashJournalRM instance

applyConfig

protected void applyConfig(java.lang.String sName,
                           XmlElement xmlConfig)
Parse the XML configuration for the specified setting name, and configure the Journal Resource Manager accordingly.
Overrides:
applyConfig in class AbstractJournalRM
Parameters:
sName - the name of the XML setting
xmlConfig - the XML element containing the setting

getPercentageAsFraction

protected float getPercentageAsFraction(java.lang.String sSize)
Converts the string argument, while interpreting it as a percentage value in the range of 1-99 to a float.
Parameters:
sSize - the string argument containing a percentage value
Returns:
a floating point number representing the percentage value
Throws:
java.lang.IllegalArgumentException - if the string can't be interpreted as a percentage value

startThreads

protected void startThreads()
Create and start the various threads used by this Journal Resource Manager.
Overrides:
startThreads in class AbstractJournalRM

getDescription

protected java.lang.String getDescription()
Format the object attributes into a String for inclusion in the String returned from the AbstractJournalRM.toString() method.
Overrides:
getDescription in class AbstractJournalRM
Returns:
a comma-delimited String listing the attributes of this object in the form "attribute=value"

getMaxJournalFiles

protected int getMaxJournalFiles()
Determine the maximum number of journal files.
Overrides:
getMaxJournalFiles in class AbstractJournalRM
Returns:
the maximum number of simultaneous journal files that will be used to store the contents of this journal

getDefaultMaxFileSize

protected long getDefaultMaxFileSize()
Determine the default maximum file size for this Journal Resource Manager.
Specified by:
getDefaultMaxFileSize in class AbstractJournalRM
Returns:
the default maximum file size

getDefaultMaxValueSize

protected int getDefaultMaxValueSize()
Determine the default maximum value size for this Journal Resource Manager.
Specified by:
getDefaultMaxValueSize in class AbstractJournalRM
Returns:
the default maximum value size

getDefaultCollectorLoadFactor

protected double getDefaultCollectorLoadFactor()
Determine the default percentage at which a file is eligible for garbage collection.
Specified by:
getDefaultCollectorLoadFactor in class AbstractJournalRM
Returns:
the default garbage collection load factor

getMinCollectorSleepMillis

protected long getMinCollectorSleepMillis()
Determine the minimum sleep cycle between collections.
Overrides:
getMinCollectorSleepMillis in class AbstractJournalRM
Returns:
the minimum number of milliseconds to sleep between collections

isDedupEnabled

protected boolean isDedupEnabled()
Determine if this journal resource manager should de-dup the keys that its JournalBinaryStore instances are managing.
Overrides:
isDedupEnabled in class AbstractJournalRM
Returns:
true iff this journal resource manager should routinely cause its JournalBinaryStore instances to de-dup their keys

isSingleEvacuation

protected boolean isSingleEvacuation()
Determine if this journal resource manager should only evacuate one single JournalFile (at the most) per collection cycle.
Overrides:
isSingleEvacuation in class AbstractJournalRM
Returns:
true iff this journal resource manager should only evacuate the emptiest JournalFile instead of all the JournalFile instances that qualify for evacuation

getFlashJournal

protected Journal getFlashJournal()
Obtain the Journal used to read/write flash.
Returns:
the flash Journal, or null if there is none

instantiateJournal

protected RamJournalRM.JournalImpl instantiateJournal()
Factory: Instantiate a JournalImpl object.
Overrides:
instantiateJournal in class AbstractJournalRM
Returns:
a JournalImpl instance or subclass thereof

instantiateConsumer

protected RamJournalRM.FlashConsumer instantiateConsumer()
Factory: Instantiate a FlashConsumer object.
Returns:
an instance of FlashConsumer or a subclass thereof.

getFlashConsumer

protected RamJournalRM.FlashConsumer getFlashConsumer()
Obtain the FlashConsumer object used to read/write flash.
Returns:
the FlashConsumer instance, or null if there is no flash configured to use

getJournalFile

protected RamJournalRM.JournalFile getJournalFile(int nFileId)
Obtain a JournalFile by its ID.
Overrides:
getJournalFile in class AbstractJournalRM
Parameters:
nFileId - the file id (0-511)
Returns:
the JournalFile for that file id, or null if there is currently no JournalFile for that file id

instantiateJournalFile

protected RamJournalRM.JournalFile instantiateJournalFile(int nFile)
Factory: Instantiate a JournalFile or subclass thereof.
Specified by:
instantiateJournalFile in class AbstractJournalRM
Parameters:
nFile - the file number in the range 0-511 (inclusive)
Returns:
a new JournalFile instance

isCompact

protected boolean isCompact(long lTicket)
Determine if the ticket is in the compact form.
Overrides:
isCompact in class AbstractJournalRM
Parameters:
lTicket - a "ticket" that was created by the Journal
Returns:
true iff the ticket is a compact ticket

isRam

protected boolean isRam(long lTicket)
Determine if the ticket is in the RAM form.
Parameters:
lTicket - a "ticket" that was returned previously by the Journal
Returns:
true iff the ticket is a RAM ticket

isFlash

protected boolean isFlash(long lTicket)
Determine if the ticket is neither in compact or RAM form.
Parameters:
lTicket - a "ticket" that was returned previously by the Journal
Returns:
true iff the ticket is from an underlying FlashJournalRM

getEvacuationMask

protected long getEvacuationMask()
Obtain the bit mask that is used to identify tickets that need to be evacuated for a particular file id.
Specified by:
getEvacuationMask in class AbstractJournalRM
Returns:
the the bit mask for the file index within a ticket and whatever other bits are necessary to ensure that a ticket refers to that file

extractFileId

protected int extractFileId(long lTicket)
Extract a file index (a file ID) from the passed ticket.
Specified by:
extractFileId in class AbstractJournalRM
Parameters:
lTicket - a "ticket" that was created by the Journal
Returns:
the file index for the value represented by that ticket

extractOffset

protected long extractOffset(long lTicket)
Extract a file offset from the passed ticket.
Specified by:
extractOffset in class AbstractJournalRM
Parameters:
lTicket - a "ticket" that was created by the Journal
Returns:
the file offset for the value represented by that ticket

extractLength

protected int extractLength(long lTicket)
Extract a file offset from the passed ticket.
Specified by:
extractLength in class AbstractJournalRM
Parameters:
lTicket - a "ticket" that was created by the Journal
Returns:
the file offset for the value represented by that ticket

encodeTicket

protected long encodeTicket(int nFile,
                            long of,
                            int cb)
Encode a file number, offset and length into a "ticket".
Specified by:
encodeTicket in class AbstractJournalRM
Parameters:
nFile - a file number (aka a file index)
of - a value offset
cb - a value length
Returns:
a "ticket" containing the file number, offset and length

getTicketDescription

protected java.lang.String getTicketDescription(long lTicket)
Format the information encoded in a ticket into a debug string.
Overrides:
getTicketDescription in class AbstractJournalRM
Parameters:
lTicket - the ticket value
Returns:
a description of the contents of the ticket value

instantiateBufferPool

protected RamJournalRM.BufferPool instantiateBufferPool()
Factory: Instantiate a pool of buffers.
Returns:
a BufferPool or subclass thereof

getBufferPool

protected RamJournalRM.BufferPool getBufferPool()
Obtain the BufferPool instance.
Returns:
the BufferPool for this FlashJournalRM

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.