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

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

public final class ReadAheadCache
extends 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.

Version:
$Revision: 1.8.2.21 $
Author:
Dain Sundstrom

Nested Class Summary
static class ReadAheadCache.EntityReadAheadInfo
           
 
Constructor Summary
ReadAheadCache(JDBCStoreManager manager)
           
 
Method Summary
 void addFinderResults(List results, JDBCReadAheadMetaData readahead)
           
 void addPreloadData(Object pk, JDBCFieldBridge field, Object fieldValue)
          Add preloaded data for an entity within the scope of a transaction
 void create()
           
 void destroy()
           
 Collection getCachedCMRValue(Object pk, JDBCCMRFieldBridge cmrField)
          Returns the cached value of a CMR field or null if nothing was cached for this field.
 ReadAheadCache.EntityReadAheadInfo getEntityReadAheadInfo(Object pk)
           
 Map getPreloadDataMap(Object entityPrimaryKey, boolean create)
          Gets the map of preloaded data.
 boolean load(EntityEnterpriseContext ctx)
          Loads all of the preloaded data for the ctx into it.
 void removeCachedData(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 manager)
Method Detail

create

public void create()

start

public void start()

stop

public void stop()

destroy

public void destroy()

addFinderResults

public void addFinderResults(List results,
                             JDBCReadAheadMetaData readahead)

getEntityReadAheadInfo

public ReadAheadCache.EntityReadAheadInfo getEntityReadAheadInfo(Object pk)

load

public boolean load(EntityEnterpriseContext 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 Collection getCachedCMRValue(Object pk,
                                    JDBCCMRFieldBridge 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(Object pk,
                           JDBCFieldBridge field,
                           Object fieldValue)
Add preloaded data for an entity within the scope of a transaction


removeCachedData

public void removeCachedData(Object primaryKey)

getPreloadDataMap

public Map getPreloadDataMap(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


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.