}
public void sendNotification() {
ConfigContext context = _adminContext.getAdminConfigContext();
String instanceName = _adminContext.getServerName();
AdminEventCache cache =
AdminEventCache.getInstance(instanceName);
cache.setAdminConfigContext(context);
ArrayList changeList = context.getConfigChangeList();
context.resetConfigChangeList();
ArrayList eventList = null;
if (changeList.size() <= 0) {
eventList = new ArrayList();
// Return, no changes to process
//return;
}
else
{
cache.processConfigChangeList(changeList, false, false);
eventList = cache.getAndResetCachedEvents();
//***********************************
//ElementChange events
try {
ElementChangeHelper elementHelper = new ElementChangeHelper(); //FIXME: need to put it as member
AdminEvent[] elementChangeEvents = elementHelper.generateElementChangeEventsFromChangeList(instanceName, changeList, context);
if(elementChangeEvents!=null)
for(int i=0; i<elementChangeEvents.length; i++)
eventList.add(elementChangeEvents[i]);
} catch (Exception e) {
// ignore
}
//***********************************
}
EventStack stack = EventContext.getEventStackFromThreadLocal();
List newEventList = stack.getEvents();
newEventList.addAll(eventList);
boolean requiresRestart = false;
Iterator iter = newEventList.iterator();
while (iter.hasNext()) {
AdminEvent event = (AdminEvent)iter.next();
if (_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, "mbean.event_sent",
event.getEventInfo());
} else {
_logger.log(Level.INFO, "mbean.send_event", event.toString());
}
AdminEventResult result=AdminEventMulticaster.multicastEvent(event);
_logger.log(Level.FINE, "mbean.event_res", result.getResultCode());
_logger.log(Level.FINEST, "mbean.event_reply",
result.getAllMessagesAsString());
if (!AdminEventResult.SUCCESS.equals(result.getResultCode())) {
requiresRestart = true;
cache.setRestartNeeded(true);
// if there was an error in the listener, admin event
// multicaster already sets the restart required to true
//_logger.log(Level.INFO, "mbean.notif_failed");
}