Skip to content

Commit

Permalink
fix sonar: Refactor this code to use the more specialised Functional …
Browse files Browse the repository at this point in the history
…Interface 'ObjIntConsumer<Runnable>'
  • Loading branch information
zeyu10 committed Oct 14, 2024
1 parent fd37135 commit ae70eaa
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

import lombok.extern.slf4j.Slf4j;

import java.util.function.BiConsumer;
import java.util.function.ObjIntConsumer;

@Slf4j
public class OperationUtil {
private OperationUtil() {}

public static final BiConsumer<Runnable, Integer> OPERATE_WITH_RETRY = (operation, retryTimes) -> {
int exceptionCatchTimes = retryTimes;
for (int i = 1; i <= exceptionCatchTimes; i++) {
public static final ObjIntConsumer<Runnable> OPERATE_WITH_RETRY = (operation, retryTimes) -> {
for (int i = 1; i <= retryTimes; i++) {
try {
operation.run();
return;
Expand Down

0 comments on commit ae70eaa

Please sign in to comment.