    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.jigsaw.resources.ResourceStoreManager

    java.lang.Object
       |
       +----w3c.jigsaw.resources.ResourceStoreManager

public class ResourceStoreManager
extends Object

##

closed
  Is this store shutdown ?
entries
  The loaded resource stores.
head
  The fake head of our LRU list for store entries.
server
  The server we are attached to.
state
sweeper
  Our sweeper thread:
tail
  The fake tail of our LRU list fro store entries.

##

ResourceStoreManager(httpd)
  Create a new resource store for the given server.

##

checkClosed()
  Check that this resource store manager isn't closed.
checkpoint()
  Checkpoint all modified resource stores, by saving them to disk.
collect()
  Collect enough entries to go back into fixed limits.
createResourceStoreRepository()
  Create a resource store repository name.
getMaxEntries()
loadResourceStore(ResourceStoreHolder, File)
  Load a resource store.
lookupEntry(File, ResourceStoreHolder, boolean)
  Lookup an entry in the store.
markUsed(File)
  Mark the given store as having been used recently.
pickLRUEntry()
  Pick the least recently used entry, and remove all links to it.
shutdown()
  Shutdown this resource store manager.
unholdResourceStore(ResourceStoreHolder, File)
  Unhold the given store.

##

entries

      protected Hashtable entries

  The loaded resource stores.

closed

      protected boolean closed

  Is this store shutdown ?

server

      protected httpd server

  The server we are attached to.

head

      protected StoreEntry head

  The fake head of our LRU list for store entries.

tail

      protected StoreEntry tail

  The fake tail of our LRU list fro store entries.

state

      protected ResourceStoreState state

sweeper

      protected StoreManagerSweeper sweeper

  Our sweeper thread:

##

ResourceStoreManager

      public ResourceStoreManager(httpd server)

  Create a new resource store for the given server.
  Parameters:
    server - The server that wants a resource store manager.

##

getMaxEntries

      protected final int getMaxEntries()

checkClosed

      protected final synchronized void checkClosed()

  Check that this resource store manager isn't closed.
  Throws: RuntimeException
    If the store manager was closed.

lookupEntry

      protected synchronized StoreEntry lookupEntry(File repository,
                                                    ResourceStoreHolder holder,
                                                    boolean create)

  Lookup an entry in the store.
  Parameters:
    repository - The repository of the store to lookup.
    create - Create a new entry if it doesn't exist.

pickLRUEntry

      protected synchronized StoreEntry pickLRUEntry()

  Pick the least recently used entry, and remove all links to it. After this method as run, the least recently used entry for some store will be returned. The store manager will have discarded all its link to it, and the entry shutdown will have to be performed by the caller.
  Returns:
    An StoreEntry instance, to be cleaned up.

collect

      public void collect()

  Collect enough entries to go back into fixed limits.

loadResourceStore

      public ResourceStore loadResourceStore(ResourceStoreHolder holder,
                                             File repository)

  Load a resource store.
  Parameters:
    holder - The holder for the resource store.
    repository - Its associated repository.

createResourceStoreRepository

      public String createResourceStoreRepository()

  Create a resource store repository name. This method will return a new resource store repository key. When used in conjunction with the `loadResourceStore` method that takes a key as a parameter, this allows to caller to abstract itself from the physicall location of the repository.
  Returns:
    A fresh resource store key, guaranteed to be uniq.

unholdResourceStore

      public void unholdResourceStore(ResourceStoreHolder holder,
                                      File repository)

  Unhold the given store. For some reason, the holder for this store has decided to close it. Remove from ths list of this store holder. When this call is made, the caller is expected to have cleaned-up the store (stabilize it, etc).
  Parameters:
    holder - The holder of the store.
    store - The store this holder doesn't want to hold anymore.

shutdown

      public synchronized void shutdown()

  Shutdown this resource store manager. Go through all entries, and shut them down.

checkpoint

      public synchronized void checkpoint()

  Checkpoint all modified resource stores, by saving them to disk.

markUsed

      public void markUsed(File repository)

  Mark the given store as having been used recently.
  Parameters:
    repository - The repository of the store that has been used.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index