Clone
Marc Philipp
committed
on 09 Jul 18
Avoid reinitializing DefaultPersistentDirectoryStores
Prior to this commit, adding a `CleanupAction` when building a
`PersistentCache` using… Show more
Avoid reinitializing DefaultPersistentDirectoryStores

Prior to this commit, adding a `CleanupAction` when building a

`PersistentCache` using `CacheBuilder.withCleanup()` caused the used

implementation class to be changed from

`DefaultPersistentDirectoryStore` to `DefaultPersistentDirectoryCache`.

The latter adds initialization logic and has a very strict check in

place that verifies whether the lock file has been unlocked cleanly. If

not, it will delete all files in the cache in order to reinitialize it.

Since the mere addition of a cleanup action should not change such a

fundamental behavior, this commit moves the cleanup logic to the

`DefaultPersistentDirectoryStore` class and instantiates it when a

cleanup action is configured but no initialization related properties.

Show less

master + 438 more