public class RWLockDataStructure extends Object implements DataStructure
| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
_logger |
DS_TYPE_CIRCULAR_LIST, DS_TYPE_DEFAULT, DS_TYPE_PARTITIONED| Constructor and Description |
|---|
RWLockDataStructure(String parameters,
int maxSize,
ResourceHandler handler,
String strategyClass) |
| Modifier and Type | Method and Description |
|---|---|
int |
addResource(ResourceAllocator allocator,
int count)
creates a new resource and adds to the datastructure.
|
ArrayList<ResourceHandle> |
getAllResources()
Get all resources in the datastructure
Note : do not use this for normal usages as it
can potentially represent all resources
(including the ones in use).
|
int |
getFreeListSize()
get the count of free resources in the datastructure
|
ResourceHandle |
getResource()
get a resource from the datastructure
|
int |
getResourcesSize()
get total number of resources in the datastructure
|
void |
removeAll()
remove & destroy all resources from the datastructure.
|
void |
removeResource(ResourceHandle resource)
remove the specified resource from the datastructure
|
void |
returnResource(ResourceHandle resource)
returns the resource to the datastructure
|
void |
setMaxSize(int maxSize)
Set maxSize based on the new max pool size set on the connection pool
during a reconfiguration.
|
protected static final Logger _logger
public RWLockDataStructure(String parameters, int maxSize, ResourceHandler handler, String strategyClass)
public int addResource(ResourceAllocator allocator, int count) throws PoolingException
addResource in interface DataStructureallocator - ResourceAllocatorcount - Number (units) of resources to createPoolingException - when unable to create a resourcepublic ResourceHandle getResource()
getResource in interface DataStructurepublic void removeResource(ResourceHandle resource)
removeResource in interface DataStructureresource - ResourceHandlepublic void returnResource(ResourceHandle resource)
returnResource in interface DataStructureresource - ResourceHandlepublic int getFreeListSize()
getFreeListSize in interface DataStructurepublic void removeAll()
removeAll in interface DataStructurepublic int getResourcesSize()
getResourcesSize in interface DataStructurepublic void setMaxSize(int maxSize)
setMaxSize in interface DataStructuremaxSize - public ArrayList<ResourceHandle> getAllResources()
DataStructuregetAllResources in interface DataStructureCopyright © 2017. All rights reserved.