|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.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 BufferManagerlookup - 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
MetaMatrixComponentExceptionpublic BufferConfig getConfig()
public BufferStats getStats()
public int getProcessorBatchSize()
getProcessorBatchSize in interface BufferManagerpublic int getConnectorBatchSize()
getConnectorBatchSize in interface BufferManagerpublic void addStorageManager(StorageManager storageManager)
addStorageManager in interface BufferManagerstorageManager - Storage manager to add
public TupleSourceID createTupleSource(java.util.List schema,
java.lang.String[] types,
java.lang.String groupName,
BufferManager.TupleSourceType tupleSourceType)
throws MetaMatrixComponentException
createTupleSource in interface BufferManagerschema - List of ElementSymbolgroupName - Group nametupleSourceType - Type of tuple source as defined in BufferManager constants
MetaMatrixComponentException - If internal server error occurs
public void removeTupleSource(TupleSourceID tupleSourceID)
throws TupleSourceNotFoundException,
MetaMatrixComponentException
removeTupleSource in interface BufferManagertupleSourceID - Tuple source identifier
TupleSourceNotFoundException - If tuple source not found
MetaMatrixComponentException - If internal server error occurs
public void removeTupleSources(java.lang.String groupName)
throws MetaMatrixComponentException
removeTupleSources in interface BufferManagergroupName - Name of the group
MetaMatrixComponentException - If internal server error occurs
public IndexedTupleSource getTupleSource(TupleSourceID tupleSourceID)
throws TupleSourceNotFoundException,
MetaMatrixComponentException
getTupleSource in interface BufferManagertupleSourceID - Tuple source identifier
TupleSourceNotFoundException - If tuple source not found
MetaMatrixComponentException - If an internal server error occurred
public java.util.List getTupleSchema(TupleSourceID tupleSourceID)
throws TupleSourceNotFoundException,
MetaMatrixComponentException
getTupleSchema in interface BufferManagertupleSourceID - Tuple source identifier
TupleSourceNotFoundException - If tuple source not found
MetaMatrixComponentException - If an internal server error occurred
public void setStatus(TupleSourceID tupleSourceID,
BufferManager.TupleSourceStatus status)
throws TupleSourceNotFoundException,
MetaMatrixComponentException
setStatus in interface BufferManagertupleSourceID - 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 BufferManagertupleSourceID - 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 BufferManagertupleSourceID - Tuple source identifier
TupleSourceNotFoundException - If tuple source not found
MetaMatrixComponentException - If an internal server error occurred
public void addTupleBatch(TupleSourceID tupleSourceID,
TupleBatch tupleBatch)
throws TupleSourceNotFoundException,
MetaMatrixComponentException
addTupleBatch in interface BufferManagertupleSourceID - Tuple source identifiertupleBatch - New batch
TupleSourceNotFoundException - If tuple source not found
MetaMatrixComponentException - If an internal server error occurred
public TupleBatch pinTupleBatch(TupleSourceID tupleSourceID,
int beginRow,
int maxEndRow)
throws TupleSourceNotFoundException,
MemoryNotAvailableException,
MetaMatrixComponentException
pinTupleBatch in interface BufferManagertupleSourceID - 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 pin
public void unpinTupleBatch(TupleSourceID tupleSourceID,
int beginRow,
int endRow)
throws TupleSourceNotFoundException,
MetaMatrixComponentException
unpinTupleBatch in interface BufferManagertupleSourceID - Tuple source identifierbeginRow - Beginning rowendRow - Last row to unpin (inclusive)
TupleSourceNotFoundException - If tuple source not found
MetaMatrixComponentException - If an internal server error occurred
public int getFinalRowCount(TupleSourceID tupleSourceID)
throws TupleSourceNotFoundException,
MetaMatrixComponentException
getFinalRowCount in interface BufferManagertupleSourceID - 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
TupleSourceNotFoundExceptionpublic void stop()
stop in interface BufferManagerBufferManager.stop()
public void addStreamablePart(TupleSourceID tupleSourceID,
LobChunk streamChunk,
int beginRow)
throws TupleSourceNotFoundException,
MetaMatrixComponentException
BufferManager
addStreamablePart in interface BufferManagerstreamChunk - part of the stream
TupleSourceNotFoundException
MetaMatrixComponentExceptionBufferManager.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 BufferManagertupleSourceID - - identifier
TupleSourceNotFoundException
MetaMatrixComponentExceptioncom.metamatrix.common.buffer.BufferManager#getStreamable(com.metamatrix.common.buffer.TupleSourceID)
public void releasePinnedBatches()
throws MetaMatrixComponentException
BufferManager
releasePinnedBatches in interface BufferManagerMetaMatrixComponentExceptionBufferManager.releasePinnedBatches()public int getPinnedCount()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||