Example usage for java.util.concurrent TimeUnit MINUTES

List of usage examples for java.util.concurrent TimeUnit MINUTES

Introduction

In this page you can find the example usage for java.util.concurrent TimeUnit MINUTES.

Prototype

TimeUnit MINUTES

To view the source code for java.util.concurrent TimeUnit MINUTES.

Click Source Link

Document

Time unit representing sixty seconds.

Usage

From source file:com.reactivetechnologies.platform.analytics.WekaMessagingChannel.java

/**
 * Task for scheduling ensemble dumps/*from  w  ww  . ja va  2 s  . c om*/
 */
@Scheduled(fixedDelay = 5000, initialDelay = 5000)
public void ensembleModelTask() {
    log.info("[ensembleModelTask] task starting..");
    try {
        boolean done = tryMemberSnapshot(10, TimeUnit.MINUTES);
        if (done) {
            ensembleModels();
        } else {
            log.info("[ensembleModelTask] task ignored.. ");
        }
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        log.debug("", e);
    } catch (TimeoutException e) {
        log.warn("[ensembleModelTask] task failed. Generated model may be inconsistent", e);
    }
}

From source file:net.solarnetwork.node.backup.DefaultBackupManager.java

private static ExecutorService defaultExecutorService() {
    // we want at most one backup happening at a time by default
    return new ThreadPoolExecutor(0, 1, 5, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(3, true));
}

From source file:$.HelloWorldPluginModule.java

/**
     * This method can be used to add own configuration items for the plugin. The method accepts an
     * AbstractConfiguration from Apache Commons as return value, which gives great flexibility in
     * adding custom configurations. Some helper methods for basic configurations can be found in
     * {@link com.dcsquare.hivemq.spi.config.Configurations}. For acme
     * {@link com.dcsquare.hivemq.spi.config.Configurations.noConfigurationNeeded()} returns an
     * empty configuration, if the plugin does not need one.
     * <p/>/* w  w  w  . ja v  a2 s. c om*/
     * The configuration file need to be located in the plugin folder!
     *
     * @return Any AbstractConfiguration from Apache Commons, or the return value of the helper methods
     *         in {@link com.dcsquare.hivemq.spi.config.Configurations}
     */
    @Override
    public Provider<Iterable<? extends AbstractConfiguration>> getConfigurations() {
        return newConfigurationProvider(
                newReloadablePropertiesConfiguration("myPlugin.properties", 5, TimeUnit.MINUTES));
    }

From source file:at.molindo.notify.channel.mail.DirectMailClient.java

@Override
public DirectMailClient init() throws MailException {
    super.init();
    _sessionCache = CacheBuilder.newBuilder().concurrencyLevel(_cacheConcurrency)
            .expireAfterAccess(_cacheExpirationMin, TimeUnit.MINUTES).build(new CacheLoader<String, Session>() {
                @Override/* w w  w .jav a 2  s  . c o m*/
                public Session load(String domain) throws MailException {
                    return createSmtpSession(domain);
                }
            });
    return this;
}

From source file:no.uis.fsws.proxy.StudinfoProxyImpl.java

@Override
public List<Studieprogram> getStudieprogrammerForOrgenhet(final XMLGregorianCalendar arstall,
        final Terminkode terminkode, final Sprakkode sprak, final int institusjonsnr, final Integer fakultetsnr,
        final Integer instituttnr, final Integer gruppenr, final boolean medUPinfo) {
    final StudInfoImport svc = getServiceForPrincipal();

    try {//  w  w  w.  j a  va 2s .  c o m
        Future<List<Studieprogram>> future = executor.submit(new Callable<List<Studieprogram>>() {

            @Override
            public List<Studieprogram> call() throws Exception {
                final FsStudieinfo sinfo = svc.fetchStudyPrograms(institusjonsnr,
                        fakultetsnr != null ? fakultetsnr : -1, arstall.getYear(), terminkode.toString(),
                        medUPinfo, sprak.toString());
                return sinfo.getStudieprogram();
            }
        });

        return future.get(timeoutMinutes, TimeUnit.MINUTES);
    } catch (ExecutionException | InterruptedException | TimeoutException e) {
        throw new RuntimeException(e);
    }
}

From source file:org.onehippo.forge.solr.indexer.task.SolrIndexer.java

/** Wait for the repository to be initialized */
private static void waitForRepository() {
    Session session = null;/*from  w w  w  . j a v a 2s . c o m*/
    try {
        while (session == null) {
            session = createSession(false);
            if (session == null) {
                log.debug("Repository is not ready yet, wait for 1 more minute");
                try {
                    Thread.sleep(TimeUnit.MINUTES.toMillis(1L));
                } catch (InterruptedException e) {
                    //
                }
            }
        }
    } finally {
        JcrUtils.closeQuietly(session);
    }
}

From source file:com.ryantenney.metrics.spring.reporter.AbstractScheduledReporterFactoryBean.java

/**
 * Parses and converts to nanoseconds a string representing
 * a duration, ie: 500ms, 30s, 5m, 1h, etc
 * @param duration a string representing a duration
 * @return the duration in nanoseconds/*from w w  w . j  a  va 2 s.com*/
 */
protected long convertDurationString(String duration) {
    final Matcher m = DURATION_STRING_PATTERN.matcher(duration);
    if (!m.matches()) {
        throw new IllegalArgumentException("Invalid duration string format");
    }

    final long sourceDuration = Long.parseLong(m.group(1));
    final String sourceUnitString = m.group(2);
    final TimeUnit sourceUnit;
    if ("ns".equalsIgnoreCase(sourceUnitString)) {
        sourceUnit = TimeUnit.NANOSECONDS;
    } else if ("us".equalsIgnoreCase(sourceUnitString)) {
        sourceUnit = TimeUnit.MICROSECONDS;
    } else if ("ms".equalsIgnoreCase(sourceUnitString)) {
        sourceUnit = TimeUnit.MILLISECONDS;
    } else if ("s".equalsIgnoreCase(sourceUnitString)) {
        sourceUnit = TimeUnit.SECONDS;
    } else if ("m".equalsIgnoreCase(sourceUnitString)) {
        sourceUnit = TimeUnit.MINUTES;
    } else if ("h".equalsIgnoreCase(sourceUnitString)) {
        sourceUnit = TimeUnit.HOURS;
    } else if ("d".equalsIgnoreCase(sourceUnitString)) {
        sourceUnit = TimeUnit.DAYS;
    } else {
        sourceUnit = TimeUnit.MILLISECONDS;
    }

    return sourceUnit.toNanos(sourceDuration);
}

From source file:br.unb.cic.bionimbuz.controller.slacontroller.SlaController.java

@Override
public void start() {
    LOGGER.info("SLAController started");
    this.threadExecutor.scheduleAtFixedRate(this, 0, TIME_TO_RUN, TimeUnit.MINUTES);
}

From source file:org.duracloud.mill.manifest.builder.ManifestBuilder.java

public void execute() throws Exception {
    long startTime = System.currentTimeMillis();

    if (clean) {//ww  w  . jav  a2  s.com
        clean();
    }
    build();

    this.executor.shutdown();
    log.info("awaiting the completion of all outstanding tasks...");
    if (this.executor.awaitTermination(5, TimeUnit.MINUTES)) {
        log.info("Completed all tasks.");
    } else {
        log.info("Unable to complete all tasks within the timeout period of 5 minutes.");
        this.executor.shutdownNow();
    }

    String duration = DurationFormatUtils.formatDurationHMS(System.currentTimeMillis() - startTime);

    log.info("duration={} total_item_processed={}  successes={} errors={}", duration, totalProcessed, successes,
            errors);

}