Search in sources :

Example 1 with ContainerRuntimeState

use of org.kie.workbench.common.screens.server.management.model.ContainerRuntimeState in project kie-wb-common by kiegroup.

the class AsyncKieServerInstanceManager method produceContainerUpdateEvent.

protected void produceContainerUpdateEvent(ServerTemplate serverTemplate, ContainerSpec containerSpec, List<Container> containers, ContainerRuntimeOperation containerRuntimeOperation) {
    List<ServerInstanceKey> failedServerInstances = new ArrayList<ServerInstanceKey>();
    for (Container container : containers) {
        if (hasIssues(container)) {
            failedServerInstances.add(container.getServerInstanceKey());
        }
    }
    ContainerRuntimeState containerRuntimeState = ContainerRuntimeState.ONLINE;
    if (failedServerInstances.size() == containers.size()) {
        containerRuntimeState = ContainerRuntimeState.OFFLINE;
    } else if (!failedServerInstances.isEmpty()) {
        containerRuntimeState = ContainerRuntimeState.PARTIAL_ONLINE;
    }
    ContainerUpdateEvent updateEvent = new ContainerUpdateEvent(serverTemplate, containerSpec, failedServerInstances, containerRuntimeState, containerRuntimeOperation);
    containerUpdateEvent.fire(updateEvent);
}
Also used : Container(org.kie.server.controller.api.model.runtime.Container) ContainerRuntimeState(org.kie.workbench.common.screens.server.management.model.ContainerRuntimeState) ArrayList(java.util.ArrayList) ServerInstanceKey(org.kie.server.controller.api.model.runtime.ServerInstanceKey) ContainerUpdateEvent(org.kie.workbench.common.screens.server.management.model.ContainerUpdateEvent)

Aggregations

ArrayList (java.util.ArrayList)1 Container (org.kie.server.controller.api.model.runtime.Container)1 ServerInstanceKey (org.kie.server.controller.api.model.runtime.ServerInstanceKey)1 ContainerRuntimeState (org.kie.workbench.common.screens.server.management.model.ContainerRuntimeState)1 ContainerUpdateEvent (org.kie.workbench.common.screens.server.management.model.ContainerUpdateEvent)1