org.gvsig.fmap.dal.resource
Interface ResourceManager

All Superinterfaces:
Observable, WeakReferencingObservable

public interface ResourceManager
extends WeakReferencingObservable

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
 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(String name)
           
 int getTimeToBeIdle()
          Returns the wait time to consider that a resource is idle in seconds.
 Iterator 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.
 
Methods inherited from interface org.gvsig.tools.observer.Observable
addObserver, deleteObserver, deleteObservers
 

Method Detail

getResource

Resource getResource(String name)

iterator

Iterator iterator()
Returns an iterator over the available resources.

Returns:
iterator over the resources.

collectResources

void collectResources()
                      throws DataException
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
See Also:
ResourceManager#getTimeToBeIdle()} {@link ResourceManager#setTimeToBeIdle(int)}

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
See Also:
ResourceManager#collectResources()}, ResourceManager#startResourceCollector(long, Observer)}

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.

See Also:
ResourceManager#collectResources()}, ResourceManager#startResourceCollector(long, Observer)}

startResourceCollector

void startResourceCollector(long milis,
                            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

void closeResources()
                    throws DataException
Close all register resources.

Throws:
DataException

dispose

void dispose()
             throws DisposeResorceManagerException
Throws:
DisposeResorceManagerException


Copyright © 2004-2012 gvSIG. All Rights Reserved.