List of usage examples for java.util.concurrent TimeUnit MINUTES
TimeUnit MINUTES
To view the source code for java.util.concurrent TimeUnit MINUTES.
Click Source Link
From source file:Producer.java
public synchronized void run() { for (int i = 0; i < 10; i++) { try {/*from w w w .j a v a2 s . c om*/ deque.offerFirst(i, 999, TimeUnit.MINUTES); System.out.println(name + " puts " + i); Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } } }
From source file:Main.java
public static String durationToFloat(long milliseconds) { long minute = TimeUnit.MILLISECONDS.toMinutes(milliseconds); long seconds = TimeUnit.MILLISECONDS.toSeconds(milliseconds) - TimeUnit.MINUTES.toSeconds(minute); if (seconds == 60) { minute = minute + 1;//from www . java 2s.c o m seconds = 0; } else { seconds = (100 * seconds) / 60; } return String.format("%d.%d", minute, seconds); }
From source file:org.z.global.util.TimeValue.java
public static TimeValue timeValueMinutes(long minutes) { return new TimeValue(minutes, TimeUnit.MINUTES); }
From source file:Producer.java
public synchronized void run() { for (int i = 0; i < 10; i++) { try {/*w w w . j a v a2s .c om*/ int j = deque.poll(99, TimeUnit.MINUTES); System.out.println(name + " takes " + j); Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } } }
From source file:Producer.java
public synchronized void run() { for (int i = 0; i < 10; i++) { try {/*from w w w .ja va 2 s . c om*/ int j = deque.pollLast(99, TimeUnit.MINUTES); System.out.println(name + " takes " + j); Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } } }
From source file:Producer.java
public synchronized void run() { for (int i = 0; i < 10; i++) { try {/*from ww w .j a v a 2s . co m*/ int j = deque.pollFirst(99, TimeUnit.MINUTES); System.out.println(name + " takes " + j); Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } } }
From source file:io.cloudslang.lang.compiler.caching.CachedPrecompileServiceImpl.java
@PostConstruct public void init() { cache = CacheBuilder.newBuilder().maximumSize(500) .concurrencyLevel(2 * Runtime.getRuntime().availableProcessors()) .expireAfterWrite(60, TimeUnit.MINUTES).build(); }
From source file:com.carlomicieli.jtrains.config.SpringMetricsConfig.java
@Override public void configureReporters(MetricRegistry metricRegistry) { ConsoleReporter.forRegistry(metricRegistry).build().start(1, TimeUnit.MINUTES); }
From source file:com.assignment4.security.SaltFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // Assume its HTTP HttpServletRequest httpReq = (HttpServletRequest) request; // Check the user session for the salt cache, if none is present we create one Cache<String, Boolean> csrfPreventionSaltCache = (Cache<String, Boolean>) httpReq.getSession() .getAttribute("csrfPreventionSaltCache"); if (csrfPreventionSaltCache == null) { csrfPreventionSaltCache = CacheBuilder.newBuilder().maximumSize(5000) .expireAfterWrite(20, TimeUnit.MINUTES).build(); httpReq.getSession().setAttribute("csrfPreventionSaltCache", csrfPreventionSaltCache); }/*from w w w .java 2 s .co m*/ // Generate the salt and store it in the users cache String salt = RandomStringUtils.random(20, 0, 0, true, true, null, new SecureRandom()); csrfPreventionSaltCache.put(salt, Boolean.TRUE); // Add the salt to the current request so it can be used // by the page rendered in this request httpReq.setAttribute("randId", salt); chain.doFilter(request, response); }
From source file:org.ambientlight.config.room.entities.climate.DayEntry.java
public DayEntry(byte high, byte low) { int value = MaxUtil.byteArrayToInt(new byte[] { high, low }, 0, 2); int timeInMinutes = (value & 0x1FF) * 5; temp = ((value >> 9) & 0x3F) / 2.0f; hour = (int) TimeUnit.MINUTES.toHours(timeInMinutes); min = (int) TimeUnit.MINUTES.toMinutes(timeInMinutes) - (int) TimeUnit.HOURS.toMinutes(hour); }