/** * 读取Long类型的系统变量,为空时返回null. */ public static Long getLong(String name) { return Long.getLong(name); }
/** * 读取Integer类型的系统变量,为空时返回默认值 */ public static Long getLong(String name, Long defaultValue) { return Long.getLong(name, defaultValue); }
/** * Maximum number of catalog entries to allocate for the catalog file. * * @return the maximum number of catalog entries to support for the catalog file. */ public static long maxCatalogEntries() { return Long.getLong(MAX_CATALOG_ENTRIES_PROP_NAME, MAX_CATALOG_ENTRIES_DEFAULT); }
@Override public Long get() { return Long.getLong(name, fallback); }
/** * @return epoch offset as the number of number of milliseconds since January 1, 1970, 00:00:00 * GMT */ public long epoch() { return epoch == null ? Long.getLong(DEFAULT_EPOCH_PROPERTY, 0L) : epoch; }
/** * Get the value of a {@code long} system property. * * The absolute name of the system property is computed based on the provided class and local name. * * @param location the class that owns the flag. * @param name the local name of the flag. * @param defaultValue the default value of the flag if the system property is not assigned. * @return the parsed value of the system property, or the default value. */ public static long getLong( Class<?> location, String name, long defaultValue ) { return Long.getLong( name( location, name ), defaultValue ); }
@Override public void start() { int numCores = Runtime.getRuntime().availableProcessors(); int numWorkerThreads = Integer.getInteger( ZOOKEEPER_COMMIT_PROC_NUM_WORKER_THREADS, numCores); workerShutdownTimeoutMS = Long.getLong( ZOOKEEPER_COMMIT_PROC_SHUTDOWN_TIMEOUT, 5000); LOG.info("Configuring CommitProcessor with " + (numWorkerThreads > 0 ? numWorkerThreads : "no") + " worker threads."); if (workerPool == null) { workerPool = new WorkerService( "CommitProcWork", numWorkerThreads, true); } stopped = false; stoppedMainLoop = false; super.start(); }
workerShutdownTimeoutMS = Long.getLong( ZOOKEEPER_NIO_SHUTDOWN_TIMEOUT, 5000);
/** * * Constructor. * * @param cache The GemFire <code>Cache</code> * @param maximumTimeBetweenPings The maximum time allowed between pings before determining the */ private ClientHealthMonitor(InternalCache cache, int maximumTimeBetweenPings, CacheClientNotifierStats stats) { // Set the Cache this._cache = cache; this.maximumTimeBetweenPings = maximumTimeBetweenPings; this.monitorInterval = Long.getLong(CLIENT_HEALTH_MONITOR_INTERVAL_PROPERTY, DEFAULT_CLIENT_MONITOR_INTERVAL_IN_MILLIS); logger.debug("Setting monitorInterval to {}", this.monitorInterval); if (maximumTimeBetweenPings > 0) { if (logger.isDebugEnabled()) { logger.debug("{}: Initializing client health monitor thread", this); } this._clientMonitor = new ClientHealthMonitorThread(maximumTimeBetweenPings); this._clientMonitor.start(); } else { // LOG:CONFIG: changed from config to info logger.info( "Client health monitor thread disabled due to maximumTimeBetweenPings setting: {}", maximumTimeBetweenPings); this._clientMonitor = null; } this.stats = stats; }
/** * Helper method for getting long property. * * @param name Property name. * @return JVM property value or environment variable value if * JVM property is undefined. Returns {@code null} if * both JVM property and environment variable are not set. */ @Nullable private static Long getLongProperty0(String name) { Long ret = Long.getLong(name); if (ret == null) { String env = System.getenv(name); ret = env != null ? Long.valueOf(env) : null; } return ret; }
/** * Initialize the EventTracker's timer task. This is stored for tracking and shutdown purposes */ private EventTrackerExpiryTask createEventTrackerExpiryTask() { long lifetimeInMillis = Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "messageTrackingTimeout", PoolFactory.DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT / 3); EventTrackerExpiryTask task = new EventTrackerExpiryTask(lifetimeInMillis); getCCPTimer().scheduleAtFixedRate(task, lifetimeInMillis, lifetimeInMillis); return task; }
/** * Returns a random number generator */ private Random getRandom() { long seed = Long.getLong("SEED", System.currentTimeMillis()).longValue(); System.out.println("SEED for " + this.testName.getMethodName() + ": " + seed); return new Random(seed); }
/** * Gets the timeout value as a {@link Duration}. * * <p> * One use of this is with {@link Mockito#timeout(long)}: * * <pre> * import static org.apache.geode.test.awaitility.GeodeAwaitility.getTimeout; * * private static final long TIMEOUT = getTimeout().getValueInMS(); * * {@literal @}Test * public void test() { * ... * ArgumentCaptor<AlertDetails> alertDetailsCaptor = ArgumentCaptor.forClass(AlertDetails.class); * verify(messageListener, timeout(TIMEOUT)).created(alertDetailsCaptor.capture()); * } * * <pre> * * @return the current timeout value as a {@code Duration} */ public static Duration getTimeout() { return new Duration(getLong(TIMEOUT_SECONDS_PROPERTY, DEFAULT_TIMEOUT.getValue()), SECONDS); }
@Override public void start(InternalPool pool) { this.pool = pool; pool.getStats().setInitialContacts(((LocatorList) locators.get()).size()); this.locatorUpdateInterval = Long.getLong( DistributionConfig.GEMFIRE_PREFIX + "LOCATOR_UPDATE_INTERVAL", pool.getPingInterval()); if (locatorUpdateInterval > 0) { pool.getBackgroundProcessor().scheduleWithFixedDelay(new UpdateLocatorListTask(), 0, locatorUpdateInterval, TimeUnit.MILLISECONDS); logger.info("AutoConnectionSource UpdateLocatorListTask started with interval={} ms.", new Object[] {this.locatorUpdateInterval}); } }
/** * This method was split out from getPrimary() due to bug #40639 and is only intended to be called * from within that method. * * @see #getPrimary() * @return the new primary */ private InternalDistributedMember waitForNewPrimary() { DistributionManager dm = this.regionAdvisor.getDistributionManager(); DistributionConfig config = dm.getConfig(); // failure detection period long timeout = config.getMemberTimeout() * 3L; // plus time for a new member to become primary timeout += Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "BucketAdvisor.getPrimaryTimeout", 15000L); InternalDistributedMember newPrimary = waitForPrimaryMember(timeout); return newPrimary; }
joinTimeout = Long.getLong("p2p.joinTimeout", defaultJoinTimeout).longValue();
public static final long UNWIND_THROTTLING_TIMEOUT = Long.getLong( IgniteSystemProperties.IGNITE_UNWIND_THROTTLING_TIMEOUT, 500L);
Long.getLong(KEY_SLOW_START_TIME_FOR_TESTING, DEFAULT_SLOW_STARTING_TIME).longValue(); long elapsedTime = 0; long startTime = System.currentTimeMillis();
private void acquireContextDisposeDelay() { disposeDelayInMillis = Long.getLong(MULE_LOG_CONTEXT_DISPOSE_DELAY_MILLIS, DEFAULT_DISPOSE_DELAY_IN_MILLIS); }
@Override public Long getLong(@Nonnull final String key) { return Long.getLong(key); }