Package org.qzerver.model.domain.entities.cluster

Examples of org.qzerver.model.domain.entities.cluster.ClusterNode


        ClusterGroup clusterGroup = clusterManagementService.createGroup("Test group");
        Assert.assertNotNull(clusterGroup);
        Assert.assertEquals(0, clusterGroup.getRollingIndex());

        ClusterNode clusterNode1 = clusterManagementService.createNode(clusterGroup.getId(),
            "10.2.0.1", "Node 1", true);
        Assert.assertNotNull(clusterNode1);

        ClusterNode clusterNode2 = clusterManagementService.createNode(clusterGroup.getId(),
            "10.2.0.2", "Node 2", true);
        Assert.assertNotNull(clusterNode2);

        ClusterNode clusterNode3 = clusterManagementService.createNode(clusterGroup.getId(),
            "10.2.0.3", "Node 3", false);
        Assert.assertNotNull(clusterNode3);

        ClusterNode clusterNode4 = clusterManagementService.createNode(clusterGroup.getId(),
            "10.2.0.4", "Node 4", true);
        Assert.assertNotNull(clusterNode4);

        ClusterNode clusterNode5 = clusterManagementService.createNode(clusterGroup.getId(),
            "10.2.0.5", "Node 5", false);
        Assert.assertNotNull(clusterNode5);

        // Roll index
View Full Code Here


        ClusterGroup clusterGroup = clusterManagementService.createGroup("Test group");
        Assert.assertNotNull(clusterGroup);
        Assert.assertEquals(0, clusterGroup.getRollingIndex());

        ClusterNode clusterNode1 = clusterManagementService.createNode(clusterGroup.getId(),
            "10.2.0.1", "Node 1", true);
        Assert.assertNotNull(clusterNode1);

        ClusterNode clusterNode2 = clusterManagementService.createNode(clusterGroup.getId(),
            "10.2.0.2", "Node 2", true);
        Assert.assertNotNull(clusterNode2);

        // Create scheduled job
View Full Code Here

        ClusterGroup clusterGroup = scheduleJob.getCluster();
        if (clusterGroup != null) {
            List<ClusterNode> selectedNodes = selectClusterNodes(scheduleJob);
            List<ScheduleExecutionNode> result = new ArrayList<ScheduleExecutionNode>(selectedNodes.size());
            for (int i = 0, size = selectedNodes.size(); i < size; i++) {
                ClusterNode clusterNode = selectedNodes.get(i);
                ScheduleExecutionNode executionNode = new ScheduleExecutionNode();
                executionNode.setOrderIndex(i);
                executionNode.setLocalhost(false);
                executionNode.setAddress(clusterNode.getAddress());
                result.add(executionNode);
            }
            return result;
        }
View Full Code Here

        // "circle" strategy - step index in cluster and get all active nodes
        int rolledIndex = clusterManagementService.rollGroupIndex(clusterGroup.getId());

        for (int i = rolledIndex, size = clusterGroup.getNodes().size(); i < size; i++) {
            ClusterNode clusterNode = clusterGroup.getNodes().get(i);
            if (clusterNode.isEnabled()) {
                selectedNodes.add(clusterNode);
            }
        }

        for (int i = 0; i < rolledIndex; i++) {
            ClusterNode clusterNode = clusterGroup.getNodes().get(i);
            if (clusterNode.isEnabled()) {
                selectedNodes.add(clusterNode);
            }
        }

        return selectedNodes;
View Full Code Here

        }

        int currentIndex = clusterGroup.getRollingIndex();

        for (int i = currentIndex + 1, size = clusterGroup.getNodes().size(); i < size; i++) {
            ClusterNode clusterNode = clusterGroup.getNodes().get(i);
            if (clusterNode.isEnabled()) {
                clusterGroup.setRollingIndex(i);
                return i;
            }
        }

        for (int i = 0; i < currentIndex; i++) {
            ClusterNode clusterNode = clusterGroup.getNodes().get(i);
            if (clusterNode.isEnabled()) {
                clusterGroup.setRollingIndex(i);
                return i;
            }
        }
View Full Code Here

        ClusterGroup clusterGroup = businessEntityDao.lockById(ClusterGroup.class, clusterGroupId);
        if (clusterGroup == null) {
            throw new MissingEntityException(ClusterGroup.class, clusterGroupId);
        }

        ClusterNode clusterNode = new ClusterNode();
        clusterNode.setEnabled(activity);
        clusterNode.setAddress(address);
        clusterNode.setDescription(comment);

        clusterGroup.getNodes().add(clusterNode);
        clusterNode.setGroup(clusterGroup);

        clusterGroup.reindexNodes();

        return clusterNode;
    }
View Full Code Here

        return clusterNode;
    }

    @Override
    public void deleteNode(long clusterNodeId) {
        ClusterNode clusterNode = businessEntityDao.findById(ClusterNode.class, clusterNodeId);
        if (clusterNode == null) {
            throw new MissingEntityException(ClusterNode.class, clusterNodeId);
        }

        ClusterGroup clusterGroup = clusterNode.getGroup();

        businessEntityDao.lock(clusterGroup);

        int index = clusterGroup.getNodes().indexOf(clusterNode);
        clusterGroup.getNodes().remove(index);
View Full Code Here

        }
    }

    @Override
    public ClusterNode modifyNode(long clusterNodeId, String domain, String comment, boolean activity) {
        ClusterNode clusterNode = businessEntityDao.lockById(ClusterNode.class, clusterNodeId);
        if (clusterNode == null) {
            throw new MissingEntityException(ClusterNode.class, clusterNodeId);
        }

        clusterNode.setAddress(domain);
        clusterNode.setDescription(comment);
        clusterNode.setEnabled(activity);

        return clusterNode;
    }
View Full Code Here

TOP

Related Classes of org.qzerver.model.domain.entities.cluster.ClusterNode

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.