Skip to content

Commit

Permalink
Change setStatusChange
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Aug 15, 2023
1 parent 20ff27e commit c1b7ec8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -777,20 +777,17 @@ public String repair(
.getStorageService()
.addNotificationListener(
(notification, handback) -> {
// https://github.com/apache/cassandra/blob/600f4d9a690dbd887d5e6298fe67e6bba982033d/src/java/org/apache/cassandra/utils/progress/jmx/JMXNotificationProgressListener.java#L26
if (notification.getType().equals("progress")) {
Map<String, Integer> data = (Map<String, Integer>) notification.getUserData();

ProgressEventType progress = ProgressEventType.values()[data.get("type")];

switch (progress) {
// TODO Finish these
case START:
job.setStatusChange(progress);
job.setStatusChange(progress, notification.getMessage());
job.setStartTime(System.currentTimeMillis());
break;
case PROGRESS:
// Do we care? Progress of what..?
break;
case ERROR:
case ABORT:
Expand All @@ -799,16 +796,15 @@ public String repair(
job.setFinishedTime(System.currentTimeMillis());
break;
case SUCCESS:
job.setStatusChange(progress);
// SUCCESS / ERROR do not mean the job has completed yet (COMPLETE is that)
job.setStatusChange(progress, notification.getMessage());
// SUCCESS / ERROR does not mean the job has completed yet (COMPLETE is that)
break;
case COMPLETE:
job.setStatusChange(progress);
job.setStatusChange(progress, notification.getMessage());
job.setStatus(Job.JobStatus.COMPLETED);
job.setFinishedTime(System.currentTimeMillis());
break;
case NOTIFICATION:
// Who cares..?
break;
}
service.updateJob(job);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public void setStatus(JobStatus status) {
this.status = status;
}

public void setStatusChange(ProgressEventType type) {
statusChanges.add(new StatusChange(type));
public void setStatusChange(ProgressEventType type, String message) {
statusChanges.add(new StatusChange(type, message));
}

public List<StatusChange> getStatusChanges() {
Expand Down

0 comments on commit c1b7ec8

Please sign in to comment.