[jboss-cvs] JBossAS SVN: r82703 - projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 8 10:34:08 EST 2009


Author: alesj
Date: 2009-01-08 10:34:08 -0500 (Thu, 08 Jan 2009)
New Revision: 82703

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java
Log:
The started flag.

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java	2009-01-08 14:48:36 UTC (rev 82702)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java	2009-01-08 15:34:08 UTC (rev 82703)
@@ -47,7 +47,7 @@
 {
    private boolean initializing;
 
-   private MapVFSCache permanentCache = new PermanentVFSCache();
+   private PermanentVFSCache permanentCache = new PermanentVFSCache();
    private VFSCache realCache;
 
    /**
@@ -56,10 +56,13 @@
     * @param initializationEntries the initialization entries
     * @throws IOException for any error
     */
-   public void setPermanentRoots(Map<URL, ExceptionHandler> initializationEntries) throws IOException
+   public void setPermanentRoots(Map<URL, ExceptionHandler> initializationEntries) throws Exception
    {
       if (initializationEntries != null && initializationEntries.isEmpty() == false)
       {
+         if (permanentCache.isStarted() == false)
+            permanentCache.start();
+
          initializing = true;
          try
          {
@@ -99,7 +102,7 @@
    /**
     * Check if real cache has been set.
     */
-   public void check()
+   private void check()
    {
       if (realCache == null)
          realCache = new NoopVFSCache();
@@ -150,12 +153,14 @@
 
    public void start() throws Exception
    {
-      permanentCache.start();
+      if (permanentCache.isStarted() == false)
+         permanentCache.start();
    }
 
    public void stop()
    {
-      permanentCache.stop();
+      if (permanentCache.isStarted())
+         permanentCache.stop();
    }
 
    public void flush()
@@ -211,9 +216,28 @@
 
    private class PermanentVFSCache extends MapVFSCache
    {
+      private boolean started;
+
       protected Map<String, VFSContext> createMap()
       {
          return new TreeMap<String, VFSContext>();
       }
+
+      @Override
+      public void start() throws Exception
+      {
+         super.start();
+         started = true;
+      }
+
+      /**
+       * Is the cache started.
+       *
+       * @return the started flag
+       */
+      public boolean isStarted()
+      {
+         return started;
+      }
    }
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list