Example usage for java.util.concurrent TimeUnit SECONDS

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

Introduction

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

Prototype

TimeUnit SECONDS

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

Click Source Link

Document

Time unit representing one second.

Usage

From source file:nu.yona.server.DOSProtectionService.java

@PostConstruct
private void initializeCache() {
    attemptsCache = CacheBuilder.newBuilder()
            .expireAfterWrite(yonaProperties.getSecurity().getDosProtectionWindow().getSeconds(),
                    TimeUnit.SECONDS)
            .build(new CacheLoader<String, Integer>() {
                @Override//from www  . j a  v a  2  s. c  om
                public Integer load(String key) {
                    return 0;
                }
            });
}

From source file:org.geowebcache.seed.SeederThreadPoolExecutor.java

public SeederThreadPoolExecutor(int corePoolSize, int maxPoolSize) {
    super(corePoolSize, maxPoolSize, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), tf);
}

From source file:com.clican.pluto.cms.core.service.impl.IssueQueueServiceImpl.java

public void start() {
    log.info("starting issue queue pool sender ..." + this);

    int coreNumber = 3;
    if (coreNumber > threadNumber) {
        coreNumber = threadNumber;//from   w w  w . j a v a 2s.  c  om
    }
    sendExecutor = new ThreadPoolExecutor(coreNumber, threadNumber, 60, TimeUnit.SECONDS, issueQueue);
}

From source file:com.liferay.portal.search.solr.server.LiveServerChecker.java

public LiveServerChecker(final SolrServerFactory solrServerFactory, Long delay) {

    _solrServerFactory = solrServerFactory;

    _scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();

    _scheduledExecutorService.scheduleWithFixedDelay(this, 0, delay, TimeUnit.SECONDS);

    SolrServletContextListener.registerLiveServerChecker(this);
}

From source file:com.omertron.yamjtrakttv.tools.CompleteMoviesTools.java

/**
 * Parse the video element and extract the information from it.
 *
 * @param eVideo//from  w w w .  j  av a  2  s  .  co  m
 * @return
 */
public static Video parseVideo(Element eVideo) {
    Video v = new Video();
    v.setTitle(DOMHelper.getValueFromElement(eVideo, "title"));
    v.setYear(DOMHelper.getValueFromElement(eVideo, "year"));
    v.setType(DOMHelper.getValueFromElement(eVideo, "movieType"));
    v.setWatched(Boolean.parseBoolean(DOMHelper.getValueFromElement(eVideo, "watched")));

    String stringDate = DOMHelper.getValueFromElement(eVideo, "watchedDate");
    if (StringUtils.isNumeric(stringDate) && !"0".equals(stringDate)) {
        v.setWatchedDate(new Date(Long.parseLong(stringDate)));
    } else {
        LOG.debug("Invalid watched date '" + stringDate + "' using current date");
        v.setWatchedDate(new Date());
        // Because the date was set by us, let's add a small (1 second) delay to ensure that we don't get identical watched dates
        try {
            TimeUnit.SECONDS.sleep(DEFAULT_DELAY);
        } catch (InterruptedException ex) {
            // Don't care if we are interrupted or not.
        }
    }

    NodeList nlID = eVideo.getElementsByTagName("id");
    if (nlID.getLength() > 0) {
        Node nID;
        Element eID;
        for (int loop = 0; loop < nlID.getLength(); loop++) {
            nID = nlID.item(loop);
            if (nID.getNodeType() == Node.ELEMENT_NODE) {
                eID = (Element) nID;
                String moviedb = eID.getAttribute("movieDatabase");
                if (StringUtils.isNotBlank(moviedb)) {
                    v.addId(moviedb, eID.getTextContent());
                }
            }
        }
    }

    // TV specific processing
    if (v.isTvshow()) {
        v.addEpisodes(parseTvFiles(eVideo));
    }

    return v;
}

From source file:io.airlift.stats.TimeStat.java

public TimeStat(Ticker ticker) {
    this(ticker, TimeUnit.SECONDS);
}

From source file:be.bittich.quote.config.CacheConfig.java

@Bean
public CacheManager cacheManager() {
    GuavaCacheManager cacheManager = new GuavaCacheManager();
    cacheManager.setCacheBuilder(// w ww.  j  a  v a  2  s .  c om
            CacheBuilder.newBuilder().maximumSize(env.getProperty("cache.maxSize", Integer.class))
                    .expireAfterWrite(env.getProperty("cache.expire", Integer.class), TimeUnit.SECONDS));
    return cacheManager;
}

From source file:com.joyent.manta.client.MetricReporterSupplier.java

private static Slf4jReporter buildSlf4jReporter(final MantaClientMetricConfiguration metricConfig) {
    return Slf4jReporter.forRegistry(metricConfig.getRegistry()).convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS).prefixedWith(metricConfig.getClientId().toString())
            .outputTo(LoggerFactory.getLogger(FMT_METRIC_LOGGER_NAME))
            // .shutdownExecutorOnStop()
            // .markWith()
            // .withLoggingLevel()
            .build();/*from   w  w w.j  a va  2  s .  c o m*/
}

From source file:org.nebula.service.core.Heartbeat.java

@PostConstruct
public void start() throws Exception {

    heartbeatDetector.preProcess();/*w w  w  .j ava  2s .co  m*/

    scheduler.scheduleWithFixedDelay(heartbeatDetector, 0, intervalSecs, TimeUnit.SECONDS);

    logger.info("Heartbeat started interval " + intervalSecs);
}

From source file:me.ryandowling.allmightybot.commands.HighlightCommand.java

@Override
public boolean run(AllmightyBot bot, MessageEvent event) {
    if (super.run(bot, event)) {
        int uptime = (int) Utils.getDateDiff(bot.getSettings().getStartTime(), new Date(), TimeUnit.SECONDS);

        timesToHighlight.add(Utils.timeConversionRaw(uptime));

        save();// w w  w .j av  a  2 s  . c om

        event.getChannel().send().message(
                Utils.replaceVariablesInString(bot.getLangValue("highlight"), Utils.timeConversionRaw(uptime)));

        return true;
    }

    return false;
}