Class CacheIndexHolder

java.lang.Object
net.adoptopenjdk.icedteaweb.resources.cache.CacheIndexHolder

class CacheIndexHolder extends Object
Holder of the cached LeastRecentlyUsedCacheIndex data. The responsibility of this class is to make sure that access to the content of the LeastRecentlyUsedCacheIndex is synchronized and any changes are written back to the file system.
  • Field Details

  • Constructor Details

  • Method Details

    • runSynchronized

      void runSynchronized(Consumer<CacheIndex> action)
      Executes the code passed in action in a synchronized fashion to allow exclusive access to the index.
    • getSynchronized

      <T> T getSynchronized(Function<CacheIndex, T> action)
      Executes the function passed in action in a synchronized fashion to allow exclusive access to the index.
      Returns:
      the result of the passed function.
    • lockCacheFile

      private CacheIndexFile lockCacheFile()
      Lock the properties file to have exclusive access.
    • unlockCacheFile

      private void unlockCacheFile(CacheIndexFile cacheFile)
      Unlock the properties file.
    • load

      private CacheIndex load(CacheIndexFile cacheFile)
      Loads the data from the properties file into an index.
    • persistChanges

      private void persistChanges(CacheIndexFile cacheFile)
      Write file to disk.
    • getCacheFile

      private CacheIndexFile getCacheFile()
      Returns:
      the recentlyUsedPropertiesFile
    • loadOldIndex

      private CacheIndexFile loadOldIndex()
    • convertOldId

      private String convertOldId(String id)