public class BlockingResourcePool<R extends IResource> extends ResourcePool<R>
Constructor and Description |
---|
BlockingResourcePool(IResourceFactory<R> resourceFactory,
int minResources,
int maxResources)
Creates a new Resources Pool with the specified resourceFactory, and max Resources.
|
BlockingResourcePool(IResourceFactory<R> resourceFactory,
int minResources,
int maxResources,
R[] initialResources)
Creates a new Resources Pool with the specified resourceFactory, and max Resources.
|
Modifier and Type | Method and Description |
---|---|
void |
freeResource(R resourceToFree)
Free the specified resource.
|
protected R |
handleFullPool(boolean waitIfNeeded) |
availableResources, forAllResources, getResource, getResource, size, tryAllocateNewPooledResource
public BlockingResourcePool(IResourceFactory<R> resourceFactory, int minResources, int maxResources)
resourceFactory
- resource factory instance for new resourcesminResources
- resources to pre-allocate; can be zeromaxResources
- upper bound on the number of resourcespublic BlockingResourcePool(IResourceFactory<R> resourceFactory, int minResources, int maxResources, R[] initialResources)
resourceFactory
- resource factory instance for new resourcesminResources
- resources to pre-allocate; can be zeromaxResources
- upper bound on the number of resourcesinitialResources
- initial array of resources to init the pool withprotected R handleFullPool(boolean waitIfNeeded)
handleFullPool
in class ResourcePool<R extends IResource>
public void freeResource(R resourceToFree)
ResourcePool
IResource.release()
freeResource
in interface IResourcePool<R extends IResource>
freeResource
in class ResourcePool<R extends IResource>
Copyright © GigaSpaces.