protected void doStart() { if (this.requestUpgradeStrategy instanceof Lifecycle) { ((Lifecycle) this.requestUpgradeStrategy).start(); } }
@Override public void start() { if (!isRunning()) { this.running = true; if (this.sockJsService instanceof Lifecycle) { ((Lifecycle) this.sockJsService).start(); } } }
@Override public void start() { if (!isRunning()) { this.running = true; if (this.handshakeHandler instanceof Lifecycle) { ((Lifecycle) this.handshakeHandler).start(); } } }
@Override public void start() { if (!isRunning()) { if (this.webSocketClient instanceof Lifecycle) { ((Lifecycle) this.webSocketClient).start(); } else { this.running = true; } } }
@Override public void start() { if (!isRunning()) { this.running = true; if (this.handshakeHandler instanceof Lifecycle) { ((Lifecycle) this.handshakeHandler).start(); } } }
@Override public void start() { if (!isRunning()) { this.running = true; for (TransportHandler handler : this.handlers.values()) { if (handler instanceof Lifecycle) { ((Lifecycle) handler).start(); } } } }
@Override public void start() { if (!isRunning()) { this.running = true; for (Object handler : getUrlMap().values()) { if (handler instanceof Lifecycle) { ((Lifecycle) handler).start(); } } } }
protected void doStart() { if (getUpgradeStrategy() instanceof Lifecycle) { ((Lifecycle) getUpgradeStrategy()).start(); } }
@Override public void startInternal() { if (this.client instanceof Lifecycle && !((Lifecycle) this.client).isRunning()) { ((Lifecycle) this.client).start(); } super.startInternal(); }
@Override public void start() { if (!isRunning()) { this.running = true; for (Transport transport : this.transports) { if (transport instanceof Lifecycle) { Lifecycle lifecycle = (Lifecycle) transport; if (!lifecycle.isRunning()) { lifecycle.start(); } } } } }
@Override public void start() { if (!isRunning()) { this.running = true; if (getWebSocketClient() instanceof Lifecycle) { ((Lifecycle) getWebSocketClient()).start(); } } }
/** * Start the specified bean as part of the given set of Lifecycle beans, * making sure that any beans that it depends on are started first. * @param lifecycleBeans a Map with bean name as key and Lifecycle instance as value * @param beanName the name of the bean to start */ private void doStart(Map<String, ? extends Lifecycle> lifecycleBeans, String beanName, boolean autoStartupOnly) { Lifecycle bean = lifecycleBeans.remove(beanName); if (bean != null && bean != this) { String[] dependenciesForBean = getBeanFactory().getDependenciesForBean(beanName); for (String dependency : dependenciesForBean) { doStart(lifecycleBeans, dependency, autoStartupOnly); } if (!bean.isRunning() && (!autoStartupOnly || !(bean instanceof SmartLifecycle) || ((SmartLifecycle) bean).isAutoStartup())) { if (logger.isTraceEnabled()) { logger.trace("Starting bean '" + beanName + "' of type [" + bean.getClass().getName() + "]"); } try { bean.start(); } catch (Throwable ex) { throw new ApplicationContextException("Failed to start bean '" + beanName + "'", ex); } if (logger.isDebugEnabled()) { logger.debug("Successfully started bean '" + beanName + "'"); } } } }
private void waitForResults(Lifecycle lifecycle, int count, int maxTries) throws InterruptedException { lifecycle.start(); int timeout = 0; while (processed.size() < count && timeout++ < maxTries) { Thread.sleep(5); } lifecycle.stop(); }
private void waitForResults(Lifecycle lifecycle, int count, int maxTries) throws InterruptedException { lifecycle.start(); int timeout = 0; while (processed.size() < count && timeout++ < maxTries) { Thread.sleep(10); } lifecycle.stop(); }
private void waitForResults(Lifecycle lifecycle, int count, int maxTries) throws InterruptedException { lifecycle.start(); int timeout = 0; while (service.getProcessed().size() < count && timeout++ < maxTries) { Thread.sleep(5); } lifecycle.stop(); }
private void waitForResults(Lifecycle lifecycle, int count, int maxTries) throws InterruptedException { lifecycle.start(); int timeout = 0; while (service.getProcessed().size() < count && timeout++ < maxTries) { Thread.sleep(10); } lifecycle.stop(); }
@Before public void setup() throws Exception { logger.debug("Setting up '" + this.testName.getMethodName() + "', client=" + this.webSocketClient.getClass().getSimpleName() + ", server=" + this.server.getClass().getSimpleName()); this.wac = new AnnotationConfigWebApplicationContext(); this.wac.register(getAnnotatedConfigClasses()); this.wac.register(upgradeStrategyConfigTypes.get(this.server.getClass())); if (this.webSocketClient instanceof Lifecycle) { ((Lifecycle) this.webSocketClient).start(); } this.server.setup(); this.server.deployConfig(this.wac); this.server.start(); this.wac.setServletContext(this.server.getServletContext()); this.wac.refresh(); }
@Before public void setup() throws Exception { this.server.setHandler(createHttpHandler()); this.server.afterPropertiesSet(); this.server.start(); // Set dynamically chosen port this.port = this.server.getPort(); if (this.client instanceof Lifecycle) { ((Lifecycle) this.client).start(); } }
@Test public void singleLifecycleShutdown() throws Exception { CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>(); Lifecycle bean = new TestLifecycleBean(null, stoppedBeans); StaticApplicationContext context = new StaticApplicationContext(); context.getBeanFactory().registerSingleton("bean", bean); context.refresh(); assertFalse(bean.isRunning()); bean.start(); assertTrue(bean.isRunning()); context.stop(); assertEquals(1, stoppedBeans.size()); assertFalse(bean.isRunning()); assertEquals(bean, stoppedBeans.get(0)); }