private MonitorInformation getMonitorInformation ( L location ) { final K monitorKey = getLocationKey ( location ) ; MonitorInformation monitorInformation = monitorInformations . get ( monitorKey ) ; if ( monitorInformation == null ) { // Not found, let's call delegate if ( delegate . isMonitored ( location ) ) { monitorInformation = new MonitorInformation ( true , delegate . getMonitor ( location ) ) ; } else { monitorInformation = NULL_MONITOR_INFORMATION ; } monitorInformations . put ( monitorKey , monitorInformation ) ; } return monitorInformation ; }
Get monitor information for given location . First monitor information is looked up in cache . Then when not found delegate is called .