List of usage examples for java.util.concurrent TimeUnit SECONDS
TimeUnit SECONDS
To view the source code for java.util.concurrent TimeUnit SECONDS.
Click Source Link
From source file:io.github.retz.web.StatusCache.java
static void start(int interval) { LOG.info("Starting status cache updater with interval={}s", interval); scheduler.schedule(new StatusCache(interval), interval, TimeUnit.SECONDS); }
From source file:org.faster.cache.RedisCacheService.java
@Override @SuppressWarnings("unchecked") protected void doPutInCache(String key, int expiration, Object obj) { redis.opsForValue().set(key, obj);/* w ww.j a v a 2 s. c om*/ if (expiration > 0) { redis.expire(key, expiration, TimeUnit.SECONDS); } }
From source file:com.btobits.automator.ant.types.TimeValue.java
public TimeValue() { duration = 0; unit = TimeUnit.SECONDS; }
From source file:com.ec2box.manage.util.OTPUtil.java
/** * verifies code for OTP secret//from w w w . ja v a 2 s . c om * * @param secret shared secret * @param token verification token * @return true if success */ public static boolean verifyToken(String secret, long token) { //check token in near future or past int window = TOKEN_WINDOW; for (int i = window; i >= -window; i--) { long time = (new Date().getTime() / TimeUnit.SECONDS.toMillis(CHANGE_INTERVAL)) + i; if (verifyToken(secret, token, time)) { return true; } } return false; }
From source file:org.zenoss.app.consumer.ConsumerSpringConfig.java
@Bean @Qualifier("zapp::executor::metrics") ExecutorService metricsExecutorService() { return dropwizardEnvironment.managedExecutorService("Consumer Executor %d", metricsServiceConfiguration().getThreadPoolSize(), metricsServiceConfiguration().getThreadPoolSize(), 5, TimeUnit.SECONDS); }
From source file:edu.cornell.mannlib.ld4lindexing.ThreadPool.java
public void shutdownAndWait() { waitForIdle();//from w w w . j av a 2s. c om service.shutdown(); try { service.awaitTermination(60, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new RuntimeException("While waiting for threadpool shutdown", e); } }
From source file:monasca.common.middleware.TokenCache.java
public TokenCache(final long maxSize, final long timeToExpire) { factory = appConfig.getFactory();// www. ja va 2 s .co m cache = CacheBuilder.newBuilder().maximumSize(maxSize).expireAfterWrite(timeToExpire, TimeUnit.SECONDS) .build(new CacheLoader<String, String>() { public String load(String key) throws TException, ClientProtocolException { String value = null; AuthClient client = null; try { client = factory.getClient(); value = client.validateTokenForServiceEndpointV3(key); } finally { if (client != null) factory.recycle(client); } return value; } }); }
From source file:org.openscoring.service.ObjectMapperProvider.java
public ObjectMapperProvider() { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new OpenscoringModule()); mapper.registerModule(new MetricsModule(TimeUnit.SECONDS, TimeUnit.SECONDS, false)); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); setMapper(mapper);//w ww .j a v a 2 s . c o m }
From source file:com.sm.store.AppSyncHandler.java
private void init() { BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(maxQueue); threadPools = new ThreadPoolExecutor(maxThreads, maxThreads, 30, TimeUnit.SECONDS, queue); }
From source file:at.ac.univie.isc.asio.d2rq.pool.PooledD2rqFactory.java
public static JenaFactory using(final D2rqConfigModel d2rq, final Jdbc jdbc, final Timeout timeout, final int size) { final D2rqModelAllocator allocator = new D2rqModelAllocator(d2rq, jdbc); // fail fast if d2rq config is corrupt - stormpot may endlessly try to allocate models otherwise allocator.newModel().close(); // this should throw if config is corrupt final Config<PooledModel> config = new Config<>() // D2rqModelAllocator performs validation checks on #reallocate() // set a short expiration period to enable frequent liveness checks .setAllocator(allocator).setExpiration(new TimeSpreadExpiration(15, 30, TimeUnit.SECONDS)) .setPreciseLeakDetectionEnabled(true) .setThreadFactory(new ThreadFactoryBuilder().setNameFormat("d2rq-pool-%d").build()).setSize(size); final QueuePool<PooledModel> pool = new QueuePool<>(config); return new PooledD2rqFactory(pool, d2rq.getPrefixes(), timeout); }