/** * get all timelines for all update periods and partition columns for the given fact-storage pair. If already loaded * in memory, it'll return that. If not, it'll first try to load it from table properties. If not found in table * properties, it'll get all partitions, compute timelines in memory, write back all loads timelines to table * properties for further usage and return them. * * @param fact fact * @param storage storage * @return all timelines for fact-storage pair. Load from properties/all partitions if needed. * @throws HiveException * @throws LensException */ public TreeMap<UpdatePeriod, CaseInsensitiveStringHashMap<PartitionTimeline>> get(String fact, String storage) throws HiveException, LensException { // SUSPEND CHECKSTYLE CHECK DoubleCheckedLockingCheck // Unique key for the timeline cache, based on storage and fact. String timeLineKey = (Storage.getPrefix(storage)+ fact).toLowerCase(); synchronized (this) { if (get(timeLineKey) == null) { loadTimeLines(fact, storage, timeLineKey); } log.debug("timeline for {} is: {}", storage, get(timeLineKey)); // return the final value from memory return get(timeLineKey); // RESUME CHECKSTYLE CHECK DoubleCheckedLockingCheck } }
/** * get all timelines for all update periods and partition columns for the given fact-storage pair. If already loaded * in memory, it'll return that. If not, it'll first try to load it from table properties. If not found in table * properties, it'll get all partitions, compute timelines in memory, write back all loads timelines to table * properties for further usage and return them. * * @param fact fact * @param storage storage * @return all timelines for fact-storage pair. Load from properties/all partitions if needed. * @throws HiveException * @throws LensException */ public TreeMap<UpdatePeriod, CaseInsensitiveStringHashMap<PartitionTimeline>> get(String fact, String storage) throws HiveException, LensException { // SUSPEND CHECKSTYLE CHECK DoubleCheckedLockingCheck // Unique key for the timeline cache, based on storage and fact. String timeLineKey = (Storage.getPrefix(storage)+ fact).toLowerCase(); synchronized (this) { if (get(timeLineKey) == null) { loadTimeLines(fact, storage, timeLineKey); } log.debug("timeline for {} is: {}", storage, get(timeLineKey)); // return the final value from memory return get(timeLineKey); // RESUME CHECKSTYLE CHECK DoubleCheckedLockingCheck } }