Uploaded image for project: 'Commons JCS'
  1. Commons JCS
  2. JCS-199

Disk cache directory and files not recreated after shutdown and restart

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • jcs-2.2.1
    • jcs-3.0
    • Composite Cache
    • None

    Description

      How to repro

      1. Configure a composite cache with an indexed disk cache as the auxiliary.
      2. Now in one single JVM (e.g. in a single main method), do the following:
        1. Create the cache, possibly putting something in.
        2. Note that the disk cache files are created
        3. JCS.shutdown()
        4. Remove the files of the disk cache
        5. Create the cache again.
        6. Put stuff in

      What to observe

      The disk cache files are not created again.

      In fact, the logging for the first run shows output like this:

      INFORMATION: Constructed cache with name [CACHE] and cache attributes [ useLateral = true, useRemote = true, useDisk = true, maxObjs = 1, maxSpoolPerRun = 500, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
      Jun 25, 2019 4:19:58 PM org.apache.commons.jcs.auxiliary.AuxiliaryCacheConfigurator parseCacheEventLogger
      INFORMATION: No cache event logger defined for auxiliary [jcs.auxiliary.DISK]
      Jun 25, 2019 4:19:58 PM org.apache.commons.jcs.auxiliary.AuxiliaryCacheConfigurator parseElementSerializer
      INFORMATION: Using standard serializer [org.apache.commons.jcs.utils.serialization.StandardSerializer@1ddf84b8] for auxiliary [jcs.auxiliary.DISK]
      [...]
      Jun 25, 2019 4:19:59 PM org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache <init>
      INFORMATION: Region [CACHE] Indexed Disk Cache is alive.
      

      The logging of the second run shows output like this:

      INFORMATION: Constructed cache with name [CACHE] and cache attributes [ useLateral = true, useRemote = true, useDisk = true, maxObjs = 1, maxSpoolPerRun = 500, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
      

      Please note that in the latter case the lines about initializing the IndexedDiskCache are missing, event though the configuration states that a disk cache is to be used.

      What is expected

      In the second run, the disk cache files should be created again as a consequence of creating new auxiliary caches. It is expected that shutting down the JCS will shut down every subsystem.

      Relevance

      The issue comes up when restarting a web API system including deleting the contents of the temporary directory.

      Note

      The bug may be fixed by setting the instance field in CompositeCacheManager to null at some point during the shutdown process. Maybe in CompositeCacheManager.shutdown().

       

      Attachments

        Activity

          People

            tv Thomas Vandahl
            mjmjmj Matthias Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: