This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push: new 911126b Send failed JMX notification 911126b is described below commit 911126bab987ebf89b0c05d4aedd4bfe91af3069 Author: remm <r...@apache.org> AuthorDate: Mon May 18 10:33:29 2020 +0200 Send failed JMX notification Code cleanup. Remove i18n todo, I doubt it is a good idea at all for JMX, the descriptions are read by a client which may not like the server language (the manager webapp uses the client language, for example). --- java/org/apache/catalina/core/StandardContext.java | 94 ++++++++++------------ java/org/apache/catalina/core/StandardWrapper.java | 61 ++++++-------- 2 files changed, 68 insertions(+), 87 deletions(-) diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 8d49891..e84f2b5 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -2847,7 +2847,6 @@ public class StandardContext extends ContainerBase } fireContainerEvent("addApplicationListener", listener); - // FIXME - add instance if already started? } @@ -3061,12 +3060,6 @@ public class StandardContext extends ContainerBase (servletNames.length == 0) && (urlPatterns.length == 0)) throw new IllegalArgumentException (sm.getString("standardContext.filterMap.either")); - // FIXME: Older spec revisions may still check this - /* - if ((servletNames.length != 0) && (urlPatterns.length != 0)) - throw new IllegalArgumentException - (sm.getString("standardContext.filterMap.either")); - */ for (String urlPattern : urlPatterns) { if (!validateURLPattern(urlPattern)) { throw new IllegalArgumentException @@ -3772,7 +3765,6 @@ public class StandardContext extends ContainerBase // Inform interested listeners fireContainerEvent("removeApplicationListener", listener); - // FIXME - behavior if already started? } @@ -5167,6 +5159,12 @@ public class StandardContext extends ContainerBase // Reinitializing if something went wrong if (!ok) { setState(LifecycleState.FAILED); + // Send j2ee.object.failed notification + if (this.getObjectName() != null) { + Notification notification = new Notification("j2ee.object.failed", + this.getObjectName(), sequenceNumber.getAndIncrement()); + broadcaster.sendNotification(notification); + } } else { setState(LifecycleState.STARTING); } @@ -5421,7 +5419,8 @@ public class StandardContext extends ContainerBase } - /** Destroy needs to clean up the context completely. + /** + * Destroy needs to clean up the context completely. * * The problem is that undoing all the config in start() and restoring * a 'fresh' state is impossible. After stop()/destroy()/init()/start() @@ -5429,9 +5428,6 @@ public class StandardContext extends ContainerBase * read modified web.xml, etc. This can only be done by completely * removing the context object and remapping a new one, or by cleaning * up everything. - * - * XXX Should this be done in stop() ? - * */ @Override protected void destroyInternal() throws LifecycleException { @@ -6152,7 +6148,8 @@ public class StandardContext extends ContainerBase } - /* Remove a JMX notificationListener + /** + * Remove a JMX notificationListener * @see javax.management.NotificationEmitter#removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) */ @Override @@ -6163,48 +6160,43 @@ public class StandardContext extends ContainerBase private MBeanNotificationInfo[] notificationInfo; - /* Get JMX Broadcaster Info - * @TODO use StringManager for international support! - * @TODO This two events we not send j2ee.state.failed and j2ee.attribute.changed! + /** + * Get JMX Broadcaster Info * @see javax.management.NotificationBroadcaster#getNotificationInfo() */ @Override public MBeanNotificationInfo[] getNotificationInfo() { - // FIXME: i18n - if(notificationInfo == null) { - notificationInfo = new MBeanNotificationInfo[]{ - new MBeanNotificationInfo(new String[] { - "j2ee.object.created"}, - Notification.class.getName(), - "web application is created" - ), - new MBeanNotificationInfo(new String[] { - "j2ee.state.starting"}, - Notification.class.getName(), - "change web application is starting" - ), - new MBeanNotificationInfo(new String[] { - "j2ee.state.running"}, - Notification.class.getName(), - "web application is running" - ), - new MBeanNotificationInfo(new String[] { - "j2ee.state.stopping"}, - Notification.class.getName(), - "web application start to stopped" - ), - new MBeanNotificationInfo(new String[] { - "j2ee.object.stopped"}, - Notification.class.getName(), - "web application is stopped" - ), - new MBeanNotificationInfo(new String[] { - "j2ee.object.deleted"}, - Notification.class.getName(), - "web application is deleted" - ) - }; - + // FIXME: we not send j2ee.attribute.changed + if (notificationInfo == null) { + notificationInfo = new MBeanNotificationInfo[] { + new MBeanNotificationInfo( + new String[] { "j2ee.object.created" }, + Notification.class.getName(), + "web application is created"), + new MBeanNotificationInfo( + new String[] { "j2ee.state.starting" }, + Notification.class.getName(), + "change web application is starting"), + new MBeanNotificationInfo( + new String[] { "j2ee.state.running" }, + Notification.class.getName(), + "web application is running"), + new MBeanNotificationInfo( + new String[] { "j2ee.state.stopping" }, + Notification.class.getName(), + "web application start to stopped"), + new MBeanNotificationInfo( + new String[] { "j2ee.object.stopped" }, + Notification.class.getName(), + "web application is stopped"), + new MBeanNotificationInfo( + new String[] { "j2ee.object.deleted" }, + Notification.class.getName(), + "web application is deleted"), + new MBeanNotificationInfo( + new String[] { "j2ee.object.failed" }, + Notification.class.getName(), + "web application failed") }; } return notificationInfo; diff --git a/java/org/apache/catalina/core/StandardWrapper.java b/java/org/apache/catalina/core/StandardWrapper.java index e1dc53c..234320b 100644 --- a/java/org/apache/catalina/core/StandardWrapper.java +++ b/java/org/apache/catalina/core/StandardWrapper.java @@ -1696,47 +1696,36 @@ public class StandardWrapper extends ContainerBase /** * Get JMX Broadcaster Info - * FIXME: This two events we not send j2ee.state.failed and j2ee.attribute.changed! * @see javax.management.NotificationBroadcaster#getNotificationInfo() */ @Override public MBeanNotificationInfo[] getNotificationInfo() { - - if(notificationInfo == null) { - notificationInfo = new MBeanNotificationInfo[]{ - new MBeanNotificationInfo(new String[] { - "j2ee.object.created"}, - Notification.class.getName(), - "servlet is created" - ), - new MBeanNotificationInfo(new String[] { - "j2ee.state.starting"}, - Notification.class.getName(), - "servlet is starting" - ), - new MBeanNotificationInfo(new String[] { - "j2ee.state.running"}, - Notification.class.getName(), - "servlet is running" - ), - new MBeanNotificationInfo(new String[] { - "j2ee.state.stopped"}, - Notification.class.getName(), - "servlet start to stopped" - ), - new MBeanNotificationInfo(new String[] { - "j2ee.object.stopped"}, - Notification.class.getName(), - "servlet is stopped" - ), - new MBeanNotificationInfo(new String[] { - "j2ee.object.deleted"}, - Notification.class.getName(), - "servlet is deleted" - ) - }; + // FIXME: we not send j2ee.state.failed + // FIXME: we not send j2ee.attribute.changed + if (notificationInfo == null) { + notificationInfo = new MBeanNotificationInfo[] { + new MBeanNotificationInfo( + new String[] { "j2ee.object.created" }, + Notification.class.getName(), "servlet is created"), + new MBeanNotificationInfo( + new String[] { "j2ee.state.starting" }, + Notification.class.getName(), + "servlet is starting"), + new MBeanNotificationInfo( + new String[] { "j2ee.state.running" }, + Notification.class.getName(), "servlet is running"), + new MBeanNotificationInfo( + new String[] { "j2ee.state.stopped" }, + Notification.class.getName(), + "servlet start to stopped"), + new MBeanNotificationInfo( + new String[] { "j2ee.object.stopped" }, + Notification.class.getName(), "servlet is stopped"), + new MBeanNotificationInfo( + new String[] { "j2ee.object.deleted" }, + Notification.class.getName(), + "servlet is deleted") }; } - return notificationInfo; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org