diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java index 6c35c04f..672748f2 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java @@ -44,7 +44,6 @@ import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.SmartLifecycle; -import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; @@ -60,12 +59,18 @@ import org.springframework.util.StringUtils; * is expected to contain a single application context. *
spring.cloud.task.closecontext.enable (defaults to true).
- * Also if the context did not start the FailedTask and TaskEnd may not have all the dependencies met.
+ * Note: By default, the context will close at the completion of the task unless other non-daemon
+ * threads keep it running. Programatic closing of the context can be configured via the
+ * property spring.cloud.task.closecontext.enable (defaults to false).
+ * If the spring.cloud.task.closecontext.enable is set to true,
+ * then the context will be closed upon task completion regardless if non-daemon threads are still running.
+ * Also if the context did not start, the FailedTask and TaskEnd may not have all the dependencies met.
*
* @author Michael Minella
* @author Glenn Renfro