Example usage for java.lang Long getLong

List of usage examples for java.lang Long getLong

Introduction

In this page you can find the example usage for java.lang Long getLong.

Prototype

public static Long getLong(String nm, Long val) 

Source Link

Document

Returns the long value of the system property with the specified name.

Usage

From source file:Main.java

public static void main(String[] args) {

    System.setProperty("Java2s.com", "12345");
    String str = "Java2s.com";
    System.out.println(Long.getLong(str, 123L));

    System.out.println(Long.getLong("java", 123L));
}

From source file:Main.java

public static void main(String[] args) {

    Long v = new Long(1234567890);

    System.setProperty("Java2s.com", "12345");
    String str = "Java2s.com";
    System.out.println(Long.getLong(str, v));

    System.out.println(Long.getLong("java", v));
}

From source file:org.apache.stratos.common.concurrent.locks.ReadWriteLockMonitor.java

ReadWriteLockMonitor(ReadWriteLock readWriteLock) {
    lockTimeout = Long.getLong("read.write.lock.timeout", 30000); // 30 seconds
    this.readWriteLock = readWriteLock;
}

From source file:org.apache.archiva.redback.rest.services.AbstractRestServicesTest.java

public long getTimeout() {
    return Long.getLong("rest.test.timeout", 1000000);
}

From source file:com.jkoolcloud.tnt4j.repository.FileTokenRepository.java

/**
 * Create file/property based token repository instance based on default
 * file name or url specified by <code>tnt4j.token.repository</code> java
 * property which should be found in specified properties.
 *
 *///w ww . java2s .c o  m
public FileTokenRepository() {
    this(System.getProperty("tnt4j.token.repository"), Long.getLong("tnt4j.file.respository.refresh", 20000));
}

From source file:org.apache.stratos.common.internal.ComponentStartUpSynchronizerImpl.java

ComponentStartUpSynchronizerImpl(DistributedObjectProvider distributedObjectProvider) {
    componentStatusMap = distributedObjectProvider.getMap(COMPONENT_STATUS_MAP);
    eventListeners = new ArrayList<ComponentStartUpEventListener>();

    componentStartUpSynchronizerEnabled = Boolean.getBoolean(COMPONENT_STARTUP_SYNCHRONIZER_ENABLED);
    log.info("Component startup synchronizer enabled: " + componentStartUpSynchronizerEnabled);

    componentActivationCheckInterval = Long.getLong(COMPONENT_ACTIVATION_CHECK_INTERVAL,
            DEFAULT_COMPONENT_ACTIVATION_CHECK_INTERVAL);
    log.info(String.format("Component activation check interval: %s seconds.",
            (componentActivationCheckInterval / 1000)));

    componentActivationTimeout = Long.getLong(COMPONENT_ACTIVATION_TIMEOUT,
            DEFAULT_COMPONENT_ACTIVATION_TIMEOUT);
    log.info(String.format("Component activation timeout: %s seconds.", (componentActivationTimeout / 1000)));
}

From source file:com.netflix.aegisthus.tools.SSTableExport.java

public static void exportIndexSplit(String ssTableFile, DataInput input) throws IOException {
    Iterator<Long> scanner = new OffsetScanner(input);

    long maxSplitSize = Long.getLong("aegisthus.block.size", 67108864);
    long splitStart = 0;
    while (scanner.hasNext()) {
        long splitSize = 0;
        // The scanner returns an offset from the start of the file.
        while (splitSize < maxSplitSize && scanner.hasNext()) {
            splitSize = scanner.next() - splitStart;
        }//from www .  jav  a 2s.c o  m
        if (scanner.hasNext()) {
            System.out.println(ssTableFile + "\t" + splitStart + "\t" + splitSize);
        } else {
            System.out.println(ssTableFile + "\t" + splitStart + "\t" + -1);
        }
        splitStart += splitSize;
    }
}

From source file:org.eclipse.gyrex.p2.internal.installer.PackageScanner.java

/**
 * Creates a new instance.//  w ww . j av  a2 s .  co m
 */
PackageScanner() {
    super("Software Package Scanner");
    initialSleepTime = Math.max(
            Long.getLong("gyrex.p2.packageScanner.initialSleepTime", DEFAULT_INITIAL_SLEEP_TIME),
            TimeUnit.SECONDS.toMillis(15));
    maxSleepTime = Math.min(Long.getLong("gyrex.p2.packageScanner.maxSleepTime", DEFAULT_MAX_SLEEP_TIME),
            TimeUnit.HOURS.toMillis(48));
    setSystem(true);
    setPriority(LONG);
    setRule(new MutexRule(PackageScanner.class));
}

From source file:com.talis.platform.sequencing.zookeeper.ZooKeeperProvider.java

private void waitForConnection() throws ZooKeeperInitialisationException {
    long connectionTimeout = Long.getLong(CONNECTION_TIMEOUT_PROPERTY, DEFAULT_CONNECTION_TIMEOUT);
    synchronized (this) {
        try {//w w w .  j  ava2s.c o  m
            wait(connectionTimeout);
        } catch (InterruptedException e) {
            LOG.info("Interrupted while waiting for connection");
        }

        if (!connected) {
            zookeeper = null;
            throw new ZooKeeperInitialisationException("Connection timed out or interrupted");
        }
    }
}

From source file:org.eclipse.scada.utils.osgi.jdbc.pool.PoolConnectionAccessor.java

private static long getLong(final Properties paramProperties, final String name, final long defaultValue) {
    final Object value = paramProperties.remove(name);
    if (value instanceof Number) {
        logger.debug("Parameter value is numeric - {} -> {}", name, value);
        return ((Number) value).longValue();
    }//from  w  ww  . ja va  2  s  . c o m

    try {
        if (value != null) {
            logger.debug("Parameter value is string - {} -> {}", name, value);
            return Long.parseLong(value.toString());
        }
    } catch (final Exception e) {
    }

    final Long result = Long.getLong(name, defaultValue);
    logger.debug("Parameter value via system property - {} -> {}", name, result);
    return result;
}