Package com.sequenceiq.cloudbreak.service.cluster.event

Examples of com.sequenceiq.cloudbreak.service.cluster.event.ClusterStatusUpdateRequest


    @Autowired
    private ClusterRepository clusterRepository;

    @Override
    public void accept(Event<ClusterStatusUpdateRequest> event) {
        ClusterStatusUpdateRequest statusUpdateRequest = event.getData();
        StatusRequest statusRequest = statusUpdateRequest.getStatusRequest();
        long stackId = statusUpdateRequest.getStackId();
        Stack stack = stackRepository.findOneWithLists(stackId);
        Cluster cluster = stack.getCluster();
        MDCBuilder.buildMdcContext(cluster);
        if (StatusRequest.STOPPED.equals(statusRequest)) {
            ambariClusterConnector.stopCluster(stack);
View Full Code Here


                }
                cluster.setStatus(Status.START_IN_PROGRESS);
                clusterRepository.save(cluster);
                LOGGER.info("Publishing {} event", ReactorConfig.CLUSTER_STATUS_UPDATE_EVENT);
                reactor.notify(ReactorConfig.CLUSTER_STATUS_UPDATE_EVENT,
                        Event.wrap(new ClusterStatusUpdateRequest(stack.getId(), statusRequest)));
            }
        } else {
            if (!Status.AVAILABLE.equals(clusterStatus)) {
                throw new BadRequestException(
                        String.format("Cannot update the status of cluster '%s' to STOPPED, because it isn't in AVAILABLE state.", clusterId));
            }
            if (!Status.AVAILABLE.equals(stackStatus) && !Status.STOP_REQUESTED.equals(stackStatus)) {
                throw new BadRequestException(
                        String.format("Cannot update the status of cluster '%s' to STARTED, because the stack is not AVAILABLE", clusterId));
            }
            cluster.setStatus(Status.STOP_IN_PROGRESS);
            clusterRepository.save(cluster);
            LOGGER.info("Publishing {} event", ReactorConfig.CLUSTER_STATUS_UPDATE_EVENT);
            reactor.notify(ReactorConfig.CLUSTER_STATUS_UPDATE_EVENT,
                    Event.wrap(new ClusterStatusUpdateRequest(stack.getId(), statusRequest)));
        }
    }
View Full Code Here

                stackUpdater.updateStackStatus(stackId, Status.AVAILABLE);
                if (cluster != null && Status.START_REQUESTED.equals(cluster.getStatus())) {
                    boolean hostsJoined = waitForHostsToJoin(stack);
                    if (hostsJoined) {
                        reactor.notify(ReactorConfig.CLUSTER_STATUS_UPDATE_EVENT,
                                Event.wrap(new ClusterStatusUpdateRequest(stack.getId(), statusRequest)));
                    } else {
                        cluster.setStatus(Status.START_FAILED);
                        stack.setCluster(cluster);
                        stackRepository.save(stack);
                    }
View Full Code Here

TOP

Related Classes of com.sequenceiq.cloudbreak.service.cluster.event.ClusterStatusUpdateRequest

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.