Skip to content

Provide a way to determine if a context is in the process of being closed #33058

Closed
@wilkinsona

Description

@wilkinsona

In order to tackle spring-projects/spring-boot#41002, we think we need a way to determine if the application context is in the process of being closed. We cannot use isActive() as active isn't set to false until close processing has completed. The closed flag in AbstractApplicationContext looks like it contains the state that we want to be able to see, but there's no accessor for it.

It looks like we might be able to listen for a ContextClosedEvent and store some state to note that a particular context is in the process of being closed. We'd prefer not to use this approach for a couple of reasons:

  • it gives us more state to manage, duplicating something that the application context already knows
  • there's no obvious way for us to clean up that state as there's no call back for when close processing is complete

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions