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.appleframework.monitor.service.AlertService.java

public void init() {

    executor.scheduleWithFixedDelay(new Runnable() {
        @Override//from   w  ww  .j a v  a  2s . c o m
        public void run() {
            watch();
        }
    }, 15, checkSeconds, TimeUnit.SECONDS);
    notifyTimes = new MapMaker().expiration(limitMinutes, TimeUnit.MINUTES).makeMap();
}

From source file:org.apache.cmueller.camel.apachecon.na2013.SqlSimpleTest.java

@Test
public void measureSqlSimpleExecution() throws Exception {
    template.setDefaultEndpointUri("direct:start");
    List<Object> paylaod = new ArrayList<Object>();
    paylaod.add("IBM");
    paylaod.add("cmueller");
    paylaod.add(140.34);//from   www .j  a  v  a 2  s.co  m
    paylaod.add(2000);

    warmUp(paylaod);

    getMockEndpoint("mock:end").expectedMessageCount(repeatCounter);
    getMockEndpoint("mock:end").setRetainFirst(0);
    getMockEndpoint("mock:end").setRetainLast(0);

    StopWatch watch = new StopWatch();
    for (int i = 0; i < repeatCounter; i++) {
        template.sendBody(paylaod);
    }
    assertMockEndpointsSatisfied(5, TimeUnit.MINUTES);

    System.out.println("measureSqlSimpleExecution duration: " + watch.stop() + "ms");
}

From source file:com.qwazr.crawler.web.driver.BrowserDriver.java

BrowserDriver(BrowserDriverEnum type, WebDriver driver, WebCrawlDefinition.ProxyDefinition currentProxy) {
    this.type = type;
    this.driver = driver;
    this.currentProxy = currentProxy;
    Timeouts timeouts = driver.manage().timeouts();
    timeouts.implicitlyWait(1, TimeUnit.MINUTES);
    timeouts.setScriptTimeout(2, TimeUnit.MINUTES);
    timeouts.pageLoadTimeout(3, TimeUnit.MINUTES);
}

From source file:com.acme.plugin.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/>//from ww w. ja va2  s .co m
 * 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:org.mitre.openid.connect.service.impl.DefaultStatsService.java

private Supplier<Map<Long, Integer>> createByClientIdCache() {
    return Suppliers.memoizeWithExpiration(new Supplier<Map<Long, Integer>>() {
        @Override/*  ww w.j ava  2 s.  c om*/
        public Map<Long, Integer> get() {
            return computeByClientId();
        }

    }, 10, TimeUnit.MINUTES);
}

From source file:com.doculibre.constellio.feedprotocol.FeedServlet.java

@Override
public void init(ServletConfig config) throws ServletException {
    System.out.println("FeedServlet Started");

    int feedProcessorThreads = ConstellioSpringUtils.getFeedProcessorThreads();
    threadPoolExecutor = new ThreadPoolExecutor(feedProcessorThreads, feedProcessorThreads, 5, TimeUnit.MINUTES,
            new ArrayBlockingQueue<Runnable>(feedProcessorThreads + 1),
            new ThreadPoolExecutor.CallerRunsPolicy());
}

From source file:backup.namenode.NameNodeRestoreProcessor.java

public NameNodeRestoreProcessor(Configuration conf, NameNode namenode, UserGroupInformation ugi)
        throws Exception {
    this.ugi = ugi;
    this.conf = conf;
    this.namesystem = namenode.getNamesystem();
    this.blockManager = namesystem.getBlockManager();
    Cache<ExtendedBlock, Boolean> cache = CacheBuilder.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES)
            .build();/*  w  w  w  .ja  v  a2  s .  co m*/
    currentRequestedRestore = Collections.newSetFromMap(cache.asMap());
    pollTime = conf.getLong(DFS_BACKUP_NAMENODE_MISSING_BLOCKS_POLL_TIME_KEY,
            DFS_BACKUP_NAMENODE_MISSING_BLOCKS_POLL_TIME_DEFAULT);
    blockCheck = new NameNodeBackupBlockCheckProcessor(conf, this, namenode, ugi);
    start();
}

From source file:pl.datamatica.traccar.api.fcm.Daemon.java

protected void start(ScheduledExecutorService scheduler, long delay, long period) {
    scheduler.scheduleAtFixedRate(runnable, delay, period, TimeUnit.MINUTES);
}

From source file:com.enitalk.configs.DateCache.java

@Bean(name = "skipCache")
public LoadingCache<String, ConcurrentSkipListSet<DateTime>> datesMap() {
    CacheBuilder<Object, Object> ccc = CacheBuilder.newBuilder();
    ccc.expireAfterWrite(2, TimeUnit.MINUTES);

    LoadingCache<String, ConcurrentSkipListSet<DateTime>> cache = ccc
            .build(new CacheLoader<String, ConcurrentSkipListSet<DateTime>>() {

                @Override//from ww  w . ja  v a2 s .  c o m
                public ConcurrentSkipListSet<DateTime> load(String key) throws Exception {
                    try {
                        HashMap teachers = mongo.findOne(Query.query(Criteria.where("i").is(key)),
                                HashMap.class, "teachers");
                        ObjectNode teacherJson = jackson.convertValue(teachers, ObjectNode.class);
                        String timeZone = teacherJson.at("/calendar/timeZone").asText();

                        NavigableSet<DateTime> set = days(teacherJson.path("schedule"), timeZone, teacherJson);

                        DateTimeZone dzz = DateTimeZone.forID(timeZone);
                        DateTimeFormatter df = ISODateTimeFormat.dateTimeNoMillis().withZone(dzz);

                        byte[] events = calendar.busyEvents(jackson.createObjectNode().put("id", key));
                        JsonNode evs = jackson.readTree(events);
                        Iterator<JsonNode> its = evs.iterator();
                        TreeSet<DateTime> dates = new TreeSet<>();
                        while (its.hasNext()) {
                            String date = its.next().asText();
                            DateTime av = df.parseDateTime(date).toDateTime(DateTimeZone.UTC);
                            dates.add(av);
                        }

                        set.removeAll(dates);

                        logger.info("Dates for i {} {}", key, set);

                        return new ConcurrentSkipListSet<>(set);

                    } catch (Exception e) {
                        logger.error(ExceptionUtils.getFullStackTrace(e));
                    }
                    return null;
                }

            });

    return cache;
}

From source file:com.oneops.cms.transmitter.CIEventReader.java

public void init() {
    super.init();
    orgCache = CacheBuilder.newBuilder().maximumSize(orgCacheMaxSize)
            .expireAfterWrite(orgCacheTtlInMins, TimeUnit.MINUTES).build();
}