Package org.rioproject.monitor

Examples of org.rioproject.monitor.ProvisionMonitorEvent


        if(event instanceof ProvisionFailureEvent) {
            ProvisionFailureEvent pfe = (ProvisionFailureEvent)event;
            remoteServiceEventNode = new ProvisionFailureEventNode(pfe);
        }
        if(event instanceof ProvisionMonitorEvent) {
            ProvisionMonitorEvent pme = (ProvisionMonitorEvent)event;
            remoteServiceEventNode = new ProvisionMonitorEventNode(pme);
        }
        if(event instanceof ServiceLogEvent) {
            ServiceLogEvent sle = (ServiceLogEvent)event;
            remoteServiceEventNode = new ServiceLogEventNode(sle);
View Full Code Here


            instance = cleanService(service, serviceUuid, true);
        } else {
            instance = getServiceBeanInstance(serviceUuid);
        }
        /* Notify that a service has been terminated */
        ProvisionMonitorEvent event = new ProvisionMonitorEvent(eventSource,
                                                                ProvisionMonitorEvent.Action.SERVICE_TERMINATED,
                                                                svcElement.getOperationalStringName(),
                                                                svcElement,
                                                                instance);
        processEvent(event);
View Full Code Here

            } catch(Throwable t) {
                mgrLogger.warn("Service provision notification for [{}]", LoggingUtil.getLoggingName(svcElement), t);
            }
            /* Notify that a service has been provisioned */
            ProvisionMonitorEvent event = new ProvisionMonitorEvent(eventSource,
                                                                    ProvisionMonitorEvent.Action.SERVICE_PROVISIONED,
                                                                    svcElement.getOperationalStringName(),
                                                                    svcElement,
                                                                    instance);
            processEvent(event);
View Full Code Here

                        if(alreadyDiscovered(item.service))
                            return;
                        addServiceProxy(item.service);
                        setFaultDetectionHandler(item.service, item.serviceID);
                        /* Notify that the external service has been discovered */
                        ProvisionMonitorEvent event =
                            new ProvisionMonitorEvent(eventSource,
                                                      ProvisionMonitorEvent.Action.EXTERNAL_SERVICE_DISCOVERED,
                                                      svcElement.getOperationalStringName(),
                                                      svcElement,
                                                      sbi);
                        processEvent(event);
View Full Code Here

                ProvisionRequest provRequest = getRedeploymentProvisionRequest(proxy);
                boolean asResultOfRedeployment = (provRequest!=null);

                /* Notify a service has failed */
                if(!asResultOfRedeployment) {
                    ProvisionMonitorEvent event = new ProvisionMonitorEvent(eventSource,
                                                                            ProvisionMonitorEvent.Action.SERVICE_FAILED,
                                                                            svcElement.getOperationalStringName(),
                                                                            svcElement,
                                                                            instance);
                    processEvent(event);
View Full Code Here

            throw new UnknownEventException("Not a ProvisionMonitorEvent "+
                                            "["+
                                            theEvent.getClass().getName()+
                                            "]");
        }
        ProvisionMonitorEvent event = (ProvisionMonitorEvent)theEvent;
        String type = getNotificationType(event);
        Notification notification = new Notification(
            type,
            objectName,
            event.getSequenceNumber(),
            getMessage(event)
            //event.toString()
        );
        notificationBroadcasterSupport.sendNotification(notification);
    }
View Full Code Here

         */
        if(opMgrList != null) {
            peerLogger.trace("Number of OpStringManager instances that are back ups : {}", opMgrList.size());
            for (OpStringManager opMgr : opMgrList) {
                opMgr.setActive(true);
                ProvisionMonitorEvent event = new ProvisionMonitorEvent(getServiceProxy(),
                                                                        ProvisionMonitorEvent.Action.OPSTRING_MGR_CHANGED,
                                                                        opMgr.doGetOperationalString());
                eventProcessor.processEvent(event);
                peerLogger.debug("Set active for opstring : {}", opMgr.getName());
            }
View Full Code Here

                return;
            }
            ProvisionMonitor remoteMonitor = (ProvisionMonitor)eventSource;
            String opStringName = null;
            OpStringManager opMgr;
            ProvisionMonitorEvent pme = (ProvisionMonitorEvent)event;
            OperationalString opString = pme.getOperationalString();
            ServiceElement sElem = pme.getServiceElement();
            ProvisionMonitorEvent.Action action = pme.getAction();
            switch(action) {
                case SERVICE_ELEMENT_UPDATED:
                case SERVICE_BEAN_INCREMENTED:
                case SERVICE_BEAN_DECREMENTED:
                    String sAction = action.toString();
                    if(sElem == null) {
                        peerLogger.debug("ProvisionMonitorPeer: {} sElem is null", sAction);
                        return;
                    }
                    opStringName = sElem.getOperationalStringName();
                    peerLogger.trace("ProvisionMonitorPeer: {}, opstring: {}", sAction, opStringName);
                    opMgr = opStringMangerController.getOpStringManager(opStringName);
                    if(opMgr == null) {
                        peerLogger.debug("ProvisionMonitorPeer: {} opstring [{}] not found", sAction, opStringName);
                        return;
                    }
                    try {
                        opMgr.doUpdateServiceElement(sElem);
                    } catch(Exception e) {
                        peerLogger.warn("Updating OperationalStringManager's ServiceElement", e);
                    }
                    break;
                case SERVICE_ELEMENT_ADDED:
                    if(sElem == null) {
                        peerLogger.warn("ProvisionMonitorPeer: SERVICE_ELEMENT_ADDED sElem is null");
                        return;
                    }
                    opStringName = sElem.getOperationalStringName();
                    peerLogger.trace("ProvisionMonitorPeer: SERVICE_ELEMENT_ADDED, opstring: {}", opStringName);
                    opMgr = opStringMangerController.getOpStringManager(opStringName);
                    if(opMgr == null) {
                        peerLogger.debug("ProvisionMonitorPeer: SERVICE_ELEMENT_ADDED opstring [{}] not found" ,opStringName);
                        return;
                    }
                    try {
                        opMgr.doAddServiceElement(sElem, null);
                    } catch(Exception e) {
                        peerLogger.warn("Adding ServiceElement to OperationalStringManager", e);
                    }
                    break;
                case SERVICE_ELEMENT_REMOVED:
                    if(sElem == null) {
                        peerLogger.debug("ProvisionMonitorPeer: SERVICE_ELEMENT_REMOVED sElem is null");
                        return;
                    }
                    opStringName = sElem.getOperationalStringName();
                    peerLogger.trace("ProvisionMonitorPeer: SERVICE_ELEMENT_REMOVED, opstring: {}", opStringName);
                    opMgr = opStringMangerController.getOpStringManager(opStringName);
                    if(opMgr == null) {
                        peerLogger.debug("ProvisionMonitorPeer: SERVICE_ELEMENT_REMOVED opstring [{}] not found",
                                         opStringName);
                        return;
                    }
                    try {
                        opMgr.doRemoveServiceElement(sElem, false);
                    } catch(Exception e) {
                        peerLogger.warn("Removing ServiceElement from OperationalStringManager", e);
                    }
                    break;
                case OPSTRING_DEPLOYED:
                    if(opString == null) {
                        peerLogger.warn("ProvisionMonitorPeer: OPSTRING_DEPLOYED opstring is null");
                        return;
                    }
                    DeployAdmin deployAdmin = (DeployAdmin)remoteMonitor.getAdmin();
                    opStringProcessor(opString, remoteMonitor, deployAdmin, pme.getRemoteRepositories());
                    peerLogger.trace("ProvisionMonitorPeer: OPSTRING_DEPLOYED, opstring: {}", opString.getName());
                    break;
                case OPSTRING_UNDEPLOYED:
                    if(opString == null) {
                        peerLogger.debug("ProvisionMonitorPeer: OPSTRING_UNDEPLOYED opstring is null");
                        return;
                    }
                    peerLogger.trace("ProvisionMonitorPeer: OPSTRING_UNDEPLOYED, opstring: {}", opString.getName());
                    opMgr = opStringMangerController.getOpStringManager(opString.getName());
                    if(opMgr == null) {
                        peerLogger.debug("ProvisionMonitorPeer: OPSTRING_UNDEPLOYED for opstring [{}] not found",
                                         opString.getName());
                        return;
                    }

                    opMgr.setDeploymentStatus(OperationalString.UNDEPLOYED);
                    opMgr.terminate(false);
                    synchronized(opStringTable) {
                        if(opStringTable.containsKey(remoteMonitor)) {
                            List<OpStringManager> list = opStringTable.get(remoteMonitor);
                            list.remove(opMgr);
                            opStringTable.put(remoteMonitor, list);
                        }
                    }
                    break;

                case OPSTRING_MGR_CHANGED:
                    if(opString == null) {
                        peerLogger.debug("ProvisionMonitorPeer: OPSTRING_MGR_CHANGED opstring is null");
                        return;
                    }
                    peerLogger.debug("ProvisionMonitorPeer: OPSTRING_MGR_CHANGED, opstring: {}", opString.getName());
                    opMgr = opStringMangerController.getOpStringManager(opString.getName());
                    if(opMgr == null) {
                        peerLogger.debug("ProvisionMonitorPeer: OPSTRING_MGR_CHANGED opstring [{}] not found",
                                         opString.getName());
                        return;
                    }
                    synchronized(opStringTable) {
                        List<OpStringManager> list;
                        if(opStringTable.containsKey(remoteMonitor))
                            list = opStringTable.get(remoteMonitor);
                        else
                            list = new ArrayList<OpStringManager>();
                        if(!list.contains(opMgr)) {
                            list.add(opMgr);
                            opStringTable.put(remoteMonitor, list);
                            peerLogger.debug("ProvisionMonitorPeer: Reset backup peer for [{}] to {}",
                                             opString.getName(), remoteMonitor.toString());
                        } else {
                            peerLogger.debug("ProvisionMonitorPeer: Already a backup for [{}] to {}",
                                             opString.getName(), remoteMonitor.toString());
                        }
                    }
                    break;
                case OPSTRING_UPDATED:
                    if(opString == null) {
                        peerLogger.debug("ProvisionMonitorPeer: OPSTRING_UNDEPLOYED opstring is null");
                        return;
                    }
                    peerLogger.trace("ProvisionMonitorPeer: OPSTRING_UPDATED, opstring: {}", opString.getName());
                    opMgr = opStringMangerController.getOpStringManager(opString.getName());
                    if(opMgr == null) {
                        peerLogger.debug("ProvisionMonitorPeer: OPSTRING_UPDATED for opstring [{}] not found",
                                         opString.getName());
                        return;
                    }
                    opMgr.doUpdateOperationalString(opString);
                    break;

                case SERVICE_BEAN_INSTANCE_UPDATED:
                    ServiceBeanInstance instance = pme.getServiceBeanInstance();
                    if(instance == null) {
                        peerLogger.debug("ProvisionMonitorPeer: SERVICE_BEAN_INSTANCE_UPDATED instance is null");
                        return;
                    }
                    opStringName = pme.getOperationalStringName();
                    peerLogger.trace("ProvisionMonitorPeer: SERVICE_BEAN_INSTANCE_UPDATED, opstring: {}", opStringName);
                    opMgr = opStringMangerController.getOpStringManager(opStringName);
                    if(opMgr == null) {
                        peerLogger.debug("ProvisionMonitorPeer: SERVICE_BEAN_INSTANCE_UPDATED for opstring [{}] not found",
                                         opStringName);
                        return;
                    }
                    try {
                        opMgr.doUpdateServiceBeanInstance(instance);
                    } catch(Exception e) {
                        peerLogger.warn("Updating OperationalStringManager's ServiceBeanInstance", e);
                    }
                    break;

                case SERVICE_PROVISIONED:
                    instance = pme.getServiceBeanInstance();
                    if(instance == null) {
                        peerLogger.debug("ProvisionMonitorPeer: SERVICE_PROVISIONED instance is null");
                        return;
                    }
                    opStringName = pme.getOperationalStringName();
                    peerLogger.trace("ProvisionMonitorPeer: SERVICE_PROVISIONED, opstring: {}", opStringName);
                    opMgr = opStringMangerController.getOpStringManager(opStringName);
                    if(opMgr == null) {
                        peerLogger.debug("ProvisionMonitorPeer: SERVICE_PROVISIONED for opstring [{}] " +
                                         "OpStringManager not found", opStringName);
                        return;
                    }
                    ServiceElementManager mgr = opMgr.getServiceElementManager(sElem);
                    if(mgr==null) {
                        peerLogger.debug("ProvisionMonitorPeer: SERVICE_PROVISIONED for " +
                                         "opstring [{}] ServiceElementManager not found", opStringName);
                        return;
                    }
                    boolean isStarted = mgr.isStarted();
                    while(!isStarted) {
                        try {
                            Thread.sleep(1000);
                            isStarted = mgr.isStarted();
                        } catch(InterruptedException ignore) {
                            /* Ignore */
                        }
                    }
                    mgr.importServiceBeanInstance(instance);

                    ServiceChannel channel = ServiceChannel.getInstance();
                    channel.broadcast(new ServiceChannelEvent(this, sElem, ServiceChannelEvent.Type.PROVISIONED));
                    break;

                case REDEPLOY_REQUEST:
                    opMgr = opStringMangerController.getOpStringManager(pme.getOperationalStringName());
                    if(opMgr == null) {
                        peerLogger.debug("ProvisionMonitorPeer: REDEPLOY_REQUEST opstring [{}] not found", opStringName);
                        return;
                    }
                    Object[] parms = pme.getRedeploymentParms();
                    Date redeployDate = (Date)parms[0];
                    boolean clean = (Boolean) parms[1];
                    boolean sticky = (Boolean) parms[2];
                    ServiceProvisionListener listener =
                        (ServiceProvisionListener)parms[3];

                    long delay = redeployDate.getTime() - System.currentTimeMillis();
                    if(delay <= 0) {
                        peerLogger.debug("ProvisionMonitorPeer: REDEPLOY_REQUEST for opstring " +
                                         "[{}] startTime has already passed, scheduled " +
                                         "redeployment cancelled", opStringName);
                    } else  {
                        opMgr.doScheduleRedeploymentTask(delay,
                                                         pme.getServiceElement(),
                                                         pme.getServiceBeanInstance(),
                                                         clean,
                                                         sticky,
                                                         listener);
                    }
                    break;
View Full Code Here

        OperationalString opString = opStringManager.doGetOperationalString();
        logger.trace("Terminating Operational String [{}]", opString.getName());
        OperationalString[] terminated = opStringManager.terminate(terminate);
        logger.info("Undeployed Operational String [{}]", opString.getName());
        for(OperationalString os : terminated) {
            eventProcessor.processEvent(new ProvisionMonitorEvent(serviceProxy,
                                                                  ProvisionMonitorEvent.Action.OPSTRING_UNDEPLOYED,
                                                                  os));
        }
        if(stateManager!=null)
            stateManager.stateChanged(opStringManager, true);
View Full Code Here

            synchronized(pendingManagers) {
                pendingManagers.remove(opMgr);
            }
        }
        if(opMgr!=null && active) {
            ProvisionMonitorEvent event = new ProvisionMonitorEvent(serviceProxy,
                                                                    ProvisionMonitorEvent.Action.OPSTRING_DEPLOYED,
                                                                    opMgr.doGetOperationalString());
            if(opMgr.getOAR()!=null)
                event.setRemoteRepositories(opMgr.getRemoteRepositories());
            eventProcessor.processEvent(event);
        }
        if(logger.isTraceEnabled())
            logger.trace("Return from add OperationalString [{}]", opString.getName());
        return opMgr;
View Full Code Here

TOP

Related Classes of org.rioproject.monitor.ProvisionMonitorEvent

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.