Expose isClosed() method on AbstractApplicationContext
Closes gh-33058
This commit is contained in:
@@ -242,6 +242,18 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
|
|||||||
@Override
|
@Override
|
||||||
void close();
|
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,
|
* Determine whether this application context is active, that is,
|
||||||
* whether it has been refreshed at least once and has not been closed yet.
|
* 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.
|
// For subclasses: do nothing by default.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isClosed() {
|
||||||
|
return this.closed.get();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return this.active.get();
|
return this.active.get();
|
||||||
|
|||||||
Reference in New Issue
Block a user