com.google.common.cache.RemovalListener Java Examples
The following examples show how to use
com.google.common.cache.RemovalListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CachingTextExtractor.java From james-project with Apache License 2.0 | 6 votes |
public CachingTextExtractor(TextExtractor underlying, Duration cacheEvictionPeriod, Long cacheWeightInBytes, MetricFactory metricFactory, GaugeRegistry gaugeRegistry) { this.underlying = underlying; this.weightMetric = metricFactory.generate("textExtractor.cache.weight"); Weigher<String, ParsedContent> weigher = (key, parsedContent) -> computeWeight(parsedContent); RemovalListener<String, ParsedContent> removalListener = notification -> Optional.ofNullable(notification.getValue()) .map(this::computeWeight) .ifPresent(weightMetric::remove); this.cache = CacheBuilder.newBuilder() .expireAfterAccess(cacheEvictionPeriod.toMillis(), TimeUnit.MILLISECONDS) .maximumWeight(cacheWeightInBytes) .weigher(weigher) .recordStats() .removalListener(removalListener) .build(); recordStats(gaugeRegistry); }
Example #2
Source File: FileWatcherRegistry.java From arcusplatform with Apache License 2.0 | 6 votes |
/** * */ public FileWatcherRegistry() { this.watchers = CacheBuilder .newBuilder() .removalListener(new RemovalListener<Path, FileWatcherRegistry.Watcher>() { @Override public void onRemoval(RemovalNotification<Path, Watcher> notification) { notification.getValue().stop(); } }) .build(new CacheLoader<Path, Watcher>() { @Override public FileWatcherRegistry.Watcher load(Path key) throws Exception { return watch(key); } }); this.executor = new ThreadPoolBuilder() .withNameFormat("resource-watcher-%d") .withMetrics("resource.watcher") .build(); }
Example #3
Source File: ClientGroupManager.java From joyqueue with Apache License 2.0 | 6 votes |
@Override protected void validate() throws Exception { clientGroupCache = CacheBuilder.newBuilder() .expireAfterAccess(config.getChannelMaxIdleTime(), TimeUnit.MILLISECONDS) .removalListener(new RemovalListener<BrokerNode, ClientGroup>() { @Override public void onRemoval(RemovalNotification<BrokerNode, ClientGroup> removalNotification) { try { removalNotification.getValue().stop(); } catch (Exception e) { logger.error("close client exception, address: {}, error: {}", removalNotification.getKey().getHost(), e.getMessage()); logger.debug("close client exception, address: {}", removalNotification.getKey().getHost(), e); } } }) .build(); }
Example #4
Source File: SnapshotManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private SnapshotManager(KylinConfig config) { this.config = config; this.snapshotCache = CacheBuilder.newBuilder().removalListener(new RemovalListener<String, SnapshotTable>() { @Override public void onRemoval(RemovalNotification<String, SnapshotTable> notification) { SnapshotManager.logger.info("Snapshot with resource path {} is removed due to {}", notification.getKey(), notification.getCause()); } }).maximumSize(config.getCachedSnapshotMaxEntrySize())// .expireAfterWrite(1, TimeUnit.DAYS).build(new CacheLoader<String, SnapshotTable>() { @Override public SnapshotTable load(String key) throws Exception { SnapshotTable snapshotTable = SnapshotManager.this.load(key, true); return snapshotTable; } }); }
Example #5
Source File: PlatformAlarmIncidentService.java From arcusplatform with Apache License 2.0 | 6 votes |
@Inject public PlatformAlarmIncidentService( SubsystemRegistry registry, AlarmIncidentDAO incidentDao, AlarmIncidentHistoryListener historyListener, PlatformMessageBus platformBus, PlacePopulationCacheManager populationCacheMgr ) { super(registry, incidentDao, historyListener, platformBus, populationCacheMgr); this.platformBus = platformBus; this.cancelCache = CacheBuilder.newBuilder() .recordStats() .concurrencyLevel(cancelTimeoutConcurrency) .expireAfterWrite(cancelTimeoutSeconds, TimeUnit.SECONDS) .removalListener((RemovalListener<String, SettableFuture<Void>>) notification -> { if(notification.wasEvicted() && notification.getValue() != null) { notification.getValue().setException(new TimeoutException()); } }) .build(); cleanUpScheduler.scheduleAtFixedRate(cancelCache::cleanUp, 0, cancelCleanupSecs, TimeUnit.SECONDS); }
Example #6
Source File: ExtTableSnapshotInfoManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private ExtTableSnapshotInfoManager(KylinConfig config) { this.config = config; this.snapshotCache = CacheBuilder.newBuilder().removalListener(new RemovalListener<String, ExtTableSnapshotInfo>() { @Override public void onRemoval(RemovalNotification<String, ExtTableSnapshotInfo> notification) { ExtTableSnapshotInfoManager.logger.info("Snapshot with resource path " + notification.getKey() + " is removed due to " + notification.getCause()); } }).maximumSize(1000)// .expireAfterWrite(1, TimeUnit.DAYS).build(new CacheLoader<String, ExtTableSnapshotInfo>() { @Override public ExtTableSnapshotInfo load(String key) throws Exception { ExtTableSnapshotInfo snapshot = ExtTableSnapshotInfoManager.this.load(key); return snapshot; } }); }
Example #7
Source File: RocksDBLookupTableCache.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private void init() { this.basePath = getCacheBasePath(config); this.maxCacheSizeInKB = (long) (config.getExtTableSnapshotLocalCacheMaxSizeGB() * 1024 * 1024); this.tablesCache = CacheBuilder.newBuilder().removalListener(new RemovalListener<String, CachedTableInfo>() { @Override public void onRemoval(RemovalNotification<String, CachedTableInfo> notification) { logger.warn(notification.getValue() + " is removed " + "because of " + notification.getCause()); notification.getValue().cleanStorage(); } }).maximumWeight(maxCacheSizeInKB).weigher(new Weigher<String, CachedTableInfo>() { @Override public int weigh(String key, CachedTableInfo value) { return value.getSizeInKB(); } }).build(); restoreCacheState(); cacheStateChecker = new CacheStateChecker(); initExecutors(); }
Example #8
Source File: DictionaryManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private DictionaryManager(KylinConfig config) { this.config = config; this.dictCache = CacheBuilder.newBuilder()// .softValues()// .removalListener(new RemovalListener<String, DictionaryInfo>() { @Override public void onRemoval(RemovalNotification<String, DictionaryInfo> notification) { DictionaryManager.logger.info("Dict with resource path {} is removed due to {}", notification.getKey(), notification.getCause()); } })// .maximumSize(config.getCachedDictMaxEntrySize())// .expireAfterWrite(1, TimeUnit.DAYS).build(new CacheLoader<String, DictionaryInfo>() { @Override public DictionaryInfo load(String key) throws Exception { DictionaryInfo dictInfo = DictionaryManager.this.load(key, true); if (dictInfo == null) { return NONE_INDICATOR; } else { return dictInfo; } } }); }
Example #9
Source File: SourceManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private SourceManager(KylinConfig config) { this.systemConfig = config; this.sourceMap = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.DAYS) .removalListener(new RemovalListener<String, ISource>() { @Override public void onRemoval(RemovalNotification<String, ISource> entry) { ISource s = entry.getValue(); if (s != null) { try { s.close(); } catch (Throwable e) { logger.error("Failed to close ISource: {}", s.getClass().getName(), e); } } } }).build(); }
Example #10
Source File: RqdClientGrpc.java From OpenCue with Apache License 2.0 | 6 votes |
private void buildChannelCache() { this.channelCache = CacheBuilder.newBuilder() .maximumSize(rqdCacheSize) .expireAfterAccess(rqdCacheExpiration, TimeUnit.MINUTES) .removalListener(new RemovalListener<String, ManagedChannel>() { @Override public void onRemoval(RemovalNotification<String, ManagedChannel> removal){ ManagedChannel conn = removal.getValue(); conn.shutdown(); } }) .build( new CacheLoader<String, ManagedChannel>() { @Override public ManagedChannel load(String host) throws Exception { ManagedChannelBuilder channelBuilder = ManagedChannelBuilder.forAddress( host, rqdServerPort).usePlaintext(); return channelBuilder.build(); } }); }
Example #11
Source File: GuavaCache6.java From blog with BSD 2-Clause "Simplified" License | 6 votes |
public static void main(String[] args) throws InterruptedException { RemovalListener<String, String> listener = new RemovalListener<String, String>() { public void onRemoval(RemovalNotification<String, String> notification) { System.out.println("[" + notification.getKey() + ":" + notification.getValue() + "] is removed!"); } }; Cache<String, String> cache = CacheBuilder.newBuilder().maximumSize(3).removalListener(listener).build(); Object value = new Object(); cache.put("key1", "value1"); cache.put("key2", "value2"); cache.put("key3", "value3"); cache.put("key4", "value3"); cache.put("key5", "value3"); cache.put("key6", "value3"); cache.put("key7", "value3"); cache.put("key8", "value3"); }
Example #12
Source File: UnitTest.java From albert with MIT License | 6 votes |
public void getNameLoadingCache(String name) throws Exception{ LoadingCache<String, String> cache = CacheBuilder.newBuilder() //设置大小,条目数 .maximumSize(20) //设置失效时间,创建时间 .expireAfterWrite(20, TimeUnit.SECONDS) //设置时效时间,最后一次被访问 .expireAfterAccess(20, TimeUnit.HOURS) //移除缓存的监听器 .removalListener(new RemovalListener<String, String>() { public void onRemoval(RemovalNotification<String, String> notification) { System.out.println("有缓存数据被移除了"); }}) //缓存构建的回调 .build(new CacheLoader<String, String>(){//加载缓存 @Override public String load(String key) throws Exception { return key + "-" + "iamzhongyong"; } }); System.out.println(cache.get(name)); cache.invalidateAll(); }
Example #13
Source File: TestGuava.java From albert with MIT License | 6 votes |
/** * 不需要延迟处理(泛型的方式封装) * @return */ public <K , V> LoadingCache<K , V> cached(CacheLoader<K , V> cacheLoader) { LoadingCache<K , V> cache = CacheBuilder .newBuilder() .maximumSize(2) .weakKeys() .softValues() .refreshAfterWrite(120, TimeUnit.SECONDS) .expireAfterWrite(10, TimeUnit.MINUTES) .removalListener(new RemovalListener<K, V>(){ @Override public void onRemoval(RemovalNotification<K, V> rn) { System.out.println(rn.getKey()+"被移除"); }}) .build(cacheLoader); return cache; }
Example #14
Source File: PageCacheBuilder.java From hermes with Apache License 2.0 | 6 votes |
private LoadingCache<Long, Page<T>> buildCache(int size) { return CacheBuilder.newBuilder().concurrencyLevel(1).initialCapacity(size).maximumSize(size) .removalListener(new RemovalListener<Long, Page<T>>() { @Override public void onRemoval(RemovalNotification<Long, Page<T>> notification) { m_recentlyExpiredPagesCache.get().put(notification.getKey(), true); } }).build(new CacheLoader<Long, Page<T>>() { @Override public Page<T> load(Long pageNo) throws Exception { return new Page<>(pageNo, m_pageSize, m_pageLoadIntervalMillis); } }); }
Example #15
Source File: KeyProviderCache.java From hadoop with Apache License 2.0 | 6 votes |
public KeyProviderCache(long expiryMs) { cache = CacheBuilder.newBuilder() .expireAfterAccess(expiryMs, TimeUnit.MILLISECONDS) .removalListener(new RemovalListener<URI, KeyProvider>() { @Override public void onRemoval( RemovalNotification<URI, KeyProvider> notification) { try { notification.getValue().close(); } catch (Throwable e) { LOG.error( "Error closing KeyProvider with uri [" + notification.getKey() + "]", e); ; } } }) .build(); }
Example #16
Source File: KMSAudit.java From hadoop with Apache License 2.0 | 6 votes |
/** * Create a new KMSAudit. * * @param windowMs Duplicate events within the aggregation window are quashed * to reduce log traffic. A single message for aggregated * events is printed at the end of the window, along with a * count of the number of aggregated events. */ KMSAudit(long windowMs) { cache = CacheBuilder.newBuilder() .expireAfterWrite(windowMs, TimeUnit.MILLISECONDS) .removalListener( new RemovalListener<String, AuditEvent>() { @Override public void onRemoval( RemovalNotification<String, AuditEvent> entry) { AuditEvent event = entry.getValue(); if (event.getAccessCount().get() > 0) { KMSAudit.this.logEvent(event); event.getAccessCount().set(0); KMSAudit.this.cache.put(entry.getKey(), event); } } }).build(); executor = Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder() .setDaemon(true).setNameFormat(KMS_LOGGER_NAME + "_thread").build()); executor.scheduleAtFixedRate(new Runnable() { @Override public void run() { cache.cleanUp(); } }, windowMs / 10, windowMs / 10, TimeUnit.MILLISECONDS); }
Example #17
Source File: WorkerStubs.java From bazel-buildfarm with Apache License 2.0 | 6 votes |
public static LoadingCache create(DigestUtil digestUtil) { return CacheBuilder.newBuilder() .expireAfterAccess(10, TimeUnit.MINUTES) .removalListener( new RemovalListener<String, Instance>() { @Override public void onRemoval(RemovalNotification<String, Instance> notification) { stopInstance(notification.getValue()); } }) .build( new CacheLoader<String, Instance>() { @Override public Instance load(String worker) { return newStubInstance(worker, digestUtil); } }); }
Example #18
Source File: VertexCache.java From grakn with GNU Affero General Public License v3.0 | 6 votes |
public VertexCache(long maxCacheSize, int concurrencyLevel, int initialDirtySize) { volatileVertices = new ConcurrentHashMap<>(initialDirtySize); cache = CacheBuilder.newBuilder() .maximumSize(maxCacheSize) .concurrencyLevel(concurrencyLevel) .removalListener((RemovalListener<Long, InternalVertex>) notification -> { if (notification.getCause() == RemovalCause.EXPLICIT) { //Due to invalidation at the end return; } //We get here if the entry is evicted because of size constraint or replaced through add //i.e. RemovalCause.SIZE or RemovalCause.REPLACED InternalVertex v = notification.getValue(); if (((AbstractVertex) v).isTxOpen() && (v.isModified() || v.isRemoved())) { //move vertex to volatile map if we cannot lose track of it volatileVertices.putIfAbsent(notification.getKey(), v); } }) .build(); }
Example #19
Source File: ZKDiscoveryService.java From twill with Apache License 2.0 | 6 votes |
/** * Constructs ZKDiscoveryService using the provided zookeeper client for storing service registry under namespace. * @param zkClient of zookeeper quorum * @param namespace under which the service registered would be stored in zookeeper. * If namespace is {@code null}, no namespace will be used. */ public ZKDiscoveryService(ZKClient zkClient, String namespace) { this.closed = new AtomicBoolean(); this.discoverables = HashMultimap.create(); this.lock = new ReentrantLock(); this.retryExecutor = Executors.newSingleThreadScheduledExecutor( Threads.createDaemonThreadFactory("zk-discovery-retry")); this.zkClient = namespace == null ? zkClient : ZKClients.namespace(zkClient, namespace); this.services = CacheBuilder.newBuilder() .removalListener(new RemovalListener<String, ServiceDiscoveredCacheEntry>() { @Override public void onRemoval(RemovalNotification<String, ServiceDiscoveredCacheEntry> notification) { ServiceDiscoveredCacheEntry entry = notification.getValue(); if (entry != null) { entry.cancel(); } } }) .build(createServiceLoader()); this.watcherCancellable = this.zkClient.addConnectionWatcher(createConnectionWatcher()); }
Example #20
Source File: KeyProviderCache.java From big-c with Apache License 2.0 | 6 votes |
public KeyProviderCache(long expiryMs) { cache = CacheBuilder.newBuilder() .expireAfterAccess(expiryMs, TimeUnit.MILLISECONDS) .removalListener(new RemovalListener<URI, KeyProvider>() { @Override public void onRemoval( RemovalNotification<URI, KeyProvider> notification) { try { notification.getValue().close(); } catch (Throwable e) { LOG.error( "Error closing KeyProvider with uri [" + notification.getKey() + "]", e); ; } } }) .build(); }
Example #21
Source File: KMSAudit.java From big-c with Apache License 2.0 | 6 votes |
/** * Create a new KMSAudit. * * @param windowMs Duplicate events within the aggregation window are quashed * to reduce log traffic. A single message for aggregated * events is printed at the end of the window, along with a * count of the number of aggregated events. */ KMSAudit(long windowMs) { cache = CacheBuilder.newBuilder() .expireAfterWrite(windowMs, TimeUnit.MILLISECONDS) .removalListener( new RemovalListener<String, AuditEvent>() { @Override public void onRemoval( RemovalNotification<String, AuditEvent> entry) { AuditEvent event = entry.getValue(); if (event.getAccessCount().get() > 0) { KMSAudit.this.logEvent(event); event.getAccessCount().set(0); KMSAudit.this.cache.put(entry.getKey(), event); } } }).build(); executor = Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder() .setDaemon(true).setNameFormat(KMS_LOGGER_NAME + "_thread").build()); executor.scheduleAtFixedRate(new Runnable() { @Override public void run() { cache.cleanUp(); } }, windowMs / 10, windowMs / 10, TimeUnit.MILLISECONDS); }
Example #22
Source File: SegmentStoreConnectionManager.java From pravega with Apache License 2.0 | 6 votes |
SegmentStoreConnectionManager(final ConnectionFactory clientCF) { this.cache = CacheBuilder.newBuilder() .maximumSize(Config.HOST_STORE_CONTAINER_COUNT) // if a host is not accessed for 5 minutes, remove it from the cache .expireAfterAccess(5, TimeUnit.MINUTES) .removalListener((RemovalListener<PravegaNodeUri, SegmentStoreConnectionPool>) removalNotification -> { // Whenever a connection manager is evicted from the cache call shutdown on it. removalNotification.getValue().shutdown(); }) .build(new CacheLoader<PravegaNodeUri, SegmentStoreConnectionPool>() { @Override @ParametersAreNonnullByDefault public SegmentStoreConnectionPool load(PravegaNodeUri nodeUri) { return new SegmentStoreConnectionPool(nodeUri, clientCF); } }); }
Example #23
Source File: PeriodicWatermarking.java From pravega with Apache License 2.0 | 6 votes |
@VisibleForTesting public PeriodicWatermarking(StreamMetadataStore streamMetadataStore, BucketStore bucketStore, Function<Stream, WatermarkClient> watermarkClientSupplier, ScheduledExecutorService executor) { this.streamMetadataStore = streamMetadataStore; this.bucketStore = bucketStore; this.executor = executor; this.watermarkClientCache = CacheBuilder.newBuilder() .maximumSize(MAX_CACHE_SIZE) .expireAfterAccess(10, TimeUnit.MINUTES) .removalListener((RemovalListener<Stream, WatermarkClient>) notification -> { notification.getValue().client.close(); }) .build(new CacheLoader<Stream, WatermarkClient>() { @ParametersAreNonnullByDefault @Override public WatermarkClient load(final Stream stream) { return watermarkClientSupplier.apply(stream); } }); }
Example #24
Source File: GrpcClient.java From rapid with Apache License 2.0 | 6 votes |
public GrpcClient(final Endpoint address, final SharedResources sharedResources, final ISettings settings) { this.address = address; this.settings = settings; this.grpcExecutor = sharedResources.getClientChannelExecutor(); this.backgroundExecutor = sharedResources.getBackgroundExecutor(); this.eventLoopGroup = settings.getUseInProcessTransport() ? null : sharedResources.getEventLoopGroup(); final RemovalListener<Endpoint, Channel> removalListener = removal -> shutdownChannel((ManagedChannel) removal.getValue()); this.channelMap = CacheBuilder.newBuilder() .expireAfterAccess(30, TimeUnit.SECONDS) .removalListener(removalListener) .build(new CacheLoader<Endpoint, Channel>() { @Override public Channel load(final Endpoint endpoint) { return getChannel(endpoint); } }); }
Example #25
Source File: NetflowV9CodecAggregator.java From graylog-plugin-netflow with Apache License 2.0 | 6 votes |
@Inject public NetflowV9CodecAggregator() { // TODO customize this.templateCache = CacheBuilder.newBuilder() .maximumSize(5000) .removalListener(notification -> LOG.debug("Removed {} from template cache for reason {}", notification.getKey(), notification.getCause())) .recordStats() .build(); this.packetCache = CacheBuilder.newBuilder() .expireAfterWrite(1, TimeUnit.MINUTES) .maximumWeight(Size.megabytes(1).toBytes()) .removalListener((RemovalListener<TemplateKey, Queue<PacketBytes>>) notification -> LOG.debug("Removed {} from packet cache for reason {}", notification.getKey(), notification.getCause())) .weigher((key, value) -> value.stream().map(PacketBytes::readableBytes).reduce(0, Integer::sum)) .recordStats() .build(); }
Example #26
Source File: SnapshotManager.java From kylin with Apache License 2.0 | 6 votes |
private SnapshotManager(KylinConfig config) { this.config = config; this.snapshotCache = CacheBuilder.newBuilder().removalListener(new RemovalListener<String, SnapshotTable>() { @Override public void onRemoval(RemovalNotification<String, SnapshotTable> notification) { SnapshotManager.logger.info("Snapshot with resource path {} is removed due to {}", notification.getKey(), notification.getCause()); } }).maximumSize(config.getCachedSnapshotMaxEntrySize())// .expireAfterWrite(1, TimeUnit.DAYS).build(new CacheLoader<String, SnapshotTable>() { @Override public SnapshotTable load(String key) throws Exception { SnapshotTable snapshotTable = SnapshotManager.this.load(key, true); return snapshotTable; } }); }
Example #27
Source File: ExtTableSnapshotInfoManager.java From kylin with Apache License 2.0 | 6 votes |
private ExtTableSnapshotInfoManager(KylinConfig config) { this.config = config; this.snapshotCache = CacheBuilder.newBuilder().removalListener(new RemovalListener<String, ExtTableSnapshotInfo>() { @Override public void onRemoval(RemovalNotification<String, ExtTableSnapshotInfo> notification) { ExtTableSnapshotInfoManager.logger.info("Snapshot with resource path " + notification.getKey() + " is removed due to " + notification.getCause()); } }).maximumSize(1000)// .expireAfterWrite(1, TimeUnit.DAYS).build(new CacheLoader<String, ExtTableSnapshotInfo>() { @Override public ExtTableSnapshotInfo load(String key) throws Exception { ExtTableSnapshotInfo snapshot = ExtTableSnapshotInfoManager.this.load(key); return snapshot; } }); }
Example #28
Source File: DictionaryManager.java From kylin with Apache License 2.0 | 6 votes |
private DictionaryManager(KylinConfig config) { this.config = config; this.dictCache = CacheBuilder.newBuilder()// .softValues()// .removalListener(new RemovalListener<String, DictionaryInfo>() { @Override public void onRemoval(RemovalNotification<String, DictionaryInfo> notification) { DictionaryManager.logger.info("Dict with resource path {} is removed due to {}", notification.getKey(), notification.getCause()); } })// .maximumSize(config.getCachedDictMaxEntrySize())// .expireAfterWrite(1, TimeUnit.DAYS).build(new CacheLoader<String, DictionaryInfo>() { @Override public DictionaryInfo load(String key) throws Exception { DictionaryInfo dictInfo = DictionaryManager.this.load(key, true); if (dictInfo == null) { return NONE_INDICATOR; } else { return dictInfo; } } }); }
Example #29
Source File: StorageContainerManager.java From hadoop-ozone with Apache License 2.0 | 6 votes |
/** * Initialize container reports cache that sent from datanodes. */ @SuppressWarnings("UnstableApiUsage") private Cache<String, ContainerStat> buildContainerReportCache() { return CacheBuilder.newBuilder() .expireAfterAccess(Long.MAX_VALUE, TimeUnit.MILLISECONDS) .maximumSize(Integer.MAX_VALUE) .removalListener(( RemovalListener<String, ContainerStat>) removalNotification -> { synchronized (containerReportCache) { ContainerStat stat = removalNotification.getValue(); if (stat != null) { // TODO: Are we doing the right thing here? // remove invalid container report metrics.decrContainerStat(stat); } if (LOG.isDebugEnabled()) { LOG.debug("Remove expired container stat entry for " + "datanode: {}.", removalNotification.getKey()); } } }) .build(); }
Example #30
Source File: DFSClientCache.java From big-c with Apache License 2.0 | 5 votes |
private RemovalListener<DFSInputStreamCaheKey, FSDataInputStream> inputStreamRemovalListener() { return new RemovalListener<DFSClientCache.DFSInputStreamCaheKey, FSDataInputStream>() { @Override public void onRemoval( RemovalNotification<DFSInputStreamCaheKey, FSDataInputStream> notification) { try { notification.getValue().close(); } catch (IOException ignored) { } } }; }