@Test void nonCancellableReturnsNull() { Cluster cluster = new Cluster(); cluster.setId(1L); AttemptResult<Object> result = underTest.checkClusterCancelledState(cluster, false); assertThat(result).isNull(); }
@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; }
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; } }
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; }  }
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; }  @Nullable AttemptResult<Object> checkClusterCancelledState(Cluster cluster, boolean cancellable); }
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; }  @Nullable AttemptResult<Object> checkClusterCancelledState(Cluster cluster, boolean cancellable);  }