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:com.techcavern.wavetact.eventListeners.ConnectListener.java
public void onConnect(ConnectEvent event) throws Exception { String NickServCommand = DatabaseUtils.getNetwork(IRCUtils.getNetworkNameByNetwork(event.getBot())) .getValue(NETWORKS.NICKSERVCOMMAND); String NickServNick = DatabaseUtils.getNetwork(IRCUtils.getNetworkNameByNetwork(event.getBot())) .getValue(NETWORKS.NICKSERVNICK); if (NickServNick == null) { NickServNick = "NickServ"; }// w ww.j a v a 2 s. com if (NickServCommand != null) { event.getBot().sendRaw().rawLine("PRIVMSG " + NickServNick + " :" + NickServCommand); } TimeUnit.SECONDS.sleep(10); Registry.messageQueue.get(event.getBot()).addAll(Arrays .asList(StringUtils.split(DatabaseUtils.getNetwork(IRCUtils.getNetworkNameByNetwork(event.getBot())) .getValue(NETWORKS.CHANNELS), ", ")) .stream().map(channel -> ("JOIN :" + channel)).collect(Collectors.toList())); TimeUnit.SECONDS.sleep(10); ListenerManager listenerManager = event.getBot().getConfiguration().getListenerManager(); listenerManager.getListeners().stream() .filter(lis -> !(lis instanceof ConnectListener || lis instanceof CoreHooks)) .forEach(listener -> listenerManager.removeListener(listener)); listenerManager.addListener(new ChanMsgListener()); listenerManager.addListener(new PartListener()); listenerManager.addListener(new PrivMsgListener()); listenerManager.addListener(new KickListener()); listenerManager.addListener(new BanListener()); listenerManager.addListener(new JoinListener()); listenerManager.addListener(new FunMsgListener()); listenerManager.addListener(new RelayMsgListener()); listenerManager.addListener(new InviteListener()); listenerManager.addListener(new TellMsgListener()); listenerManager.addListener(new NoticeListener()); listenerManager.addListener(new ActionListener()); listenerManager.addListener(new CTCPListener()); IRCUtils.sendLogChanMsg(event.getBot(), "[Connection Successful]"); }
From source file:io.kahu.hawaii.util.call.RequestContext.java
public RequestContext(String backendSystem, String methodName, int timeOut) { this(backendSystem, methodName, new TimeOut(timeOut, TimeUnit.SECONDS)); }
From source file:com.xyxy.platform.examples.showcase.demos.cache.guava.GuavaCacheDemo.java
@Test public void demo() throws Exception { // 1005//from w w w . j a v a 2 s .co m LoadingCache<Long, User> cache = CacheBuilder.newBuilder().maximumSize(100) .expireAfterAccess(5, TimeUnit.SECONDS).build(new CacheLoader<Long, User>() { @Override public User load(Long key) throws Exception { logger.info("fetch from database"); return accountService.getUser(key); } }); // ?? DataFixtures.executeScript(dataSource, "classpath:data/h2/cleanup-data.sql", "classpath:data/h2/import-data.sql"); // ?appenderassert LogbackListAppender appender = new LogbackListAppender(); appender.addToLogger(GuavaCacheDemo.class); // ? User user = cache.get(1L); assertThat(user.getLoginName()).isEqualTo("admin"); assertThat(appender.isEmpty()).isFalse(); appender.clearLogs(); // ? User user2 = cache.get(1L); assertThat(user2.getLoginName()).isEqualTo("admin"); assertThat(appender.isEmpty()).isTrue(); // ?? Threads.sleep(10, TimeUnit.SECONDS); User user3 = cache.get(1L); assertThat(user3.getLoginName()).isEqualTo("admin"); assertThat(appender.isEmpty()).isFalse(); }
From source file:org.zalando.spring.boot.example.ExampleApplicationTest.java
@Test public void startUp() throws InterruptedException { TimeUnit.SECONDS.sleep(3); job.run();/*from ww w.j av a2s .c o m*/ TimeUnit.SECONDS.sleep(2); job.run(); TimeUnit.SECONDS.sleep(2); }
From source file:org.apache.cxf.systest.security.OnewayServiceImpl.java
public String getLastCaller() { try {//ww w. j ava 2 s . c om return lastCallerQueue.poll(60, TimeUnit.SECONDS); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); return null; } }
From source file:com.vmanolache.mqttpolling.Polling.java
private void startPolling() { final Runnable beeper = new Runnable() { @Override//from w ww . j a v a 2 s . c o m public void run() { System.out.println("Executing MQQT post"); try { sendPost(); } catch (UnsupportedEncodingException | JSONException ex) { Logger.getLogger(Polling.class.getName()).log(Level.SEVERE, null, ex); } } }; scheduler.scheduleAtFixedRate(beeper, 10, SECONDS, TimeUnit.SECONDS); }
From source file:de.hpi.fgis.hdrs.node.AntiEntropyThread.java
@Override public void run() { while (!quit) { // wait for some ae request, or 10 seconds Peer peer = null;/*from w ww . j a v a2 s . com*/ try { peer = queue.poll(10, TimeUnit.SECONDS); } catch (InterruptedException e) { // ignore } try { router.update(peer); } catch (UnknownHostException ex) { // this node can't be reached. might be a temporary network failure, // log a warning LOG.warn("Cannot run anti-entropy with peer " + peer + ": unkown host"); } catch (ConnectException ex) { LOG.warn("Cannot run anti-entropy with peer " + peer + ": cannot connect"); } catch (IOException ex) { LOG.warn("Anti-entropy error.", ex); } catch (Throwable ex) { LOG.fatal("Anti-entropy failure.", ex); quit(); } } }
From source file:functional.testing.customerclient.test.RegisterTest.java
License:asdf
@Before public void setup() { driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.navigate().to("http://localhost:8080/admissions-customer-client/login.xhtml"); LoginPage lp = new LoginPage(driver); rp = lp.clickRegisterAccount();//from ww w .j a v a 2 s . c o m }
From source file:com.yawen.Fetcher.IdleConnectionMonitorThread.java
@Override public void run() { try {//from www .j a va 2s . com while (!shutdown) { synchronized (this) { wait(5000); // connMgr.closeExpiredConnections(); // 30 connMgr.closeIdleConnections(30, TimeUnit.SECONDS); } } } catch (InterruptedException ignored) { // terminate ignored.printStackTrace(); } }
From source file:com.boundary.sdk.event.snmp.SNMPGetTest.java
@Test public void testSnmpGet() throws InterruptedException { out.await(10, TimeUnit.SECONDS); out.setMinimumExpectedMessageCount(1); out.assertIsSatisfied();/*from www . j a v a 2 s . c om*/ List<Exchange> exchanges = out.getExchanges(); for (Exchange exchange : exchanges) { Message message = exchange.getIn(); Object o = message.getBody(); assertNotNull("Check for null body", o); LOG.info("Body class: {}", o.getClass().toString()); LOG.info("Body content: {}", o.toString()); Number httpCode = message.getHeader(Exchange.HTTP_RESPONSE_CODE, Number.class); assertNotNull("check for null result code", httpCode); assertEquals("check HTTP result code", 200, httpCode); } }