@SafeVarargs private static List<TaskStatusPlus> filterNonCompactTasks(List<TaskStatusPlus>...taskStatusStreams) { final List<TaskStatusPlus> allTaskStatusPlus = new ArrayList<>(); Arrays.stream(taskStatusStreams).forEach(allTaskStatusPlus::addAll); return allTaskStatusPlus .stream() .filter(status -> { final String taskType = status.getType(); // taskType can be null if middleManagers are running with an older version. Here, we consevatively regard // the tasks of the unknown taskType as the compactionTask. This is because it's important to not run // compactionTasks more than the configured limit at any time which might impact to the ingestion // performance. return taskType == null || COMPACT_TASK_TYPE.equals(taskType); }) .collect(Collectors.toList()); }
optionalTypeFilteredList = collectionToFilter .stream() .filter(task -> type.equals(task.getType())) .collect(Collectors.toList());
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TaskStatusPlus that = (TaskStatusPlus) o; return Objects.equals(getId(), that.getId()) && Objects.equals(getType(), that.getType()) && Objects.equals(getCreatedTime(), that.getCreatedTime()) && Objects.equals(getQueueInsertionTime(), that.getQueueInsertionTime()) && getStatusCode() == that.getStatusCode() && Objects.equals(getDuration(), that.getDuration()) && Objects.equals(getLocation(), that.getLocation()) && Objects.equals(getDataSource(), that.getDataSource()) && Objects.equals(getErrorMsg(), that.getErrorMsg()); }
@Override public int hashCode() { return Objects.hash( getId(), getType(), getCreatedTime(), getQueueInsertionTime(), getStatusCode(), getDuration(), getLocation(), getDataSource(), getErrorMsg() ); }
Assert.assertEquals("id_1", responseObjects.get(0).getId()); TaskStatusPlus tsp = responseObjects.get(0); Assert.assertEquals(null, tsp.getType()); Assert.assertTrue("DataSource Check", "allow".equals(responseObjects.get(0).getDataSource()));
@SafeVarargs private static int findNumNonCompleteCompactTasks(List<TaskStatusPlus>...taskStatusStreams) { final List<TaskStatusPlus> allTaskStatusPlus = new ArrayList<>(); Arrays.stream(taskStatusStreams).forEach(allTaskStatusPlus::addAll); return allTaskStatusPlus .stream() .filter(status -> { final String taskType = status.getType(); // taskType can be null if middleManagers are running with an older version. Here, we consevatively regard // the tasks of the unknown taskType as the compactionTask. This is because it's important to not run // compactionTasks more than the configured limit at any time which might impact to the ingestion // performance. return taskType == null || COMPACT_TASK_TYPE.equals(taskType); }) .collect(Collectors.toList()) .size(); }
optionalTypeFilteredList = collectionToFilter .stream() .filter(task -> type.equals(task.getType())) .collect(Collectors.toList());
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TaskStatusPlus that = (TaskStatusPlus) o; return Objects.equals(getId(), that.getId()) && Objects.equals(getType(), that.getType()) && Objects.equals(getCreatedTime(), that.getCreatedTime()) && Objects.equals(getQueueInsertionTime(), that.getQueueInsertionTime()) && getStatusCode() == that.getStatusCode() && Objects.equals(getDuration(), that.getDuration()) && Objects.equals(getLocation(), that.getLocation()) && Objects.equals(getDataSource(), that.getDataSource()) && Objects.equals(getErrorMsg(), that.getErrorMsg()); }
@Override public int hashCode() { return Objects.hash( getId(), getType(), getCreatedTime(), getQueueInsertionTime(), getStatusCode(), getDuration(), getLocation(), getDataSource(), getErrorMsg() ); }