Matthias Jordan created JCS-199:
-----------------------------------
Summary: Disk cache directory and files not recreated after
shutdown and restart
Key: JCS-199
URL: https://issues.apache.org/jira/browse/JCS-199
Project: Commons JCS
Issue Type: Bug
Components: Composite Cache
Affects Versions: jcs-2.2.1
Reporter: Matthias Jordan
h1. How to repro
# Configure a composite cache with an indexed disk cache as the auxiliary.
# Now in one single JVM (e.g. in a single main method), do the following:
## Create the cache, possibly putting something in.
## Note that the disk cache files are created
## JCS.shutdown()
## Remove the files of the disk cache
## Create the cache again.
## Put stuff in
h1. What to observe
The disk cache files are not created again.
In fact, the logging for the first run shows output like this:
{noformat}
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.
{noformat}
The logging of the second run shows output like this:
{noformat}
INFORMATION: Constructed cache with name [CACHE] and cache attributes [
useLateral = true, useRemote = true, useDisk = true, maxObjs = 1,
maxSpoolPerRun = 500, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
{noformat}
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.
h1. 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.
h1. Relevance
The issue comes up when restarting a web API system including deleting the
contents of the temporary directory.
h1. 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()}}.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)