Package org.rioproject.monitor

Examples of org.rioproject.monitor.ProvisionMonitor


        remoteEventTable.setDiscoveryManagement(jiniClient.getDiscoveryManager());
    }

    void addProvisionMonitor(ServiceItem item) throws RemoteException, OperationalStringException {
        progressPanel.systemUp();
        ProvisionMonitor monitor = (ProvisionMonitor) item.service;
        ProvisionMonitorPanel pmp = addProvisionMonitorPanel(item);
        clientEventConsumer.register(item);

        //failureEventConsumer.register(item);
        DeployAdmin da = (DeployAdmin)monitor.getAdmin();
        OperationalStringManager[] opStringMgrs = da.getOperationalStringManagers();
        if (opStringMgrs == null || opStringMgrs.length == 0) {
            return;
        }
        for (OperationalStringManager opStringMgr : opStringMgrs) {
View Full Code Here


            getGraphView().setOpStringState(ops.getName());
        }
    }

    private ProvisionMonitorPanel addProvisionMonitorPanel(ServiceItem item) {
        ProvisionMonitor monitor = (ProvisionMonitor) item.service;
        ProvisionMonitorPanel pmp = new ProvisionMonitorPanel(monitor,
                                                              monitorCache,
                                                              frame,
                                                              colorManager,
                                                              toolBarImageMap,
View Full Code Here

                    } catch(Exception e) {
                        Util.showError(e, frame, "Cannot add Event Collector");
                    }
                }
                if(item.service instanceof ProvisionMonitor) {
                    ProvisionMonitor monitor = (ProvisionMonitor) item.service;
                    ProvisionMonitorPanel pmp = addProvisionMonitorPanel(item);

                    clientEventConsumer.register(item);

                    //failureEventConsumer.register(item);
                    DeployAdmin da = (DeployAdmin)monitor.getAdmin();
                    OperationalStringManager[] opStringMgrs = da.getOperationalStringManagers();
                    if (opStringMgrs.length == 0) {
                        return;
                    }
                    for (OperationalStringManager opStringMgr : opStringMgrs) {
View Full Code Here

    class ProvisionClientEventConsumer implements RemoteServiceEventListener<ProvisionMonitorEvent> {
        final List<ProvisionMonitorEvent> eventQ = new LinkedList<ProvisionMonitorEvent>();

        public void notify(ProvisionMonitorEvent pme) {
            ProvisionMonitorEvent.Action action = pme.getAction();
            ProvisionMonitor monitor = (ProvisionMonitor)pme.getSource();
            GraphView graphView = monitorPanelMap.get(monitor).getGraphView();
            switch (action) {
                case SERVICE_ELEMENT_UPDATED:
                case SERVICE_BEAN_INCREMENTED:
                    graphView.serviceIncrement(pme.getServiceElement());
View Full Code Here

            String resourceHostName =  computeResource.getAddress().getHostName();

            if(localBackup && !(resourceAddress.equals(peer.getAddress()) ||
                                resourceHostName.equals(peer.getAddress())) ) {

                ProvisionMonitor currentBackup = backup;
                if(doAssignment(peer)) {
                    try {
                        currentBackup.removeBackupFor(getServiceProxy());
                    } catch(Exception e) {
                        peerLogger.warn("Adjusting backup instance away from local instance", e);
                    }
                }
            }
View Full Code Here

    public void serviceFailure(final Object service, final ServiceID serviceID) {
        /* Clean up the event consumer, dont explictly cancel the lease since
         * the remote peer may be unreachable, this could block on the
         * remote method invocation on the lease itself */
        eventConsumer.deregister(serviceID, false);
        ProvisionMonitor primary = null;
        ProvisionMonitor provMon = (ProvisionMonitor)service;
        /*
         * Remove the ProvisionMonitor that left the network from the
         * peerSet
         */
        ProvisionMonitor.PeerInfo info = getPeerInfo(provMon);
View Full Code Here

            Object eventSource = event.getSource();
            if(!(eventSource instanceof ProvisionMonitor)) {
                peerLogger.debug("ProvisionMonitorPeer: unknown event source : {}", eventSource.getClass().getName());
                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) {
View Full Code Here

     */
    public DeployAdmin getPrimaryDeployAdmin(final String opStringName) {
        DeployAdmin primary = null;
        ProvisionMonitor.PeerInfo[] peers = provisionMonitorPeer.getBackupInfo();
        for (ProvisionMonitor.PeerInfo peer : peers) {
            ProvisionMonitor peerMon = peer.getService();
            try {
                DeployAdmin dAdmin = (DeployAdmin) peerMon.getAdmin();
                if(dAdmin.hasDeployed(opStringName)) {
                    OperationalStringManager mgr = dAdmin.getOperationalStringManager(opStringName);
                    if (mgr.isManaging()) {
                        primary = dAdmin;
                        break;
View Full Code Here

            b.append("ProvisionMonitor Peer verification\n");
            for (int i = 0; i < peers.length; i++) {
                if (i > 0)
                    b.append("\n");
                try {
                    ProvisionMonitor peer = peers[i].getService();
                    ProvisionMonitor.PeerInfo peerInfo = peer.getPeerInfo();
                    int state = peerInfo.getInitialDeploymentLoadState();
                    b.append("Peer at ");
                    b.append(peerInfo.getAddress());
                    b.append(", " + "state=");
                    b.append(getStateName(state));
View Full Code Here

        for (int i = 0; i < N - 1; i++) {
            try {

                // 5. STOP PROVISION MONTIOR
                logger.info("---> Stopping Provision Monitor [" + i + "] ...");
                ProvisionMonitor pm = pms.get(i);
                testManager.stopProvisionMonitor(pm);
                //pms.remove(pm);
                logger.info("Provision Monitor [" + i + "] has been stopped");

                // 6. STOP CYBERNODE RUNNING THE SERVICE
View Full Code Here

TOP

Related Classes of org.rioproject.monitor.ProvisionMonitor

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.