Skip to content

Commit 4057535

Browse files
committed
chore: format code
1 parent 1e2c904 commit 4057535

File tree

2 files changed

+19
-7
lines changed
  • jraft-core/src/main/java/com/alipay/sofa/jraft/core
  • jraft-extension/java-log-storage-impl/src/test/java/com/alipay/sofa/jraft/core

2 files changed

+19
-7
lines changed

jraft-core/src/main/java/com/alipay/sofa/jraft/core/NodeImpl.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,18 @@ public void run(final Status status) {
13851385
}
13861386

13871387
private void executeApplyingTasks(final List<LogEntryAndClosure> tasks) {
1388+
if (!this.logManager.hasAvailableCapacityToAppendEntries(1)) {
1389+
// It's overload, fail-fast
1390+
final List<Closure> dones = tasks.stream().map(ele -> ele.done).filter(Objects::nonNull)
1391+
.collect(Collectors.toList());
1392+
ThreadPoolsFactory.runInThread(this.groupId, () -> {
1393+
for (final Closure done : dones) {
1394+
done.run(new Status(RaftError.EBUSY, "Node %s log manager is busy.", this.getNodeId()));
1395+
}
1396+
});
1397+
return;
1398+
}
1399+
13881400
this.writeLock.lock();
13891401
try {
13901402
final int size = tasks.size();

jraft-extension/java-log-storage-impl/src/test/java/com/alipay/sofa/jraft/core/NodeTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3407,13 +3407,13 @@ public void testChangePeersChaosApplyTasks() throws Exception {
34073407
for (final ChangeArg arg : args) {
34083408
arg.stop = true;
34093409
}
3410-
for (final Future<?> future : futures) {
3411-
try {
3412-
future.get(20, TimeUnit.SECONDS);
3413-
}catch(TimeoutException e) {
3414-
// ignore
3415-
}
3416-
}
3410+
for (final Future<?> future : futures) {
3411+
try {
3412+
future.get(20, TimeUnit.SECONDS);
3413+
} catch (TimeoutException e) {
3414+
// ignore
3415+
}
3416+
}
34173417

34183418
cluster.waitLeader();
34193419
final SynchronizedClosure done = new SynchronizedClosure();

0 commit comments

Comments
 (0)