|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.metamatrix.common.buffer.impl.BufferManagerImpl
public class BufferManagerImpl
Default implementation of BufferManager. This buffer manager implementation assumes the usage of a StorageManager of type memory and optionally (preferred) an additional StorageManager of type FILE or DISK. If no persistent manager is specified, everything managed by this BufferManager is assumed to fit in memory. This can be useful for testing or for small uses.
Lots of state is cached in memory. The tupleSourceMap contains a map of TupleSourceID --> TupleSourceInfo. Everything about a particular tuple source is stored there. The memoryState contains everything pertaining to memory management. The config contains all config info.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.metamatrix.common.buffer.BufferManager |
---|
BufferManager.TupleSourceStatus, BufferManager.TupleSourceType |
Constructor Summary | |
---|---|
BufferManagerImpl()
|
Method Summary | |
---|---|
void |
addStorageManager(StorageManager storageManager)
Add a storage manager to this buffer manager, order is unimportant |
void |
addStreamablePart(TupleSourceID tupleSourceID,
LobChunk streamChunk,
int beginRow)
Add a streamable object to the persistent store. |
void |
addTupleBatch(TupleSourceID tupleSourceID,
TupleBatch tupleBatch)
Add a batch to the given tuple source. |
protected void |
clean(long memoryRequired)
Clean the memory state, using LRU. |
protected void |
clean(long memoryRequired,
com.metamatrix.common.buffer.impl.TupleGroupInfo targetGroupInfo)
Over memory limit for this session. |
TupleSourceID |
createTupleSource(java.util.List schema,
java.lang.String[] types,
java.lang.String groupName,
BufferManager.TupleSourceType tupleSourceType)
Register a new tuple source and return a unique ID for it. |
BufferConfig |
getConfig()
Get the configuration of the buffer manager |
int |
getConnectorBatchSize()
Get connector batch size |
int |
getFinalRowCount(TupleSourceID tupleSourceID)
Gets the final row count if tuple source is FULL, otherwise returns -1. |
int |
getPinnedCount()
for testing purposes |
int |
getProcessorBatchSize()
Get processor batch size |
int |
getRowCount(TupleSourceID tupleSourceID)
Get the row count for a particular tuple source |
BufferStats |
getStats()
Construct a BufferStats object by looking at all the state. |
BufferManager.TupleSourceStatus |
getStatus(TupleSourceID tupleSourceID)
Get the status for a particular tuple source |
LobChunk |
getStreamablePart(TupleSourceID tupleSourceID,
int beginRow)
Returns the streamable batch object's part stored with specified identifier |
java.util.List |
getTupleSchema(TupleSourceID tupleSourceID)
Get the tuple schema for a particular tuple source |
IndexedTupleSource |
getTupleSource(TupleSourceID tupleSourceID)
Get a tuple source to walk through the rows for a particular tupleSourceID. |
void |
initialize(java.lang.String lookup,
java.util.Properties properties)
See BufferManagerPropertyNames for a
description of all the properties. |
TupleBatch |
pinTupleBatch(TupleSourceID tupleSourceID,
int beginRow,
int maxEndRow)
Pin a tuple source in memory and return it. |
void |
releasePinnedBatches()
Release batches that have been pinned by this thread. |
void |
removeTupleSource(TupleSourceID tupleSourceID)
Remove a tuple source based on ID |
void |
removeTupleSources(java.lang.String groupName)
Remove all the tuple sources with the specified group name. |
void |
setStatus(TupleSourceID tupleSourceID,
BufferManager.TupleSourceStatus status)
Set the status for a particular tuple source |
void |
stop()
|
void |
unpinTupleBatch(TupleSourceID tupleSourceID,
int beginRow,
int endRow)
Unpin a tuple source batch. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BufferManagerImpl()
Method Detail |
---|
public void initialize(java.lang.String lookup, java.util.Properties properties) throws MetaMatrixComponentException
BufferManagerPropertyNames
for a
description of all the properties.
initialize
in interface BufferManager
lookup
- An object telling the buffer manager what his location is and
how to find other buffer managers of different locationsproperties
- Properties to configure the buffer manager
MetaMatrixComponentException
public BufferConfig getConfig()
public BufferStats getStats()
public int getProcessorBatchSize()
getProcessorBatchSize
in interface BufferManager
public int getConnectorBatchSize()
getConnectorBatchSize
in interface BufferManager
public void addStorageManager(StorageManager storageManager)
addStorageManager
in interface BufferManager
storageManager
- Storage manager to addpublic TupleSourceID createTupleSource(java.util.List schema, java.lang.String[] types, java.lang.String groupName, BufferManager.TupleSourceType tupleSourceType) throws MetaMatrixComponentException
createTupleSource
in interface BufferManager
schema
- List of ElementSymbolgroupName
- Group nametupleSourceType
- Type of tuple source as defined in BufferManager constants
MetaMatrixComponentException
- If internal server error occurspublic void removeTupleSource(TupleSourceID tupleSourceID) throws TupleSourceNotFoundException, MetaMatrixComponentException
removeTupleSource
in interface BufferManager
tupleSourceID
- Tuple source identifier
TupleSourceNotFoundException
- If tuple source not found
MetaMatrixComponentException
- If internal server error occurspublic void removeTupleSources(java.lang.String groupName) throws MetaMatrixComponentException
removeTupleSources
in interface BufferManager
groupName
- Name of the group
MetaMatrixComponentException
- If internal server error occurspublic IndexedTupleSource getTupleSource(TupleSourceID tupleSourceID) throws TupleSourceNotFoundException, MetaMatrixComponentException
getTupleSource
in interface BufferManager
tupleSourceID
- Tuple source identifier
TupleSourceNotFoundException
- If tuple source not found
MetaMatrixComponentException
- If an internal server error occurredpublic java.util.List getTupleSchema(TupleSourceID tupleSourceID) throws TupleSourceNotFoundException, MetaMatrixComponentException
getTupleSchema
in interface BufferManager
tupleSourceID
- Tuple source identifier
TupleSourceNotFoundException
- If tuple source not found
MetaMatrixComponentException
- If an internal server error occurredpublic void setStatus(TupleSourceID tupleSourceID, BufferManager.TupleSourceStatus status) throws TupleSourceNotFoundException, MetaMatrixComponentException
setStatus
in interface BufferManager
tupleSourceID
- Tuple source identifierstatus
- New status
TupleSourceNotFoundException
- If tuple source not found
MetaMatrixComponentException
- If an internal server error occurredBufferManager.TupleSourceStatus.ACTIVE
,
BufferManager.TupleSourceStatus.FULL
public BufferManager.TupleSourceStatus getStatus(TupleSourceID tupleSourceID) throws TupleSourceNotFoundException, MetaMatrixComponentException
getStatus
in interface BufferManager
tupleSourceID
- Tuple source identifier
TupleSourceNotFoundException
- If tuple source not found
MetaMatrixComponentException
- If an internal server error occurredBufferManager.TupleSourceStatus.ACTIVE
,
BufferManager.TupleSourceStatus.FULL
public int getRowCount(TupleSourceID tupleSourceID) throws TupleSourceNotFoundException, MetaMatrixComponentException
getRowCount
in interface BufferManager
tupleSourceID
- Tuple source identifier
TupleSourceNotFoundException
- If tuple source not found
MetaMatrixComponentException
- If an internal server error occurredpublic void addTupleBatch(TupleSourceID tupleSourceID, TupleBatch tupleBatch) throws TupleSourceNotFoundException, MetaMatrixComponentException
addTupleBatch
in interface BufferManager
tupleSourceID
- Tuple source identifiertupleBatch
- New batch
TupleSourceNotFoundException
- If tuple source not found
MetaMatrixComponentException
- If an internal server error occurredpublic TupleBatch pinTupleBatch(TupleSourceID tupleSourceID, int beginRow, int maxEndRow) throws TupleSourceNotFoundException, MemoryNotAvailableException, MetaMatrixComponentException
pinTupleBatch
in interface BufferManager
tupleSourceID
- Tuple source identifierbeginRow
- Beginning rowmaxEndRow
- Max end row to return
TupleSourceNotFoundException
- If tuple source not found
MetaMatrixComponentException
- If an internal server error occurred
MemoryNotAvailableException
- If memory was not available for the pinpublic void unpinTupleBatch(TupleSourceID tupleSourceID, int beginRow, int endRow) throws TupleSourceNotFoundException, MetaMatrixComponentException
unpinTupleBatch
in interface BufferManager
tupleSourceID
- Tuple source identifierbeginRow
- Beginning rowendRow
- Last row to unpin (inclusive)
TupleSourceNotFoundException
- If tuple source not found
MetaMatrixComponentException
- If an internal server error occurredpublic int getFinalRowCount(TupleSourceID tupleSourceID) throws TupleSourceNotFoundException, MetaMatrixComponentException
getFinalRowCount
in interface BufferManager
tupleSourceID
- Tuple source identifier
TupleSourceNotFoundException
- If tuple source not found
MetaMatrixComponentException
- If an internal server error occurredprotected void clean(long memoryRequired)
protected void clean(long memoryRequired, com.metamatrix.common.buffer.impl.TupleGroupInfo targetGroupInfo) throws TupleSourceNotFoundException
TupleSourceNotFoundException
public void stop()
stop
in interface BufferManager
BufferManager.stop()
public void addStreamablePart(TupleSourceID tupleSourceID, LobChunk streamChunk, int beginRow) throws TupleSourceNotFoundException, MetaMatrixComponentException
BufferManager
addStreamablePart
in interface BufferManager
streamChunk
- part of the stream
TupleSourceNotFoundException
MetaMatrixComponentException
BufferManager.addStreamablePart(com.metamatrix.common.buffer.TupleSourceID, com.metamatrix.common.lob.LobChunk, int)
public LobChunk getStreamablePart(TupleSourceID tupleSourceID, int beginRow) throws TupleSourceNotFoundException, MetaMatrixComponentException
BufferManager
getStreamablePart
in interface BufferManager
tupleSourceID
- - identifier
TupleSourceNotFoundException
MetaMatrixComponentException
com.metamatrix.common.buffer.BufferManager#getStreamable(com.metamatrix.common.buffer.TupleSourceID)
public void releasePinnedBatches() throws MetaMatrixComponentException
BufferManager
releasePinnedBatches
in interface BufferManager
MetaMatrixComponentException
BufferManager.releasePinnedBatches()
public int getPinnedCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |