public class CPECasPool extends Object
Constructor and Description |
---|
CPECasPool(int aNumInstances,
CasManager aCasManager)
Initialize the pool.
|
CPECasPool(int aNumInstances,
CasManager aCasManager,
Properties aPerformanceTuningSettings)
Initialize the pool
|
Modifier and Type | Method and Description |
---|---|
protected void |
fillPool(CasManager aCasManager,
Properties aPerformanceTuningSettings)
Fills the pool with initialized instances of CAS.
|
CAS |
getCas()
Checks out a CAS from the pool.
|
CAS |
getCas(long aTimeout)
Returns a Cas instance from the pool.
|
CAS |
getCheckedOutCas(int aIndex)
Returns a CAS found in a given position in the list.
|
int |
getCheckedOutCasCount()
Returns number of CAS'es that have been checked out from pool
|
int |
getSize()
Gets the size of this pool (the total number of CAS instances that it can hold).
|
void |
releaseCas(CAS aCas)
Checks in a CAS to the pool.
|
public CPECasPool(int aNumInstances, CasManager aCasManager) throws ResourceInitializationException
aNumInstances
- -
max size of the poolaCasManager
- -
CAS Manager to use to create the CASesResourceInitializationException
- -public CPECasPool(int aNumInstances, CasManager aCasManager, Properties aPerformanceTuningSettings) throws ResourceInitializationException
aNumInstances
- -
max size of the poolaCasManager
- -
CAS Manager to use to create the CASesaPerformanceTuningSettings
- ResourceInitializationException
- -protected void fillPool(CasManager aCasManager, Properties aPerformanceTuningSettings) throws ResourceInitializationException
aCasManager
- -
definition (type system, indexes, etc.) of CASes to createaPerformanceTuningSettings
- ResourceInitializationException
- -public CAS getCas(long aTimeout)
aTimeout
- -
max amount of time in millis to wait for CAS instancepublic CAS getCas()
null
if none are available (in which case the
client may Object.wait()
on this object in order to be notified when an
instance becomes available).public void releaseCas(CAS aCas)
CAS.reset()
method, to ensure
that when the CAS is later retrieved from the pool it will be ready to use. Also notifies other
Threads that may be waiting for an instance to become available.aCas
- the CAS to releasepublic int getCheckedOutCasCount()
public CAS getCheckedOutCas(int aIndex)
aIndex
- -
position of the CAS in the listpublic int getSize()
Copyright © 2006–2023 The Apache Software Foundation. All rights reserved.