Examples of toMillis()


Examples of java.util.concurrent.TimeUnit.toMillis()

        }
        // socket pool
        streamingSocketPool = new SocketPool(adminClient.getAdminClientCluster().getNumberOfNodes()
                                                     * MAX_STORES_PER_SESSION,
                                             (int) unit.toMillis(adminClientConfig.getAdminConnectionTimeoutSec()),
                                             (int) unit.toMillis(adminClientConfig.getAdminSocketTimeoutSec()),
                                             adminClientConfig.getAdminSocketBufferSize(),
                                             adminClientConfig.getAdminSocketKeepAlive());

        nodeIdStoreToSocketRequest = new HashMap();
        nodeIdStoreToOutputStreamRequest = new HashMap();
View Full Code Here

Examples of java.util.concurrent.TimeUnit.toMillis()

                    .equalTo("sjkldhkdjfgjlkfg");
            Assert.fail(TimeoutException.class.getName() + " should be thrown.");
        } catch(TimeoutException e) {
            long was = System.currentTimeMillis() - started;
            Assert.assertTrue("The waiting time shouldn't be much bigger than " + duration + " " + unit + ", but was " + was + " ms.",
                    was < unit.toMillis(duration + duration / 2));
            Assert.assertTrue("The waiting time shouldn't lower than " + duration + " " + unit + ", but was " + was + " ms.",
                    was >= unit.toMillis(duration));
        }
    }
View Full Code Here

Examples of java.util.concurrent.TimeUnit.toMillis()

        } catch(TimeoutException e) {
            long was = System.currentTimeMillis() - started;
            Assert.assertTrue("The waiting time shouldn't be much bigger than " + duration + " " + unit + ", but was " + was + " ms.",
                    was < unit.toMillis(duration + duration / 2));
            Assert.assertTrue("The waiting time shouldn't lower than " + duration + " " + unit + ", but was " + was + " ms.",
                    was >= unit.toMillis(duration));
        }
    }

}
View Full Code Here

Examples of java.util.concurrent.TimeUnit.toMillis()

                final TimeUnit unit = TimeUnit.valueOf(unitName);
                millis = TimeUnit.MILLISECONDS.convert(time, unit);
            } catch (IllegalArgumentException e) {
                try {
                    final IEEETimeUnit unit = IEEETimeUnit.valueOf(unitName);
                    millis = unit.toMillis(time);
                } catch (IllegalArgumentException e2) {
                    throw new IllegalArgumentException
                        ("Duration argument has unknown unit name: " +
                         property);
                }
View Full Code Here

Examples of java.util.concurrent.TimeUnit.toMillis()

        try {
            final String[] s = period.split(" ", 2);
            long duration = Math.abs(Long.parseLong(s[0]));
            TimeUnit timeUnit = TimeUnit.valueOf(s[1]);
            return timeUnit.toMillis(duration);
        } catch (RuntimeException ex) {
            throw new IllegalArgumentException(Keys.realm.ldap.syncPeriod + " must have format '<long> <TimeUnit>' where <TimeUnit> is one of 'MILLISECONDS', 'SECONDS', 'MINUTES', 'HOURS', 'DAYS'");
        }
    }
View Full Code Here

Examples of java.util.concurrent.TimeUnit.toMillis()

        try {
            final String[] s = period.split(" ", 2);
            long duration = Math.abs(Long.parseLong(s[0]));
            TimeUnit timeUnit = TimeUnit.valueOf(s[1]);
            return timeUnit.toMillis(duration);
        } catch (RuntimeException ex) {
            throw new IllegalArgumentException(Keys.realm.ldap.syncPeriod + " must have format '<long> <TimeUnit>' where <TimeUnit> is one of 'MILLISECONDS', 'SECONDS', 'MINUTES', 'HOURS', 'DAYS'");
        }
    }
View Full Code Here

Examples of java.util.concurrent.TimeUnit.toMillis()

         barrier.await(); // wait for all threads to be ready

         long timeout = warmup ? WARMUP_TIME_SECS : RUNNING_TIME_SECS;
         TimeUnit unit = TimeUnit.SECONDS;

         Thread.sleep(unit.toMillis(timeout)); // Wait for the duration of the test
         run.set(false); // Instruct tests to stop doing work
         barrier.await(2, TimeUnit.MINUTES); // wait for all threads to finish

         log.infof("[%s] All threads finished, check for exceptions", title(warmup));
         for (Future<String> future : futures) {
View Full Code Here

Examples of java.util.concurrent.TimeUnit.toMillis()

                    entry.setState(state);
                    entry.updateExpiry(keepalive, effectiveUnit);
                    if (this.log.isDebugEnabled()) {
                        final String s;
                        if (keepalive > 0) {
                            s = "for " + (double) effectiveUnit.toMillis(keepalive) / 1000 + " seconds";
                        } else {
                            s = "indefinitely";
                        }
                        this.log.debug("Connection " + format(entry) + " can be kept alive " + s);
                    }
View Full Code Here

Examples of java.util.concurrent.TimeUnit.toMillis()

  public void sleepFor(String sleepTime) throws InterruptedException {
    String[] array = sleepTime.split(" ");
    long duration = Long.parseLong(array[0]);
    TimeUnit unit = TimeUnit.valueOf(array[1].toUpperCase());
    Thread.sleep(unit.toMillis(duration));
  }

}
View Full Code Here

Examples of java.util.concurrent.TimeUnit.toMillis()

                summand = Long.valueOf(matcher.group(DURATION_GROUP));
            } catch (NumberFormatException e) {
                throw new IllegalArgumentException("Number overflow for duration '" + rawStr + "'", e);
            }
           
            result = result.add(BigInteger.valueOf(timeUnit.toMillis(summand)));
        }
       
        if (result.compareTo(LONG_MAX) == 1)
            throw new IllegalArgumentException("Number overflow for duration '" + rawStr + "'");
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.