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 Type
    Method
    Description
    void
    Close all register resources.
    void
    Iterates over the resources and frees them if they are ready to be freed or try to close them if they are idle.
    void
     
     
    int
    Returns the wait time to consider that a resource is idle in seconds.
    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, org.gvsig.tools.observer.Observer observer)
    Initializes the resource collection background process.
    void
    Stops successive executions of the resource collector process.

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.gvsig.tools.observer.Observable

    addObserver, deleteObserver, deleteObservers
  • Method Details

    • getResource

      Resource getResource(String name)
    • iterator

      Iterator<Resource> iterator()
      Returns an iterator over the available resources.
      Specified by:
      iterator in interface Iterable<Resource>
      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
    • 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

      void closeResources() throws DataException
      Close all register resources.
      Throws:
      DataException
    • dispose

      void dispose() throws DisposeResorceManagerException
      Throws:
      DisposeResorceManagerException