Package org.teiid.common.buffer.impl
Class MemoryStorageManager
- java.lang.Object
-
- org.teiid.common.buffer.impl.MemoryStorageManager
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_FILE_SIZE
-
Constructor Summary
Constructors Constructor Description MemoryStorageManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(CacheEntry entry, Serializer<?> s)
Adds an entry to the cache.boolean
addToCacheGroup(Long gid, Long oid)
Must be called prior to adding an entryvoid
createCacheGroup(Long gid)
Must be called prior to adding any group entriesFileStore
createFileStore(String name)
CacheEntry
get(Long lock, Long oid, WeakReference<? extends Serializer<?>> ref)
Get method, must be called using the object obtained in the lockForLoad methodint
getCacheGroupCount()
int
getCreated()
long
getMaxStorageSpace()
long
getMemoryBufferSpace()
int
getRemoved()
void
initialize()
Long
lockForLoad(Long oid, Serializer<?> serializer)
Lock the object for load and return an identifier/lock that can be used to retrieve the object.Integer
remove(Long gid, Long id)
Remove an entry from the cache, return the sizeEstimate if the entry existedCollection<Long>
removeCacheGroup(Long gid)
Remove an entire cache group TODO: this should use a callback on the buffermangaer to remove memory entries without materializing all group keysvoid
shutdown()
void
unlockForLoad(Long o)
Must be called after lockForLoad
-
-
-
Field Detail
-
MAX_FILE_SIZE
public static final int MAX_FILE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize()
- Specified by:
initialize
in interfaceStorageManager
-
createFileStore
public FileStore createFileStore(String name)
- Specified by:
createFileStore
in interfaceStorageManager
-
getCreated
public int getCreated()
-
getRemoved
public int getRemoved()
-
add
public boolean add(CacheEntry entry, Serializer<?> s)
Description copied from interface:Cache
Adds an entry to the cache.
-
addToCacheGroup
public boolean addToCacheGroup(Long gid, Long oid)
Description copied from interface:Cache
Must be called prior to adding an entry- Specified by:
addToCacheGroup
in interfaceCache<Long>
- Returns:
- if the add was successful
-
createCacheGroup
public void createCacheGroup(Long gid)
Description copied from interface:Cache
Must be called prior to adding any group entries- Specified by:
createCacheGroup
in interfaceCache<Long>
-
lockForLoad
public Long lockForLoad(Long oid, Serializer<?> serializer)
Description copied from interface:Cache
Lock the object for load and return an identifier/lock that can be used to retrieve the object.- Specified by:
lockForLoad
in interfaceCache<Long>
- Returns:
- the identifier, may be null
-
unlockForLoad
public void unlockForLoad(Long o)
Description copied from interface:Cache
Must be called after lockForLoad- Specified by:
unlockForLoad
in interfaceCache<Long>
-
get
public CacheEntry get(Long lock, Long oid, WeakReference<? extends Serializer<?>> ref) throws TeiidComponentException
Description copied from interface:Cache
Get method, must be called using the object obtained in the lockForLoad method- Specified by:
get
in interfaceCache<Long>
- Returns:
- Throws:
TeiidComponentException
-
remove
public Integer remove(Long gid, Long id)
Description copied from interface:Cache
Remove an entry from the cache, return the sizeEstimate if the entry existed
-
removeCacheGroup
public Collection<Long> removeCacheGroup(Long gid)
Description copied from interface:Cache
Remove an entire cache group TODO: this should use a callback on the buffermangaer to remove memory entries without materializing all group keys- Specified by:
removeCacheGroup
in interfaceCache<Long>
- Returns:
-
getMaxStorageSpace
public long getMaxStorageSpace()
- Specified by:
getMaxStorageSpace
in interfaceStorageManager
-
getMemoryBufferSpace
public long getMemoryBufferSpace()
- Specified by:
getMemoryBufferSpace
in interfaceCache<Long>
-
getCacheGroupCount
public int getCacheGroupCount()
- Specified by:
getCacheGroupCount
in interfaceCache<Long>
-
-