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:org.punksearch.crawler.NetworkCrawler.java

private void startTimers() {
    Timer processTimer = new Timer();
    processTimer.schedule(new MaxRunWatchDog(), maxHours * 3600 * 1000L);

    Timer statusDumpTimer = new Timer();
    long dumpPeriod = Long.getLong(DUMP_STATUS_PERIOD, 10L) * 1000;
    statusDumpTimer.scheduleAtFixedRate(new ThreadStatusDump(), dumpPeriod, dumpPeriod);

    timers.add(processTimer);/*ww w .j  av  a2  s  .c  o  m*/
    timers.add(statusDumpTimer);
}

From source file:org.eclipse.gyrex.junit.internal.GyrexStarter.java

/**
 * Ensures the server is started an online.
 * <p>/*from   w  w  w  .j  av  a  2s . co m*/
 * The caller will block until the server is fully started and online.
 * </p>
 * 
 * @return <code>true</code> if the server has been started,
 *         <code>false</code> otherwise
 */
public synchronized boolean ensureStartedAndOnline() throws Exception {
    shutdownJob.cancel();

    if (applicationHandle != null) {
        LOG.debug("Gyrex already running!");
        return false;
    }

    LOG.debug("Starting Gyrex");

    bootstrapBundles();

    // test for bogus system properties
    if (Boolean.getBoolean("gyrex.preferences.instancebased")) {
        LOG.warn(
                "Overriding system propert 'gyrex.preferences.instancebased' in order to force ZooKeeper based cloud preferences!");
        System.setProperty("gyrex.preferences.instancebased", Boolean.FALSE.toString());
    }

    // hook event listener to listen for the node to become online
    final CountDownLatch cloudOnlineWatch = new CountDownLatch(1);
    final EventHandler cloudOnlineHandler = new EventHandler() {
        @Override
        public void handleEvent(final Event event) {
            cloudOnlineWatch.countDown();
        }
    };
    final Hashtable<String, Object> properties = new Hashtable<String, Object>(1);
    properties.put(EventConstants.EVENT_TOPIC, ICloudEventConstants.TOPIC_NODE_ONLINE);
    context.registerService(EventHandler.class, cloudOnlineHandler, properties);

    // get hold of application handle and start application
    final Collection<ServiceReference<ApplicationDescriptor>> refs = context
            .getServiceReferences(ApplicationDescriptor.class, "(service.pid=org.eclipse.gyrex.boot.server)");
    assertEquals("Unable to find proper Gyrex Server application to start!", 1, refs.size());
    final ServiceReference<ApplicationDescriptor> sr = refs.iterator().next();
    final ApplicationDescriptor service = context.getService(sr);
    try {
        applicationHandle = service.launch(null);
    } finally {
        context.ungetService(sr);
    }

    //  wait for node becoming online
    final long timeout = Long.getLong("gyrex.servertestapp.timeout", 60000l);
    LOG.info("Waiting {}ms for node to become online...", timeout);
    if (!cloudOnlineWatch.await(timeout, TimeUnit.MILLISECONDS)) {
        LOG.error("Timeout waiting for node to become online.");
        throw new IllegalStateException(
                "Timeout while waiting for node to establish connection with ZooKeeper. Unable to initialize cloud environment.");
    }

    return true;
}

From source file:com.adeptj.runtime.server.Server.java

private void gracefulShutdown() {
    try {/*w  w  w  . j  av  a 2s .  c  om*/
        this.rootHandler.shutdown();
        if (this.rootHandler.awaitShutdown(
                Long.getLong(ServerConstants.SYS_PROP_SHUTDOWN_WAIT_TIME, ServerConstants.DEFAULT_WAIT_TIME))) {
            LOGGER.debug("Completed remaining requests successfully!!");
        }
    } catch (InterruptedException ie) {
        LOGGER.error("Error while waiting for pending request to complete!!", ie);
        // SONAR - "InterruptedException" should not be ignored
        // Can't really rethrow it as we are yet to stop the server and anyway it's a shutdown hook
        // and JVM itself will be shutting down shortly.
        Thread.currentThread().interrupt();
    }
}

From source file:io.adeptj.runtime.server.Server.java

private void gracefulShutdown() {
    try {//from   w  w  w .  j  av a  2  s . co m
        this.rootHandler.shutdown();
        if (this.rootHandler.awaitShutdown(Long.getLong(SYS_PROP_SHUTDOWN_WAIT_TIME, DEFAULT_WAIT_TIME))) {
            LOGGER.debug("Completed remaining requests successfully!!");
        }
    } catch (InterruptedException ie) {
        LOGGER.error("Error while waiting for pending request to complete!!", ie);
        // SONAR - "InterruptedException" should not be ignored
        // Can't really rethrow it as we are yet to stop the server and anyway it's a shutdown hook
        // and JVM itself will be shutting down shortly.
        Thread.currentThread().interrupt();
    }
}

From source file:com.thebuzzmedia.exiftool.ExifTool.java

/**
 * In this constructor, exifToolPath and processCleanupDelay are gotten from
 * system properties exiftool.path and exiftool.processCleanupDelay.
 * processCleanupDelay is optional. If not found, the default is used.
 *//*from  w w  w  .j av  a  2  s . c o  m*/
public ExifTool(Feature... features) {
    this(System.getProperty(ENV_EXIF_TOOL_PATH, "exiftool"),
            Long.getLong(ENV_EXIF_TOOL_PROCESSCLEANUPDELAY, DEFAULT_PROCESS_CLEANUP_DELAY), features);
}

From source file:com.thebuzzmedia.exiftool.ExifToolNew3.java

public ExifToolNew3(int timeoutWhenKeepAliveInMillis, Feature... features) {
    this(System.getProperty(ENV_EXIF_TOOL_PATH, "exiftool"),
            Long.getLong(ENV_EXIF_TOOL_PROCESSCLEANUPDELAY, DEFAULT_PROCESS_CLEANUP_DELAY),
            timeoutWhenKeepAliveInMillis, features);
}

From source file:org.apache.geode.internal.cache.tier.sockets.ClientHealthMonitor.java

/**
 *
 * Constructor.//from   w  ww.  j  av  a 2s  .  co  m
 * 
 * @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;

    // Initialize the client threads map
    this._clientThreads = new HashMap();

    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(LocalizedMessage.create(
                LocalizedStrings.ClientHealthMonitor_CLIENT_HEALTH_MONITOR_THREAD_DISABLED_DUE_TO_MAXIMUMTIMEBETWEENPINGS_SETTING__0,
                maximumTimeBetweenPings));
        this._clientMonitor = null;
    }

    this.stats = stats;
}