class ClusterPollingCheckerService {

    @Nullable
    public AttemptResult<Object> checkClusterCancelledState(Cluster cluster, boolean cancellable) {
        checkArgument(cluster != null, "Cluster must not be null!");
        AttemptResult<Object> result = null;
        if (cancellable && PollGroup.CANCELLED.equals(InMemoryStateStore.getCluster(cluster.getId()))) {
            LOGGER.info("Cluster wait polling cancelled in inmemory store, id: {}", cluster.getId());
            result = AttemptResults.breakFor("Cluster wait polling cancelled in inmemory store, id: " + cluster.getId());
        }
        return result;
    }

}