Code example for RemovalNotification

Methods: getKeygetValue

0
        this.engineCache = engineCache; 
    } 
 
    @Override 
    public void onRemoval(RemovalNotification<String, QueryEngine> notification) { 
        QueryEngine qe = notification.getValue(); 
        // a refresh call that returns the current value can generate spurious events 
        QueryEngine currentEngine = engineCache.loadingEngineCache.asMap().get(notification.getKey()); 
        if (currentEngine != qe) { 
            assert qe != null; //we only use strong references 
            try { 
                qe.closeWhenIdle(); 
            } catch (Throwable t) { 
                log.error("Generic Error while closing Engine", t); 
            } 
            if (currentEngine == null) { 
                directoriesEvicted.mark(); 
            } 
        } 
    }