<commit_before>package com.splicemachine.hbase;

import com.google.common.cache.CacheLoader;
import com.google.common.collect.Sets;
import com.splicemachine.concurrent.MoreExecutors;
import com.splicemachine.constants.SpliceConstants;
import com.splicemachine.utils.SpliceLogUtils;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.catalog.MetaReader;
import org.apache.hadoop.hbase.client.MetaScanner;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.regionserver.RegionServerStoppedException;
import org.apache.hadoop.hbase.regionserver.HRegionUtil;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.log4j.Logger;

import javax.management.*;

import java.io.IOException;
import java.util.Arrays;
import java.util.SortedSet;
import java.util.concurrent.*;

/**
 * @author <NAME>
 *         Created on: 8/8/13
 */
public class HBaseRegionCache implements RegionCache {
    private static final RegionCache INSTANCE = HBaseRegionCache.create(SpliceConstants.cacheExpirationPeriod, SpliceConstants.cacheUpdatePeriod);

    private static final Logger CACHE_LOG = Logger.getLogger(HBaseRegionCache.class);
    private final ConcurrentSkipListMap<byte[],SortedSet<HRegionInfo>> regionCache;
    private final ScheduledExecutorService cacheUpdater;

    private final long cacheUpdatePeriod;
    private volatile long cacheUpdatedTimestamp;
    private RegionCacheLoader regionCacheLoader;

    private RegionCacheStatus status = new RegionStatus();

    private HBaseRegionCache(long cacheUpdatePeriod,
                             ScheduledExecutorService cacheUpdater) {
        this.regionCache = new ConcurrentSkipListMap<byte[], SortedSet<HRegionInfo>>(Bytes.BYTES_COMPARATOR);
        this.cacheUpdater = cacheUpdater;
        this.cacheUpdatePeriod = cacheUpdatePeriod;<commit_msg>DB-1975: (HBaseRegionCache thread problem): move static logger field above static factory method creating self, else logger is null in factory method.<commit_after>package com.splicemachine.hbase;

import com.google.common.cache.CacheLoader;
import com.google.common.collect.Sets;
import com.splicemachine.concurrent.MoreExecutors;
import com.splicemachine.constants.SpliceConstants;
import com.splicemachine.utils.SpliceLogUtils;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.catalog.MetaReader;
import org.apache.hadoop.hbase.client.MetaScanner;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.regionserver.RegionServerStoppedException;
import org.apache.hadoop.hbase.regionserver.HRegionUtil;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.log4j.Logger;

import javax.management.*;

import java.io.IOException;
import java.util.Arrays;
import java.util.SortedSet;
import java.util.concurrent.*;

/**
 * @author <NAME>
 *         Created on: 8/8/13
 */
public class HBaseRegionCache implements RegionCache {
    private static final Logger CACHE_LOG = Logger.getLogger(HBaseRegionCache.class);
    private static final RegionCache INSTANCE = HBaseRegionCache.create(SpliceConstants.cacheExpirationPeriod, SpliceConstants.cacheUpdatePeriod);

    private final ConcurrentSkipListMap<byte[],SortedSet<HRegionInfo>> regionCache;
    private final ScheduledExecutorService cacheUpdater;

    private final long cacheUpdatePeriod;
    private volatile long cacheUpdatedTimestamp;
    private RegionCacheLoader regionCacheLoader;

    private RegionCacheStatus status = new RegionStatus();

    private HBaseRegionCache(long cacheUpdatePeriod,
                             ScheduledExecutorService cacheUpdater) {
        this.regionCache = new ConcurrentSkipListMap<byte[], SortedSet<HRegionInfo>>(Bytes.BYTES_COMPARATOR);
        this.cacheUpdater = cacheUpdater;
        this.cacheUpdatePeriod = cacheUpdatePeriod;
{'fraction_non_alphanumeric': 0.08551483420593368, 'fraction_numerical': 0.0034904013961605585, 'mean_word_length': 5.23950233281493, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1467361', 'n_tokens_mistral': 1129, 'n_tokens_neox': 1120, 'n_words': 223}