org.jboss.ejb.plugins.cmp.jdbc
Class ReadAheadCache

java.lang.Object
  extended byorg.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache

public final class ReadAheadCache
extends java.lang.Object

ReadAheadCache stores all of the data readahead for an entity. Data is stored in the JDBCStoreManager entity tx data map on a per entity basis. The read ahead data for each entity is stored with a soft reference.


Nested Class Summary
static class ReadAheadCache.EntityReadAheadInfo (src)
           
 
Constructor Summary
ReadAheadCache(JDBCStoreManager (src)  manager)
           
 
Method Summary
 void addFinderResults(java.util.List results, JDBCReadAheadMetaData (src)  readahead)
           
 void addPreloadData(java.lang.Object pk, JDBCFieldBridge (src)  field, java.lang.Object fieldValue)
          Add preloaded data for an entity within the scope of a transaction
 void create()
           
 void destroy()
           
 java.util.Collection getCachedCMRValue(java.lang.Object pk, JDBCCMRFieldBridge (src)  cmrField)
          Returns the cached value of a CMR field or null if nothing was cached for this field.
 ReadAheadCache.EntityReadAheadInfo (src) getEntityReadAheadInfo(java.lang.Object pk)
           
 java.util.Map getPreloadDataMap(java.lang.Object entityPrimaryKey, boolean create)
          Gets the map of preloaded data.
 boolean load(EntityEnterpriseContext (src)  ctx)
          Loads all of the preloaded data for the ctx into it.
 void removeCachedData(java.lang.Object primaryKey)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadAheadCache

public ReadAheadCache(JDBCStoreManager (src)  manager)
Method Detail

create

public void create()

start

public void start()

stop

public void stop()

destroy

public void destroy()

addFinderResults

public void addFinderResults(java.util.List results,
                             JDBCReadAheadMetaData (src)  readahead)

getEntityReadAheadInfo

public ReadAheadCache.EntityReadAheadInfo (src)  getEntityReadAheadInfo(java.lang.Object pk)

load

public boolean load(EntityEnterpriseContext (src)  ctx)
Loads all of the preloaded data for the ctx into it.

Parameters:
ctx - the context that will be loaded
Returns:
true if at least one field was loaded.

getCachedCMRValue

public java.util.Collection getCachedCMRValue(java.lang.Object pk,
                                              JDBCCMRFieldBridge (src)  cmrField)
Returns the cached value of a CMR field or null if nothing was cached for this field.

Parameters:
pk - primary key.
cmrField - the field to get the cached value for.
Returns:
cached value for the cmrField or null if no value cached.

addPreloadData

public void addPreloadData(java.lang.Object pk,
                           JDBCFieldBridge (src)  field,
                           java.lang.Object fieldValue)
Add preloaded data for an entity within the scope of a transaction


removeCachedData

public void removeCachedData(java.lang.Object primaryKey)

getPreloadDataMap

public java.util.Map getPreloadDataMap(java.lang.Object entityPrimaryKey,
                                       boolean create)
Gets the map of preloaded data.

Parameters:
entityPrimaryKey - the primary key of the entity
create - should a new preload data map be created if one is not found
Returns:
the preload data map for null if one is not found