Expose isClosed() method on AbstractApplicationContext
Closes gh-33058
This commit is contained in:
parent
5c68f3f4ef
commit
6561490fd9
|
|
@ -242,6 +242,18 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
|
|||
@Override
|
||||
void close();
|
||||
|
||||
/**
|
||||
* Return whether this context has been closed already, that is,
|
||||
* whether {@link #close()} has been called on an active context
|
||||
* in order to initiate its shutdown.
|
||||
* <p>Note: This does not indicate whether context shutdown has completed.
|
||||
* Use {@link #isActive()} for differentiating between those scenarios:
|
||||
* a context becomes inactive once it has been fully shut down and the
|
||||
* original {@code close()} call has returned.
|
||||
* @since 6.2
|
||||
*/
|
||||
boolean isClosed();
|
||||
|
||||
/**
|
||||
* Determine whether this application context is active, that is,
|
||||
* whether it has been refreshed at least once and has not been closed yet.
|
||||
|
|
|
|||
|
|
@ -1222,6 +1222,11 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
|||
// For subclasses: do nothing by default.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClosed() {
|
||||
return this.closed.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return this.active.get();
|
||||
|
|
|
|||
Loading…
Reference in New Issue