Skip to content

Commit

Permalink
1.2.19
Browse files Browse the repository at this point in the history
1.redis注册中心的兼容性
  • Loading branch information
wangzihao committed Sep 11, 2024
1 parent ea2f7b1 commit 63c9088
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ public static String getHttpRequestFactory() {
public static ScheduledThreadPoolExecutor newScheduled(int corePoolSize, Supplier<String> name, Consumer<Throwable> exceptionConsumer) {
AtomicInteger id = new AtomicInteger();
return new ScheduledThreadPoolExecutor(corePoolSize, r -> {
String name1;
try {
String nameGet = name.get();
name1 = nameGet + id.incrementAndGet();
} catch (Exception e) {
name1 = String.valueOf(name.getClass()) + id.incrementAndGet();
}
Thread result = new Thread(() -> {
try {
r.run();
Expand All @@ -115,9 +122,17 @@ public static ScheduledThreadPoolExecutor newScheduled(int corePoolSize, Supplie
e.printStackTrace();
}
}
}, name.get() + id.incrementAndGet());
}, name1);
result.setDaemon(true);
return result;
}, (r, exe) -> {
if (!exe.isShutdown()) {
try {
exe.getQueue().put(r);
} catch (InterruptedException e) {
// ignore
}
}
});
}

Expand Down

0 comments on commit 63c9088

Please sign in to comment.