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 intMAX_FILE_SIZE
-
Constructor Summary
Constructors Constructor Description MemoryStorageManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(CacheEntry entry, Serializer<?> s)Adds an entry to the cache.booleanaddToCacheGroup(Long gid, Long oid)Must be called prior to adding an entryvoidcreateCacheGroup(Long gid)Must be called prior to adding any group entriesFileStorecreateFileStore(String name)CacheEntryget(Long lock, Long oid, WeakReference<? extends Serializer<?>> ref)Get method, must be called using the object obtained in the lockForLoad methodintgetCacheGroupCount()intgetCreated()longgetMaxStorageSpace()longgetMemoryBufferSpace()intgetRemoved()voidinitialize()LonglockForLoad(Long oid, Serializer<?> serializer)Lock the object for load and return an identifier/lock that can be used to retrieve the object.Integerremove(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 keysvoidshutdown()voidunlockForLoad(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:
initializein interfaceStorageManager
-
createFileStore
public FileStore createFileStore(String name)
- Specified by:
createFileStorein interfaceStorageManager
-
getCreated
public int getCreated()
-
getRemoved
public int getRemoved()
-
add
public boolean add(CacheEntry entry, Serializer<?> s)
Description copied from interface:CacheAdds an entry to the cache.
-
addToCacheGroup
public boolean addToCacheGroup(Long gid, Long oid)
Description copied from interface:CacheMust be called prior to adding an entry- Specified by:
addToCacheGroupin interfaceCache<Long>- Returns:
- if the add was successful
-
createCacheGroup
public void createCacheGroup(Long gid)
Description copied from interface:CacheMust be called prior to adding any group entries- Specified by:
createCacheGroupin interfaceCache<Long>
-
lockForLoad
public Long lockForLoad(Long oid, Serializer<?> serializer)
Description copied from interface:CacheLock the object for load and return an identifier/lock that can be used to retrieve the object.- Specified by:
lockForLoadin interfaceCache<Long>- Returns:
- the identifier, may be null
-
unlockForLoad
public void unlockForLoad(Long o)
Description copied from interface:CacheMust be called after lockForLoad- Specified by:
unlockForLoadin interfaceCache<Long>
-
get
public CacheEntry get(Long lock, Long oid, WeakReference<? extends Serializer<?>> ref) throws TeiidComponentException
Description copied from interface:CacheGet method, must be called using the object obtained in the lockForLoad method- Specified by:
getin interfaceCache<Long>- Returns:
- Throws:
TeiidComponentException
-
remove
public Integer remove(Long gid, Long id)
Description copied from interface:CacheRemove an entry from the cache, return the sizeEstimate if the entry existed
-
removeCacheGroup
public Collection<Long> removeCacheGroup(Long gid)
Description copied from interface:CacheRemove an entire cache group TODO: this should use a callback on the buffermangaer to remove memory entries without materializing all group keys- Specified by:
removeCacheGroupin interfaceCache<Long>- Returns:
-
getMaxStorageSpace
public long getMaxStorageSpace()
- Specified by:
getMaxStorageSpacein interfaceStorageManager
-
getMemoryBufferSpace
public long getMemoryBufferSpace()
- Specified by:
getMemoryBufferSpacein interfaceCache<Long>
-
getCacheGroupCount
public int getCacheGroupCount()
- Specified by:
getCacheGroupCountin interfaceCache<Long>
-
-