Search in sources :

Example 1 with WikiEngineEvent

use of org.apache.wiki.event.WikiEngineEvent in project jspwiki by apache.

the class DefaultAdminBeanManager method actionPerformed.

/* (non-Javadoc)
	 * @see org.apache.wiki.ui.admin.AdminBeanManager#actionPerformed(org.apache.wiki.event.WikiEvent)
	 */
@Override
public void actionPerformed(WikiEvent event) {
    if (event instanceof WikiEngineEvent) {
        if (((WikiEngineEvent) event).getType() == WikiEngineEvent.SHUTDOWN) {
            for (Iterator<AdminBean> i = m_allBeans.iterator(); i.hasNext(); ) {
                try {
                    AdminBean ab = i.next();
                    ObjectName on = getObjectName(ab);
                    if (m_mbeanServer.isRegistered(on)) {
                        m_mbeanServer.unregisterMBean(on);
                        log.info("Unregistered AdminBean " + ab.getTitle());
                    }
                } catch (MalformedObjectNameException e) {
                    log.error("Malformed object name when unregistering", e);
                } catch (InstanceNotFoundException e) {
                    log.error("Object was registered; yet claims that it's not there", e);
                } catch (MBeanRegistrationException e) {
                    log.error("Registration exception while unregistering", e);
                }
            }
        }
    }
}
Also used : WikiEngineEvent(org.apache.wiki.event.WikiEngineEvent) MalformedObjectNameException(javax.management.MalformedObjectNameException) InstanceNotFoundException(javax.management.InstanceNotFoundException) MBeanRegistrationException(javax.management.MBeanRegistrationException) ObjectName(javax.management.ObjectName)

Aggregations

InstanceNotFoundException (javax.management.InstanceNotFoundException)1 MBeanRegistrationException (javax.management.MBeanRegistrationException)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 ObjectName (javax.management.ObjectName)1 WikiEngineEvent (org.apache.wiki.event.WikiEngineEvent)1