Author: remy.maucherat(a)jboss.com
Date: 2009-10-16 06:01:59 -0400 (Fri, 16 Oct 2009)
New Revision: 1197
Modified:
trunk/java/org/apache/catalina/Context.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
Log:
- Add a dedicated "starting" flag, initialized is not the right thing (available
was close, but not exactly it either).
Modified: trunk/java/org/apache/catalina/Context.java
===================================================================
--- trunk/java/org/apache/catalina/Context.java 2009-10-16 00:31:51 UTC (rev 1196)
+++ trunk/java/org/apache/catalina/Context.java 2009-10-16 10:01:59 UTC (rev 1197)
@@ -173,6 +173,20 @@
/**
+ * Return the application starting flag for this Context.
+ */
+ public boolean isStarting();
+
+
+ /**
+ * Set the application starting flag for this Context.
+ *
+ * @param starting The new application starting flag
+ */
+ public void setStarting(boolean starting);
+
+
+ /**
* Return the Locale to character set mapper for this Context.
*/
public CharsetMapper getCharsetMapper();
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-10-16 00:31:51 UTC
(rev 1196)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-10-16 10:01:59 UTC
(rev 1197)
@@ -866,7 +866,7 @@
if (restricted) {
throw new
UnsupportedOperationException(sm.getString("applicationContext.restricted"));
}
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
}
@@ -884,7 +884,7 @@
if (restricted) {
throw new
UnsupportedOperationException(sm.getString("applicationContext.restricted"));
}
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
}
@@ -913,7 +913,7 @@
if (restricted) {
throw new
UnsupportedOperationException(sm.getString("applicationContext.restricted"));
}
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
}
@@ -940,7 +940,7 @@
if (restricted) {
throw new
UnsupportedOperationException(sm.getString("applicationContext.restricted"));
}
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
}
@@ -1090,7 +1090,7 @@
if (restricted) {
throw new
UnsupportedOperationException(sm.getString("applicationContext.restricted"));
}
- if (context.getAvailable()) {
+ if (!context.isStarting()) {
throw new IllegalStateException(
sm.getString("applicationContext.setSessionTracking.ise",
getContextPath()));
@@ -1112,7 +1112,7 @@
if (restricted) {
throw new
UnsupportedOperationException(sm.getString("applicationContext.restricted"));
}
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
}
@@ -1124,7 +1124,7 @@
if (restricted) {
throw new
UnsupportedOperationException(sm.getString("applicationContext.restricted"));
}
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
}
@@ -1136,7 +1136,7 @@
if (restricted) {
throw new
UnsupportedOperationException(sm.getString("applicationContext.restricted"));
}
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
}
@@ -1156,7 +1156,7 @@
if (restricted) {
throw new
UnsupportedOperationException(sm.getString("applicationContext.restricted"));
}
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
}
@@ -1220,7 +1220,7 @@
if (restricted) {
throw new
UnsupportedOperationException(sm.getString("applicationContext.restricted"));
}
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
}
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-10-16 00:31:51
UTC (rev 1196)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-10-16 10:01:59
UTC (rev 1197)
@@ -265,7 +265,7 @@
public boolean addMappingForServletNames(EnumSet<DispatcherType>
dispatcherTypes,
boolean isMatchAfter, String... servletNames) {
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("filterRegistration.ise",
context.getPath()));
}
if (servletNames == null || servletNames.length == 0) {
@@ -293,7 +293,7 @@
public boolean addMappingForUrlPatterns(
EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
String... urlPatterns) {
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("filterRegistration.ise",
context.getPath()));
}
if (urlPatterns == null || urlPatterns.length == 0) {
@@ -357,7 +357,7 @@
public void setAsyncSupported(boolean asyncSupported) {
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("filterRegistration.ise",
context.getPath()));
}
filterDef.setAsyncSupported(asyncSupported);
@@ -372,7 +372,7 @@
public boolean setInitParameter(String name, String value) {
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("filterRegistration.ise",
context.getPath()));
}
if (name == null || value == null) {
@@ -388,7 +388,7 @@
public Set<String> setInitParameters(Map<String, String> initParameters)
{
- if (context.isInitialized()) {
+ if (!context.isStarting()) {
throw new
IllegalStateException(sm.getString("filterRegistration.ise",
context.getPath()));
}
if (initParameters == null) {
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-10-16 00:31:51 UTC (rev
1196)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-10-16 10:01:59 UTC (rev
1197)
@@ -269,6 +269,11 @@
protected boolean available = false;
/**
+ * The application starting flag for this Context.
+ */
+ protected boolean starting = false;
+
+ /**
* The broadcaster that sends j2ee notifications.
*/
protected NotificationBroadcasterSupport broadcaster = null;
@@ -1084,6 +1089,24 @@
/**
+ * Return the application starting flag for this Context.
+ */
+ public boolean isStarting() {
+ return (this.starting);
+ }
+
+
+ /**
+ * Set the application starting flag for this Context.
+ *
+ * @param starting The new application starting flag
+ */
+ public void setStarting(boolean starting) {
+ this.starting = starting;
+ }
+
+
+ /**
* Return the Locale to character set mapper for this Context.
*/
public CharsetMapper getCharsetMapper() {
@@ -4130,6 +4153,7 @@
lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, null);
setAvailable(false);
+ setStarting(true);
setConfigured(false);
boolean ok = true;
@@ -4407,6 +4431,7 @@
}
setAvailable(false);
}
+ setStarting(false);
// JMX registration
registerJMX();
Modified: trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-10-16 00:31:51 UTC
(rev 1196)
+++ trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-10-16 10:01:59 UTC
(rev 1197)
@@ -154,7 +154,7 @@
public Set<String> addMapping(String... urlPatterns) {
Set<String> conflicts = new HashSet<String>();
- if (((Context) wrapper.getParent()).isInitialized()) {
+ if (!((Context) wrapper.getParent()).isStarting()) {
throw new IllegalStateException(sm.getString
("servletRegistration.ise", ((Context)
wrapper.getParent()).getPath()));
}
@@ -173,7 +173,7 @@
public void setAsyncSupported(boolean asyncSupported) {
- if (((Context) wrapper.getParent()).isInitialized()) {
+ if (!((Context) wrapper.getParent()).isStarting()) {
throw new IllegalStateException(sm.getString
("servletRegistration.ise", ((Context)
wrapper.getParent()).getPath()));
}
@@ -187,7 +187,7 @@
public boolean setInitParameter(String name, String value) {
- if (((Context) wrapper.getParent()).isInitialized()) {
+ if (!((Context) wrapper.getParent()).isStarting()) {
throw new IllegalStateException(sm.getString
("servletRegistration.ise", ((Context)
wrapper.getParent()).getPath()));
}
@@ -204,7 +204,7 @@
public Set<String> setInitParameters(Map<String, String> initParameters)
{
- if (((Context) wrapper.getParent()).isInitialized()) {
+ if (!((Context) wrapper.getParent()).isStarting()) {
throw new IllegalStateException(sm.getString
("servletRegistration.ise", ((Context)
wrapper.getParent()).getPath()));
}
@@ -230,7 +230,7 @@
public void setLoadOnStartup(int loadOnStartup) {
- if (((Context) wrapper.getParent()).isInitialized()) {
+ if (!((Context) wrapper.getParent()).isStarting()) {
throw new IllegalStateException(sm.getString
("servletRegistration.ise", ((Context)
wrapper.getParent()).getPath()));
}
@@ -273,7 +273,7 @@
}
public void setRunAsRole(String roleName) {
- if (((Context) wrapper.getParent()).isInitialized()) {
+ if (!((Context) wrapper.getParent()).isStarting()) {
throw new IllegalStateException(sm.getString
("servletRegistration.ise", ((Context)
wrapper.getParent()).getPath()));
}
@@ -284,7 +284,7 @@
}
public void setServletSecurity(ServletSecurityElement servletSecurity) {
- if (((Context) wrapper.getParent()).isInitialized()) {
+ if (!((Context) wrapper.getParent()).isStarting()) {
throw new IllegalStateException(sm.getString
("servletRegistration.ise", ((Context)
wrapper.getParent()).getPath()));
}
@@ -295,7 +295,7 @@
}
public void setMultipartConfig(MultipartConfigElement multipartConfig) {
- if (((Context) wrapper.getParent()).isInitialized()) {
+ if (!((Context) wrapper.getParent()).isStarting()) {
throw new IllegalStateException(sm.getString
("servletRegistration.ise", ((Context)
wrapper.getParent()).getPath()));
}