public static UploadStagingCache build(File dir, File home, int uploadThreads, long size /* bytes */, StagingUploader uploader, @Nullable FileCache cache, StatisticsProvider statisticsProvider, @Nullable ListeningExecutorService executor, @Nullable ScheduledExecutorService scheduledExecutor, int purgeInterval /* secs */, int retryInterval /* secs */) { if (size > 0) { return new UploadStagingCache(dir, home, uploadThreads, size, uploader, cache, statisticsProvider, executor, scheduledExecutor, purgeInterval, retryInterval); } return new UploadStagingCache() { @Override public Optional<SettableFuture<Integer>> put(String id, File input) { return Optional.absent(); } @Override protected void invalidate(String key) { } @Override protected Iterator<String> getAllIdentifiers() { return Collections.emptyIterator(); } @Nullable @Override public File getIfPresent(String key) { return null; } @Override public DataStoreCacheStatsMBean getStats() { return new StagingCacheStats(this, StatisticsProvider.NOOP, 0); } @Override public void close() { } }; }
public static UploadStagingCache build(File dir, File home, int uploadThreads, long size /* bytes */, StagingUploader uploader, @Nullable FileCache cache, StatisticsProvider statisticsProvider, @Nullable ListeningExecutorService executor, @Nullable ScheduledExecutorService scheduledExecutor, int purgeInterval /* secs */, int retryInterval /* secs */) { if (size > 0) { return new UploadStagingCache(dir, home, uploadThreads, size, uploader, cache, statisticsProvider, executor, scheduledExecutor, purgeInterval, retryInterval); } return new UploadStagingCache() { @Override public Optional<SettableFuture<Integer>> put(String id, File input) { return Optional.absent(); } @Override protected void invalidate(String key) { } @Override protected Iterator<String> getAllIdentifiers() { return Collections.emptyIterator(); } @Nullable @Override public File getIfPresent(String key) { return null; } @Override public DataStoreCacheStatsMBean getStats() { return new StagingCacheStats(this, StatisticsProvider.NOOP, 0); } @Override public void close() { } }; }
public static UploadStagingCache build(File dir, File home, int uploadThreads, long size /* bytes */, StagingUploader uploader, @Nullable FileCache cache, StatisticsProvider statisticsProvider, @Nullable ListeningExecutorService executor, @Nullable ScheduledExecutorService scheduledExecutor, int purgeInterval /* secs */, int retryInterval /* secs */) { if (size > 0) { return new UploadStagingCache(dir, home, uploadThreads, size, uploader, cache, statisticsProvider, executor, scheduledExecutor, purgeInterval, retryInterval); } return new UploadStagingCache() { @Override public Optional<SettableFuture<Integer>> put(String id, File input) { return Optional.absent(); } @Override protected void invalidate(String key) { } @Override protected Iterator<String> getAllIdentifiers() { return Collections.emptyIterator(); } @Nullable @Override public File getIfPresent(String key) { return null; } @Override public DataStoreCacheStatsMBean getStats() { return new StagingCacheStats(this, StatisticsProvider.NOOP, 0); } @Override public void close() { } }; }