public interface ResourceManager extends WeakReferencingObservable, java.lang.Iterable<Resource>
Modifier and Type | Method and Description |
---|---|
void |
closeResources()
Close all register resources.
|
void |
collectResources()
Iterates over the resources and frees them if they are ready to be freed
or try to close them if they are idle.
|
void |
dispose() |
Resource |
getResource(java.lang.String name) |
int |
getTimeToBeIdle()
Returns the wait time to consider that a resource is idle in seconds.
|
java.util.Iterator<Resource> |
iterator()
Returns an iterator over the available resources.
|
void |
setTimeToBeIdle(int seconds)
Sets the wait time to consider that a resource is idle.
|
void |
startResourceCollector(long milis,
Observer observer)
Initializes the resource collection background process.
|
void |
stopResourceCollector()
Stops successive executions of the resource collector process.
|
addObserver, deleteObserver, deleteObservers
Resource getResource(java.lang.String name)
java.util.Iterator<Resource> iterator()
iterator
in interface java.lang.Iterable<Resource>
void collectResources() throws DataException
DataException
ResourceManager#getTimeToBeIdle()}
{@link ResourceManager#setTimeToBeIdle(int)}
int getTimeToBeIdle()
ResourceManager#collectResources()}
,
ResourceManager#startResourceCollector(long, Observer)}
void setTimeToBeIdle(int seconds)
ResourceManager#collectResources()}
,
ResourceManager#startResourceCollector(long, Observer)}
void startResourceCollector(long milis, Observer observer)
milis
- delay between each execution of the resource collection process, in milliseconds.observer
- an observer that will be notified on each execution of the resource collection process.void stopResourceCollector()
void closeResources() throws DataException
DataException
void dispose() throws DisposeResorceManagerException
DisposeResorceManagerException