Skip to content

Commit

Permalink
refactor: removed rawtype from progressmonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Ruaux committed Aug 15, 2022
1 parent 991cdbd commit 4795148
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ protected ProgressMonitor.Builder progressMonitor() {
return progressOptions.monitor();
}

@SuppressWarnings("unchecked")
protected <I, O> FaultTolerantStepBuilder<I, O> step(SimpleStepBuilder<I, O> step, ProgressMonitor monitor) {
if (transferOptions.getThreads() > 1) {
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
Expand All @@ -72,7 +71,7 @@ protected <I, O> FaultTolerantStepBuilder<I, O> step(SimpleStepBuilder<I, O> ste
}
if (progressOptions.isEnabled()) {
step.listener((StepExecutionListener) monitor);
step.listener((ItemWriteListener<O>) monitor);
step.listener((ItemWriteListener<Object>) monitor);
}
return step.faultTolerant().skipPolicy(skipPolicy(transferOptions.getSkipPolicy()));
}
Expand Down
11 changes: 5 additions & 6 deletions core/riot-core/src/main/java/com/redis/riot/ProgressMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
import me.tongfei.progressbar.ProgressBarBuilder;
import me.tongfei.progressbar.ProgressBarStyle;

@SuppressWarnings("rawtypes")
public class ProgressMonitor implements StepExecutionListener, ItemWriteListener {
public class ProgressMonitor implements StepExecutionListener, ItemWriteListener<Object> {

public enum Style {
ASCII, COLOR, BW, NONE
Expand Down Expand Up @@ -74,17 +73,17 @@ public synchronized ExitStatus afterStep(StepExecution stepExecution) {
}

@Override
public void beforeWrite(List items) {
public void beforeWrite(List<? extends Object> items) {
// do nothing
}

@Override
public void afterWrite(List items) {
public void afterWrite(List<? extends Object> items) {
progressBar.stepBy(items.size());
}

@Override
public void onWriteError(Exception exception, List items) {
public void onWriteError(Exception exception, List<? extends Object> items) {
// do nothing
}

Expand All @@ -98,7 +97,7 @@ public ExtraMessageProgressMonitor(Builder builder) {
}

@Override
public void afterWrite(List items) {
public void afterWrite(List<? extends Object> items) {
super.afterWrite(items);
progressBar.setExtraMessage(extraMessage.get());
}
Expand Down

0 comments on commit 4795148

Please sign in to comment.