本文整理了Java中org.springframework.context.Lifecycle.stop()
方法的一些代码示例,展示了Lifecycle.stop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lifecycle.stop()
方法的具体详情如下:
包路径:org.springframework.context.Lifecycle
类名称:Lifecycle
方法名:stop
[英]Stop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method. Consider implementing SmartLifecycleand its stop(Runnable) variant when asynchronous stop behavior is necessary.
Note that this stop notification is not guaranteed to come before destruction: On regular shutdown, Lifecycle beans will first receive a stop notification before the general destruction callbacks are being propagated; however, on hot refresh during a context's lifetime or on aborted refresh attempts, a given bean's destroy method will be called without any consideration of stop signals upfront.
Should not throw an exception if the component is not running (not started yet).
In the case of a container, this will propagate the stop signal to all components that apply.
[中]通常以同步方式停止此组件,以便在返回此方法时完全停止该组件。当需要异步停止行为时,应考虑实现StaseLIFeLeCyCurrand及其停止(RunnEnable)变体。
请注意,此停止通知不保证在销毁之前发出:在定期关闭时,Lifecycle Bean将在传播常规销毁回调之前首先收到停止通知;但是,在上下文的生命周期内进行热刷新或刷新尝试中止时,将调用给定bean的destroy方法,而不预先考虑停止信号。
如果组件未运行(尚未启动),则不应引发异常。
对于容器,这将向所有应用的组件传播停止信号。
代码示例来源:origin: spring-projects/spring-framework
protected void doStop() {
if (this.requestUpgradeStrategy instanceof Lifecycle) {
((Lifecycle) this.requestUpgradeStrategy).stop();
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void stop() {
if (isRunning()) {
this.running = false;
if (this.handshakeHandler instanceof Lifecycle) {
((Lifecycle) this.handshakeHandler).stop();
}
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void stop() {
if (isRunning()) {
this.running = false;
if (this.handshakeHandler instanceof Lifecycle) {
((Lifecycle) this.handshakeHandler).stop();
}
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void stop() {
if (isRunning()) {
if (this.webSocketClient instanceof Lifecycle) {
((Lifecycle) this.webSocketClient).stop();
}
else {
this.running = false;
}
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void stop() {
if (isRunning()) {
this.running = false;
for (TransportHandler handler : this.handlers.values()) {
if (handler instanceof Lifecycle) {
((Lifecycle) handler).stop();
}
}
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void stop() {
if (isRunning()) {
this.running = false;
if (this.sockJsService instanceof Lifecycle) {
((Lifecycle) this.sockJsService).stop();
}
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void stop() {
if (isRunning()) {
this.running = false;
for (Object handler : getUrlMap().values()) {
if (handler instanceof Lifecycle) {
((Lifecycle) handler).stop();
}
}
}
}
代码示例来源:origin: spring-projects/spring-framework
protected void doStop() {
if (getUpgradeStrategy() instanceof Lifecycle) {
((Lifecycle) getUpgradeStrategy()).stop();
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void stopInternal() throws Exception {
if (this.client instanceof Lifecycle && ((Lifecycle) this.client).isRunning()) {
((Lifecycle) this.client).stop();
}
super.stopInternal();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void stop() {
if (isRunning()) {
this.running = false;
for (Transport transport : this.transports) {
if (transport instanceof Lifecycle) {
Lifecycle lifecycle = (Lifecycle) transport;
if (lifecycle.isRunning()) {
lifecycle.stop();
}
}
}
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void stop() {
if (isRunning()) {
this.running = false;
if (getWebSocketClient() instanceof Lifecycle) {
((Lifecycle) getWebSocketClient()).stop();
}
}
}
代码示例来源:origin: spring-projects/spring-framework
bean.getClass().getName() + "]");
bean.stop();
if (logger.isDebugEnabled()) {
logger.debug("Successfully stopped bean '" + beanName + "'");
代码示例来源:origin: org.springframework/spring-context
bean.getClass().getName() + "]");
bean.stop();
if (logger.isDebugEnabled()) {
logger.debug("Successfully stopped bean '" + beanName + "'");
代码示例来源:origin: spring-projects/spring-framework
@After
public void stop() {
if (this.client instanceof Lifecycle) {
((Lifecycle) this.client).stop();
}
this.server.stop();
}
代码示例来源:origin: spring-projects/spring-batch
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();
}
代码示例来源:origin: spring-projects/spring-batch
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();
}
代码示例来源:origin: spring-projects/spring-batch
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();
}
代码示例来源:origin: spring-projects/spring-framework
@After
public void teardown() throws Exception {
try {
if (this.webSocketClient instanceof Lifecycle) {
((Lifecycle) this.webSocketClient).stop();
}
}
catch (Throwable t) {
logger.error("Failed to stop WebSocket client", t);
}
try {
this.server.undeployConfig();
}
catch (Throwable t) {
logger.error("Failed to undeploy application config", t);
}
try {
this.server.stop();
}
catch (Throwable t) {
logger.error("Failed to stop server", t);
}
try {
this.wac.close();
}
catch (Throwable t) {
logger.error("Failed to close WebApplicationContext", t);
}
}
代码示例来源:origin: spring-projects/spring-batch
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();
}
代码示例来源:origin: spring-cloud/spring-cloud-gateway
@After
public void stop() throws Exception {
if (this.client instanceof Lifecycle) {
((Lifecycle) this.client).stop();
}
this.server.stop();
if (this.gatewayContext != null) {
this.gatewayContext.stop();
}
}
内容来源于网络,如有侵权,请联系作者删除!