private int getNonNegativeInt(String property, int defaultValue) { int value = getInt(property, defaultValue); Preconditions.checkArgument(value >= 0, property + " must be non-negative"); return value; }
private static int getPositiveInt(FluoConfiguration config, String property, int defaultValue) { int value = config.getInt(property, defaultValue); Preconditions.checkArgument(value > 0, property + " must be positive"); return value; } }
public static int getTxCommitMemory(FluoConfiguration conf) { int m = conf.getInt(COMMIT_MEMORY_PROP, COMMIT_MEMORY_DEFAULT); if (m <= 0) { throw new IllegalArgumentException("Bad value for " + COMMIT_MEMORY_PROP + " " + m); } return m; }
public static int getNumCWThreads(FluoConfiguration conf, int numTservers) { int min = conf.getInt(CW_MIN_THREADS_PROP, CW_MIN_THREADS_DEFAULT); int max = conf.getInt(CW_MAX_THREADS_PROP, CW_MAX_THREADS_DEFAULT); if (min < 0 || max < 0 || min > max) { throw new IllegalArgumentException("Bad conditional writer thread props " + min + " " + max); } int numThreads = numTservers; numThreads = Math.min(numThreads, max); numThreads = Math.max(numThreads, min); return numThreads; }
private int getPositiveInt(String property, int defaultValue) { int value = getInt(property, defaultValue); Preconditions.checkArgument(value > 0, property + " must be positive"); return value; }
private int getPositiveInt(String property, int defaultValue) { int value = getInt(property, defaultValue); Preconditions.checkArgument(value > 0, property + " must be positive"); return value; }
public static int getTxCommitMemory(FluoConfiguration conf) { int m = conf.getInt(COMMIT_MEMORY_PROP, COMMIT_MEMORY_DEFAULT); if (m <= 0) { throw new IllegalArgumentException("Bad value for " + COMMIT_MEMORY_PROP + " " + m); } return m; }
private static int getPositiveInt(FluoConfiguration config, String property, int defaultValue) { int value = config.getInt(property, defaultValue); Preconditions.checkArgument(value > 0, property + " must be positive"); return value; } }
private int getNonNegativeInt(String property, int defaultValue) { int value = getInt(property, defaultValue); Preconditions.checkArgument(value >= 0, property + " must be non-negative"); return value; }
public static int getNumBWThreads(FluoConfiguration conf, int numTservers) { int min = conf.getInt(BW_MIN_THREADS_PROP, BW_MIN_THREADS_DEFAULT); int max = conf.getInt(BW_MAX_THREADS_PROP, BW_MAX_THREADS_DEFAULT); if (min < 0 || max < 0 || min > max) { throw new IllegalArgumentException("Bad batch writer thread props " + min + " " + max); } int numThreads = numTservers; numThreads = Math.min(numThreads, max); numThreads = Math.max(numThreads, min); return numThreads; }
public static int getNumBWThreads(FluoConfiguration conf, int numTservers) { int min = conf.getInt(BW_MIN_THREADS_PROP, BW_MIN_THREADS_DEFAULT); int max = conf.getInt(BW_MAX_THREADS_PROP, BW_MAX_THREADS_DEFAULT); if (min < 0 || max < 0 || min > max) { throw new IllegalArgumentException("Bad batch writer thread props " + min + " " + max); } int numThreads = numTservers; numThreads = Math.min(numThreads, max); numThreads = Math.max(numThreads, min); return numThreads; }
public static int getNumCWThreads(FluoConfiguration conf, int numTservers) { int min = conf.getInt(CW_MIN_THREADS_PROP, CW_MIN_THREADS_DEFAULT); int max = conf.getInt(CW_MAX_THREADS_PROP, CW_MAX_THREADS_DEFAULT); if (min < 0 || max < 0 || min > max) { throw new IllegalArgumentException("Bad conditional writer thread props " + min + " " + max); } int numThreads = numTservers; numThreads = Math.min(numThreads, max); numThreads = Math.max(numThreads, min); return numThreads; }
/** * Returns the value of the property {@value #CONNECTION_RETRY_TIMEOUT_MS_PROP} if it is set, else * the default value of {@value #CONNECTION_RETRY_TIMEOUT_MS_DEFAULT}. The integer returned * represents milliseconds and is always positive. * * @since 1.2.0 */ public int getConnectionRetryTimeout() { int retval; if (containsKey(CONNECTION_RETRY_TIMEOUT_MS_PROP)) { retval = getInt(CONNECTION_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT); } else { retval = getInt(CLIENT_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT); } Preconditions.checkArgument(retval >= -1, CONNECTION_RETRY_TIMEOUT_MS_PROP + " must be >= -1"); return retval; }
/** * Returns the value of the property {@value #CONNECTION_RETRY_TIMEOUT_MS_PROP} if it is set, else * the default value of {@value #CONNECTION_RETRY_TIMEOUT_MS_DEFAULT}. The integer returned * represents milliseconds and is always positive. * * @since 1.2.0 */ public int getConnectionRetryTimeout() { int retval; if (containsKey(CONNECTION_RETRY_TIMEOUT_MS_PROP)) { retval = getInt(CONNECTION_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT); } else { retval = getInt(CLIENT_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT); } Preconditions.checkArgument(retval >= -1, CONNECTION_RETRY_TIMEOUT_MS_PROP + " must be >= -1"); return retval; }
public AsyncConditionalWriter(Environment env, ConditionalWriter cw) { this.cw = cw; int numThreads = env.getConfiguration().getInt(FluoConfigurationImpl.ASYNC_CW_THREADS, FluoConfigurationImpl.ASYNC_CW_THREADS_DEFAULT); int permits = env.getConfiguration().getInt(FluoConfigurationImpl.ASYNC_CW_LIMIT, FluoConfigurationImpl.ASYNC_CW_LIMIT_DEFAULT); this.es = FluoExecutors.newFixedThreadPool(numThreads, "asyncCw"); // the conditional writer currently has not memory limits... give it too much and it blows out // memory.. need to fix this in conditional writer // for now this needs to be memory based this.semaphore = new Limit(permits); }
@Override public void start() { long minSleepTime = env.getConfiguration().getInt(FluoConfigurationImpl.NTFY_FINDER_MIN_SLEEP_TIME_PROP, FluoConfigurationImpl.NTFY_FINDER_MIN_SLEEP_TIME_DEFAULT); long maxSleepTime = env.getConfiguration().getInt(FluoConfigurationImpl.NTFY_FINDER_MAX_SLEEP_TIME_PROP, FluoConfigurationImpl.NTFY_FINDER_MAX_SLEEP_TIME_DEFAULT); partitionManager = new PartitionManager(env, minSleepTime, maxSleepTime); scanThread = new Thread( new ScanTask(this, processor, partitionManager, env, stopped, minSleepTime, maxSleepTime)); scanThread.setName(getClass().getSimpleName() + " " + ScanTask.class.getSimpleName()); scanThread.setDaemon(true); scanThread.start(); }
@Override public void start() { long minSleepTime = env.getConfiguration().getInt(FluoConfigurationImpl.NTFY_FINDER_MIN_SLEEP_TIME_PROP, FluoConfigurationImpl.NTFY_FINDER_MIN_SLEEP_TIME_DEFAULT); long maxSleepTime = env.getConfiguration().getInt(FluoConfigurationImpl.NTFY_FINDER_MAX_SLEEP_TIME_PROP, FluoConfigurationImpl.NTFY_FINDER_MAX_SLEEP_TIME_DEFAULT); partitionManager = new PartitionManager(env, minSleepTime, maxSleepTime); scanThread = new Thread( new ScanTask(this, processor, partitionManager, env, stopped, minSleepTime, maxSleepTime)); scanThread.setName(getClass().getSimpleName() + " " + ScanTask.class.getSimpleName()); scanThread.setDaemon(true); scanThread.start(); }
public AsyncConditionalWriter(Environment env, ConditionalWriter cw) { this.cw = cw; int numThreads = env.getConfiguration().getInt(FluoConfigurationImpl.ASYNC_CW_THREADS, FluoConfigurationImpl.ASYNC_CW_THREADS_DEFAULT); int permits = env.getConfiguration().getInt(FluoConfigurationImpl.ASYNC_CW_LIMIT, FluoConfigurationImpl.ASYNC_CW_LIMIT_DEFAULT); this.es = FluoExecutors.newFixedThreadPool(numThreads, "asyncCw"); // the conditional writer currently has not memory limits... give it too much and it blows out // memory.. need to fix this in conditional writer // for now this needs to be memory based this.semaphore = new Limit(permits); }