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.kamax.mxisd.backend.firebase.GoogleFirebaseAuthenticator.java
private void waitOnLatch(BackendAuthResult result, CountDownLatch l, String purpose) { try {/* w w w . j av a2 s .co m*/ l.await(30, TimeUnit.SECONDS); } catch (InterruptedException e) { log.warn("Interrupted while waiting for " + purpose); result.fail(); } }
From source file:com.datastax.example.PreparedVsNonPreparedStatement.java
public void test1() { Random rnd = new Random(); final CsvReporter reporter = CsvReporter.forRegistry(metrics).formatFor(Locale.US) .convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS) .build(new File("/Users/patrick/projects/")); logger.info("Beginning PreparedVsNonPreparedStatement:Test1"); reporter.start(1, TimeUnit.SECONDS); //Insert 10000 for (int i = 0; i < 1000000; i++) { String firstName = RandomStringUtils.randomAlphabetic(10); String lastName = RandomStringUtils.randomAlphabetic(10); String street = RandomStringUtils.randomAlphabetic(8); int post_code = rnd.nextInt(99999); int phone = rnd.nextInt(99999999); final Timer.Context context = test1.time(); session.execute("insert into users (id, firstname, lastname, street, post_code, phone) VALUES (" + i + ", '" + firstName + "', '" + lastName + "', '" + street + "', " + post_code + ", " + phone + ");"); context.stop();//from w w w .j a v a 2 s. c o m } logger.info("Completed PreparedVsNonPreparedStatement:Test1"); }
From source file:com.epam.ta.reportportal.auth.LoginTimeBasedExpirationPolicy.java
@Override public Date getExpirationDate() { return DateUtils.addSeconds(Calendar.getInstance().getTime(), (int) (-1 * time.in(TimeUnit.SECONDS))); }
From source file:org.modeshape.example.spring.jcr.ModeShapeRepositoryFactory.java
@PreDestroy public void stop() throws Exception { try {/*from w ww . ja v a2 s. c om*/ ENGINE.shutdown().get(10, TimeUnit.SECONDS); } catch (Exception e) { LOG.error("Error while waiting for the ModeShape engine to shutdown", e); } }
From source file:io.gatling.jsonbenchmark.bytes.MainJacksonObjectBenchmark.java
@GenerateMicroBenchmark @OutputTimeUnit(TimeUnit.SECONDS) public void citmCatalog(BlackHole bh) throws Exception { bh.consume(parse(CITM_CATALOG_BYTES)); }
From source file:com.totalchange.bunman.cddb.impl.CddbQuerierImpl.java
public void close() throws IOException { executor.shutdown();//from ww w . j a v a 2s. c om try { executor.awaitTermination(60, TimeUnit.SECONDS); } catch (InterruptedException intEx) { logger.warn("Timed out waiting for threads to finish", intEx); } try { cddbPool.close(); } catch (Exception ex) { logger.warn("A problem occurred closing CDDB connections", ex); throw new IOException(ex); } }
From source file:com.github.marsbits.restfbmessenger.sample.EchoCallbackHandler.java
@Override public void onMessage(Messenger messenger, MessagingItem messaging) { String senderId = messaging.getSender().getId(); MessageItem message = messaging.getMessage(); logger.fine(format("Message received from %s: %s", senderId, message.getText())); IdMessageRecipient recipient = new IdMessageRecipient(senderId); messenger.send().markSeen(recipient); messenger.send().typingOn(recipient); sleep(TimeUnit.SECONDS, 1); if (message.getText() != null) { // Echo the received text message messenger.send().textMessage(recipient, format("Echo: %s", message.getText())); } else {//www . j a va 2 s.co m if (message.getAttachments() != null) { for (MessagingAttachment attachment : message.getAttachments()) { String type = attachment.getType(); if ("location".equals(type)) { // Echo the received location as text message(s) CoordinatesItem coordinates = attachment.getPayload().getCoordinates(); Double lat = coordinates.getLat(); Double longVal = coordinates.getLongVal(); messenger.send().textMessage(recipient, format("Lat: %s", lat)); messenger.send().textMessage(recipient, format("Long: %s", longVal)); } else { // Echo the attachment String url = attachment.getPayload().getUrl(); messenger.send().attachment(recipient, MediaAttachment.Type.valueOf(type.toUpperCase()), url); } } } } messenger.send().typingOff(recipient); }
From source file:com.bna.ezrxlookup.ui.web.EZRxBusinessTests.java
@Before public void setUp() throws Exception { driver = (WebDriver) new FirefoxDriver(); baseUrl = "http://52.7.4.133:8080"; //Ideally this should be local hosts and all test will be run in a docker container driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); }
From source file:net.javacrumbs.futureconverter.common.test.spring.SpringConvertedFutureTestHelper.java
@Override public void waitForCalculationToFinish(ListenableFuture<String> convertedFuture) throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); convertedFuture.addCallback(new ListenableFutureCallback<String>() { @Override/*w ww. jav a 2 s. c o m*/ public void onSuccess(String result) { latch.countDown(); } @Override public void onFailure(Throwable t) { latch.countDown(); } }); latch.await(1, TimeUnit.SECONDS); }
From source file:love.sola.netsupport.session.MapSessionRepository.java
public MapSessionRepository() { this(CacheBuilder.newBuilder().concurrencyLevel(4).maximumSize(65535) .expireAfterAccess(Settings.I.User_Session_Max_Inactive, TimeUnit.SECONDS) .build(new CacheLoader<String, MapSession>() { @Override/*w ww . j a va2s . com*/ public MapSession load(@Nonnull String key) throws Exception { return new MapSession(key); } })); }