Skip to content

Commit 1bef7b3

Browse files
committed
chore: better code style
1 parent e9cfc31 commit 1bef7b3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/main/java/io/lettuce/core/protocol/DefaultAutoBatchFlushEndpoint.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -1266,25 +1266,23 @@ public void execute(Runnable task) {
12661266
cur = this.owner;
12671267
if (isOwnerCurrentThreadAndPreemptPrevented(cur)) {
12681268
// already prevented preemption, safe to skip expensive add/done calls
1269-
executeInOwnerWithPreemptPrevention(task, false);
1269+
task.run();
12701270
return;
12711271
}
12721272
} while (!OWNER.compareAndSet(this, cur, cur.toAdd(1)));
12731273

12741274
if (cur.isCurrentThread()) {
1275-
executeInOwnerWithPreemptPrevention(task, true);
1275+
executeInOwnerWithPreemptPrevention(task);
12761276
} else {
1277-
cur.thread.execute(() -> executeInOwnerWithPreemptPrevention(task, true));
1277+
cur.thread.execute(() -> executeInOwnerWithPreemptPrevention(task));
12781278
}
12791279
}
12801280

1281-
private void executeInOwnerWithPreemptPrevention(Runnable task, boolean added) {
1281+
private void executeInOwnerWithPreemptPrevention(Runnable task) {
12821282
try {
12831283
task.run();
12841284
} finally {
1285-
if (added) {
1286-
done(1);
1287-
}
1285+
done(1);
12881286
}
12891287
}
12901288

0 commit comments

Comments
 (0)