Package com.sun.enterprise.admin.event

Examples of com.sun.enterprise.admin.event.AdminEventCache$RefProcessor


    }

    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");
            }

View Full Code Here


         if(FORCE_APPLY_METHOD_NAME.equals(operationName)) {
             // Manual changes to config will be overwritten, so persist the
             // state restart is required.
             String instanceName =
                     ObjectNameHelper.getServerInstanceName(objectName);
             AdminEventCache cache = AdminEventCache.getInstance(instanceName);
             cache.setRestartNeeded(true);
            //operationName = APPLY_METHOD_NAME;
         }
        registerWithPersistenceCheck(objectName);
        //logMBeanInfo(objectName);
        Object actualResult = proxyMBeanServer.invoke(objectName, operationName,
View Full Code Here

            return;
        }
        AdminEventResult multicastResult = AdminEventMulticaster.multicastEvent(
            event);
        if (!AdminEventResult.SUCCESS.equals(multicastResult.getResultCode())) {
                AdminEventCache cache = AdminEventCache.getInstance(instanceName);
                    cache.setRestartNeeded(true);
        }
    }
View Full Code Here

     * reconfiguration on the instance could not be dones and the user has
     * not restarted the instance since then.
     */
    public boolean isRestartNeeded()
    {
        AdminEventCache cache = AdminEventCache.getInstance(mInstanceName);
        boolean restartRequired = cache.isInstanceRestartNeeded();
        if(restartRequired)
        {
            RMIClient rc = AdminChannel.getRMIClient(mInstanceName);
            if(!rc.isAlive())
                restartRequired = false;
View Full Code Here

            reloadAfterChange(ie);
            boolean requiresRestart = ie.restartRequired();
            if (requiresRestart) {
                // The instance was not started after manual config changes, so
                // persist the restart required state.
                AdminEventCache cache =
                        AdminEventCache.getInstance(mInstanceName);
                cache.setRestartNeeded(true);
            }
            return true;
        }
        return b;
    }
View Full Code Here

            /* New for 8.0 - temporary */
            requiresRestart = instanceEnv.restartRequired();
            if (requiresRestart) {
                // The instance was not started after manual config changes, so
                // persist the restart required state.
                AdminEventCache cache =
                        AdminEventCache.getInstance(mInstanceName);
                cache.setRestartNeeded(true);
            }
        }
        catch (ConfigException e)
        {
            throw new ServerInstanceException(e.getMessage());
View Full Code Here

                multicastResult.getResultCode());
        sLogger.log(Level.INFO, "mbean.event_reply",
                multicastResult.getAllMessagesAsString());
        boolean eventSuccess = true;
        if (!AdminEventResult.SUCCESS.equals(multicastResult.getResultCode())) {
            AdminEventCache cache =
                    AdminEventCache.getInstance(mInstanceName);
            cache.setRestartNeeded(true);

            // if there is an exception thrown when loading modules
            // rethrow the exception
            AdminEventListenerException ale = null;
            ale = multicastResult.getFirstAdminEventListenerException();
View Full Code Here

     *     notifications, the method returns true.
     */
    private boolean sendNotificationOnApply(boolean confFilesChanged,
            boolean mimeFilesChanged) throws ConfigException {
        ConfigContext context = getConfigContext(mInstanceName);
        AdminEventCache cache =
                AdminEventCache.getInstance(mInstanceName);
        ArrayList changeList = context.getConfigChangeList();
        context.resetConfigChangeList();
        cache.processConfigChangeList(changeList, confFilesChanged,
                mimeFilesChanged);
        ArrayList eventList = cache.getAndResetCachedEvents();
        if (getInstanceStatusCode() != Status.kInstanceRunningCode) {
            sLogger.log(Level.INFO, "mbean.inst_down_skip_event", mInstanceName);
            return false;
        }
        boolean requiresRestart = cache.isInstanceRestartNeeded();
        Iterator iter = eventList.iterator();
        while (iter.hasNext()) {
            AdminEvent event = (AdminEvent)iter.next();
            if (sLogger.isLoggable(Level.FINEST)) {
                sLogger.log(Level.FINEST, "mbean.event_sent",
                        event.getEventInfo());
            } else {
                sLogger.log(Level.INFO, "mbean.send_event", event.toString());
            }
            AdminEventResult result = AdminEventMulticaster.multicastEvent(event);
            sLogger.log(Level.FINE, "mbean.event_res", result.getResultCode());
            sLogger.log(Level.FINEST, "mbean.event_reply",
                    result.getAllMessagesAsString());
            if (!AdminEventResult.SUCCESS.equals(result.getResultCode()))
            {
                requiresRestart = true;
                cache.setRestartNeeded(true);
                // DEBUGing - Mahesh
                sLogger.log(Level.INFO, "applyChanges: AdminEventMulticaster.multiCastEvent indicates serverRestart=true , resultCode=" + result.getResultCode(), event.toString());
                sLogger.log(Level.WARNING, "mbean.notif_failed");
            }
        }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.admin.event.AdminEventCache$RefProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.