|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gargoylesoftware.base.resource.ResourceFactory
com.gargoylesoftware.base.resource.PooledResourceFactory
public class PooledResourceFactory
A resource factory that provides object pooling
Field Summary | |
---|---|
private java.util.List |
cache_
|
private int |
preferredCacheSize_
|
private ResourceFactory |
sourceFactory_
|
Constructor Summary | |
---|---|
PooledResourceFactory(ResourceFactory sourceFactory)
Create an instance |
Method Summary | |
---|---|
int |
getPreferredCacheSize()
Return the preferredCacheSize |
protected ManagedResource |
getResourceImpl(ResourceManager resourceManager)
Get a resource |
boolean |
reinitializeResourceIfPossible(ManagedResource resource)
Reinitialize the resource to a known state. |
protected void |
releaseResourceImpl(ResourceManager resourceManager,
ManagedResource resource)
Release a resource |
void |
setPreferredCacheSize(int size)
Set the preferredCacheSize |
Methods inherited from class com.gargoylesoftware.base.resource.ResourceFactory |
---|
getResource, releaseAllResources, releaseResource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final ResourceFactory sourceFactory_
private int preferredCacheSize_
private java.util.List cache_
Constructor Detail |
---|
public PooledResourceFactory(ResourceFactory sourceFactory)
sourceFactory
- The factory that will be used to actually create
and destroy the pooled resourcesMethod Detail |
---|
public void setPreferredCacheSize(int size)
size
- The new size. May not be negativepublic int getPreferredCacheSize()
public boolean reinitializeResourceIfPossible(ManagedResource resource)
reinitializeResourceIfPossible
in class ResourceFactory
resource
- the resource to reinitialize
protected ManagedResource getResourceImpl(ResourceManager resourceManager) throws java.lang.Exception
getResourceImpl
in class ResourceFactory
resourceManager
- The manager that owns this factory
java.lang.Exception
- If an error occursprotected void releaseResourceImpl(ResourceManager resourceManager, ManagedResource resource) throws java.lang.Exception
releaseResourceImpl
in class ResourceFactory
resource
- The resource to releaseresourceManager
- The manager that owns this factory
java.lang.Exception
- If an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |