INT-4486: Properly implement stop(Runnable)
JIRA: https://jira.spring.io/browse/INT-4486 The `SmartLifecycle.stop(Runnable callback)` must always call the `callback` in the end independently of the internal state * Revise all the `SmartLifecycle` implementations for the proper `callback` handling **Cherry-pick to 5.0.x and 4.3.x**
This commit is contained in:
committed by
Gary Russell
parent
125cc861d4
commit
1ce656e4fe
@@ -362,6 +362,9 @@ public class ConsumerEndpointFactoryBean
|
||||
if (this.endpoint != null) {
|
||||
this.endpoint.stop(callback);
|
||||
}
|
||||
else {
|
||||
callback.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -247,6 +247,9 @@ public class SourcePollingChannelAdapterFactoryBean implements FactoryBean<Sourc
|
||||
if (this.adapter != null) {
|
||||
this.adapter.stop(callback);
|
||||
}
|
||||
else {
|
||||
callback.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -95,6 +95,9 @@ public abstract class IntegrationFlowAdapter implements IntegrationFlow, SmartLi
|
||||
if (this.running.getAndSet(false)) {
|
||||
this.targetIntegrationFlow.stop(callback);
|
||||
}
|
||||
else {
|
||||
callback.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -199,6 +199,9 @@ public abstract class AbstractEndpoint extends IntegrationObjectSupport
|
||||
logger.info("stopped " + this);
|
||||
}
|
||||
}
|
||||
else {
|
||||
callback.run();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
this.lifecycleLock.unlock();
|
||||
|
||||
Reference in New Issue
Block a user