test_class.declarator: ID_PREFIX = "12345"
test_class.modifier: private static final
test_class.original_string: private static final String ID_PREFIX = "12345";
test_class.type: String
test_class.var_name: ID_PREFIX
test_class.declarator: cache
test_class.modifier: private
test_class.original_string: private FileCache cache;
test_class.type: FileCache
test_class.var_name: cache
test_class.declarator: root
test_class.modifier: private
test_class.original_string: private File root;
test_class.type: File
test_class.var_name: root
test_class.declarator: loader
test_class.modifier: private
test_class.original_string: private TestCacheLoader loader;
test_class.type: TestCacheLoader
test_class.var_name: loader
test_class.declarator: closer
test_class.modifier: private
test_class.original_string: private Closer closer;
test_class.type: Closer
test_class.var_name: closer
test_class.declarator: expectedEx = ExpectedException.none()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public ExpectedException expectedEx = ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: expectedEx
test_class.declarator: folder = new TemporaryFolder(new File("target"))
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public TemporaryFolder folder = new TemporaryFolder(new File("target"));
test_class.type: TemporaryFolder
test_class.var_name: folder
test_class.declarator: testName = new TestName()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public TestName testName = new TestName();
test_class.type: TestName
test_class.var_name: testName
test_class.declarator: afterExecuteLatch
test_class.original_string: CountDownLatch afterExecuteLatch;
test_class.type: CountDownLatch
test_class.var_name: afterExecuteLatch
test_class.file: oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/FileCacheTest.java
test_class.identifier: FileCacheTest
test_class.superclass: extends AbstractDataStoreCacheTest
test_case.body: @Test
      public void retrievePutConcurrent() throws Exception {
          LOG.info("Started retrievePutConcurrent");
  
          //Create load
          final File f = createFile(0, loader, cache, folder);
          File f2 = copyToFile(randomStream(1, 4 * 1024), folder.newFile());
  
          ListeningExecutorService executorService =
              MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2));
          closer.register(new ExecutorCloser(executorService, 5, TimeUnit.MILLISECONDS));
  
          CountDownLatch thread1Start = new CountDownLatch(1);
          SettableFuture<File> future1 =
              retrieveThread(executorService, ID_PREFIX + 0, cache, thread1Start);
  
          CountDownLatch thread2Start = new CountDownLatch(1);
          SettableFuture<Boolean> future2 = putThread(executorService, 1, f2, cache, thread2Start);
  
          thread1Start.countDown();
          thread2Start.countDown();
  
          future1.get();
          future2.get();
          LOG.info("Async tasks finished");
  
          assertCacheIfPresent(0, cache, f);
          assertCacheIfPresent(1, cache, copyToFile(randomStream(1, 4 * 1024), folder.newFile()));
          assertCacheStats(cache, 2, 8 * 1024, 1, 1);
  
          LOG.info("Finished retrievePutConcurrent");
      }
test_case.class_method_signature: FileCacheTest.retrievePutConcurrent()
test_case.full_signature: @Test public void retrievePutConcurrent()
test_case.identifier: retrievePutConcurrent
test_case.invocations: info createFile copyToFile randomStream newFile listeningDecorator newFixedThreadPool register retrieveThread putThread countDown countDown get get info assertCacheIfPresent assertCacheIfPresent copyToFile randomStream newFile assertCacheStats info
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void retrievePutConcurrent()
focal_class.declarator: LOG = LoggerFactory.getLogger(FileCache.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(FileCache.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: SEGMENT_COUNT = Integer.getInteger("oak.blob.fileCache.segmentCount", 1)
focal_class.modifier: private static final
focal_class.original_string: private static final int SEGMENT_COUNT = Integer.getInteger("oak.blob.fileCache.segmentCount", 1);
focal_class.type: int
focal_class.var_name: SEGMENT_COUNT
focal_class.declarator: DOWNLOAD_DIR = "download"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String DOWNLOAD_DIR = "download";
focal_class.type: String
focal_class.var_name: DOWNLOAD_DIR
focal_class.declarator: parent
focal_class.modifier: private
focal_class.original_string: private File parent;
focal_class.type: File
focal_class.var_name: parent
focal_class.declarator: cacheRoot
focal_class.modifier: private
focal_class.original_string: private File cacheRoot;
focal_class.type: File
focal_class.var_name: cacheRoot
focal_class.declarator: cache
focal_class.modifier: private
focal_class.original_string: private CacheLIRS<String, File> cache;
focal_class.type: CacheLIRS<String, File>
focal_class.var_name: cache
focal_class.declarator: cacheStats
focal_class.modifier: private
focal_class.original_string: private FileCacheStats cacheStats;
focal_class.type: FileCacheStats
focal_class.var_name: cacheStats
focal_class.declarator: executor
focal_class.modifier: private
focal_class.original_string: private ExecutorService executor;
focal_class.type: ExecutorService
focal_class.var_name: executor
focal_class.declarator: cacheLoader
focal_class.modifier: private
focal_class.original_string: private CacheLoader<String, File> cacheLoader;
focal_class.type: CacheLoader<String, File>
focal_class.var_name: cacheLoader
focal_class.declarator: weigher = new Weigher<String, File>() {
          @Override public int weigh(String key, File value) {
              // convert to number of 4 KB blocks
              return Math.round(value.length() / (4 * 1024));
          }}
focal_class.modifier: private static final
focal_class.original_string: private static final Weigher<String, File> weigher = new Weigher<String, File>() {
          @Override public int weigh(String key, File value) {
              // convert to number of 4 KB blocks
              return Math.round(value.length() / (4 * 1024));
          }};
focal_class.type: Weigher<String, File>
focal_class.var_name: weigher
focal_class.declarator: memWeigher = new Weigher<String, File>() {
          @Override public int weigh(String key, File value) {
              return (StringUtils.estimateMemoryUsage(key) +
                  StringUtils.estimateMemoryUsage(value.getAbsolutePath()) + 48);
          }}
focal_class.modifier: private static final
focal_class.original_string: private static final Weigher<String, File> memWeigher = new Weigher<String, File>() {
          @Override public int weigh(String key, File value) {
              return (StringUtils.estimateMemoryUsage(key) +
                  StringUtils.estimateMemoryUsage(value.getAbsolutePath()) + 48);
          }};
focal_class.type: Weigher<String, File>
focal_class.var_name: memWeigher
focal_class.file: oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/FileCache.java
focal_class.identifier: FileCache
focal_class.interfaces: implements Closeable
focal_class.class_method_signature: FileCache.FileCache(long maxSize /* bytes */, File root,
          final CacheLoader<String, InputStream> loader, @Nullable final ExecutorService executor)
focal_class.full_signature: private  FileCache(long maxSize /* bytes */, File root,
          final CacheLoader<String, InputStream> loader, @Nullable final ExecutorService executor)
focal_class.identifier: FileCache
focal_class.modifiers: private
focal_class.parameters: (long maxSize /* bytes */, File root,
          final CacheLoader<String, InputStream> loader, @Nullable final ExecutorService executor)
focal_class.signature:  FileCache(long maxSize /* bytes */, File root,
          final CacheLoader<String, InputStream> loader, @Nullable final ExecutorService executor)
focal_class.class_method_signature: FileCache.FileCache()
focal_class.full_signature: private  FileCache()
focal_class.identifier: FileCache
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  FileCache()
focal_class.class_method_signature: FileCache.build(long maxSize /* bytes */, File root,
          final CacheLoader<String, InputStream> loader, @Nullable final ExecutorService executor)
focal_class.full_signature: public static FileCache build(long maxSize /* bytes */, File root,
          final CacheLoader<String, InputStream> loader, @Nullable final ExecutorService executor)
focal_class.identifier: build
focal_class.modifiers: public static
focal_class.parameters: (long maxSize /* bytes */, File root,
          final CacheLoader<String, InputStream> loader, @Nullable final ExecutorService executor)
focal_class.return: FileCache
focal_class.signature: FileCache build(long maxSize /* bytes */, File root,
          final CacheLoader<String, InputStream> loader, @Nullable final ExecutorService executor)
focal_class.class_method_signature: FileCache.put(String key, File file)
focal_class.full_signature: @Override public void put(String key, File file)
focal_class.identifier: put
focal_class.modifiers: @Override public
focal_class.parameters: (String key, File file)
focal_class.return: void
focal_class.signature: void put(String key, File file)
focal_class.class_method_signature: FileCache.put(String key, File file, boolean copy)
focal_class.full_signature: private void put(String key, File file, boolean copy)
focal_class.identifier: put
focal_class.modifiers: private
focal_class.parameters: (String key, File file, boolean copy)
focal_class.return: void
focal_class.signature: void put(String key, File file, boolean copy)
focal_class.class_method_signature: FileCache.containsKey(String key)
focal_class.full_signature: public boolean containsKey(String key)
focal_class.identifier: containsKey
focal_class.modifiers: public
focal_class.parameters: (String key)
focal_class.return: boolean
focal_class.signature: boolean containsKey(String key)
focal_class.class_method_signature: FileCache.getIfPresent(String key)
focal_class.full_signature: @Nullable public File getIfPresent(String key)
focal_class.identifier: getIfPresent
focal_class.modifiers: @Nullable public
focal_class.parameters: (String key)
focal_class.return: File
focal_class.signature: File getIfPresent(String key)
focal_class.class_method_signature: FileCache.getIfPresent(Object key)
focal_class.full_signature: @Nullable @Override public File getIfPresent(Object key)
focal_class.identifier: getIfPresent
focal_class.modifiers: @Nullable @Override public
focal_class.parameters: (Object key)
focal_class.return: File
focal_class.signature: File getIfPresent(Object key)
focal_class.class_method_signature: FileCache.get(String key)
focal_class.full_signature: public File get(String key)
focal_class.identifier: get
focal_class.modifiers: public
focal_class.parameters: (String key)
focal_class.return: File
focal_class.signature: File get(String key)
focal_class.class_method_signature: FileCache.invalidate(Object key)
focal_class.full_signature: @Override public void invalidate(Object key)
focal_class.identifier: invalidate
focal_class.modifiers: @Override public
focal_class.parameters: (Object key)
focal_class.return: void
focal_class.signature: void invalidate(Object key)
focal_class.class_method_signature: FileCache.getStats()
focal_class.full_signature: public DataStoreCacheStatsMBean getStats()
focal_class.identifier: getStats
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: DataStoreCacheStatsMBean
focal_class.signature: DataStoreCacheStatsMBean getStats()
focal_class.class_method_signature: FileCache.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: FileCache.build()
focal_class.full_signature: private int build()
focal_class.identifier: build
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int build()
focal_class.superclass: extends AbstractCache<String, File>
focal_method.body: public File get(String key) throws IOException {
          try {
              // get from cache and download if not available
              return cache.get(key, () -> cacheLoader.load(key));
          } catch (ExecutionException e) {
              LOG.error("Error loading [{}] from cache", key);
              throw new IOException(e);
          }
      }
focal_method.class_method_signature: FileCache.get(String key)
focal_method.full_signature: public File get(String key)
focal_method.identifier: get
focal_method.invocations: get load error
focal_method.modifiers: public
focal_method.parameters: (String key)
focal_method.return: File
focal_method.signature: File get(String key)