Package org.gvsig.fmap.dal.resource
Interface ResourceManager
- All Superinterfaces:
Iterable<Resource>,org.gvsig.tools.observer.Observable,org.gvsig.tools.observer.WeakReferencingObservable
public interface ResourceManager
extends org.gvsig.tools.observer.WeakReferencingObservable, Iterable<Resource>
This interface is the responsible of shared resources management.
Allows getting a resource, iterating over the available resources, and
collecting resources to free them as they become unused
-
Method Summary
Modifier and TypeMethodDescriptionvoidClose all register resources.voidIterates over the resources and frees them if they are ready to be freed or try to close them if they are idle.voiddispose()getResource(String name) intReturns the wait time to consider that a resource is idle in seconds.iterator()Returns an iterator over the available resources.voidsetTimeToBeIdle(int seconds) Sets the wait time to consider that a resource is idle.voidstartResourceCollector(long milis, org.gvsig.tools.observer.Observer observer) Initializes the resource collection background process.voidStops successive executions of the resource collector process.Methods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.gvsig.tools.observer.Observable
addObserver, deleteObserver, deleteObservers
-
Method Details
-
getResource
-
iterator
Returns an iterator over the available resources. -
collectResources
Iterates over the resources and frees them if they are ready to be freed or try to close them if they are idle.- Throws:
DataException
-
getTimeToBeIdle
int getTimeToBeIdle()Returns the wait time to consider that a resource is idle in seconds. Used in collect resouces action.
if is lower than 1 never is idle.- Returns:
- seconds
-
setTimeToBeIdle
void setTimeToBeIdle(int seconds) Sets the wait time to consider that a resource is idle. Used in collect resouces action.
if is lower than 1 never is idle. -
startResourceCollector
void startResourceCollector(long milis, org.gvsig.tools.observer.Observer observer) Initializes the resource collection background process. Allows setting of the delay between each execution of the collector and also an observer to be notified on each execution.- Parameters:
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.
-
stopResourceCollector
void stopResourceCollector()Stops successive executions of the resource collector process. It does not interrupt the process if it is currently running, but it will not be executed anymore times. -
closeResources
Close all register resources.- Throws:
DataException
-
dispose
- Throws:
DisposeResorceManagerException
-