feat: threadName separator from whitespace to :/- (#2065)

thredName should not have whitespace
In most logging layout.ConversionPattern whitespace was a field separator,
so if the thredName with whitespace, then the fields was not fixed it's not friendly for logging sort , ie: sort -rnk $N
pull/2238/head
qxo 3 months ago committed by GitHub
parent e58966bc09
commit e945214ec4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -114,8 +114,8 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag
final int maxPoolSize = config.getMaximumPoolSize(); final int maxPoolSize = config.getMaximumPoolSize();
LinkedBlockingQueue<Runnable> addConnectionQueue = new LinkedBlockingQueue<>(maxPoolSize); LinkedBlockingQueue<Runnable> addConnectionQueue = new LinkedBlockingQueue<>(maxPoolSize);
this.addConnectionExecutor = createThreadPoolExecutor(addConnectionQueue, poolName + " connection adder", threadFactory, new CustomDiscardPolicy()); this.addConnectionExecutor = createThreadPoolExecutor(addConnectionQueue, poolName + ":connection-adder", threadFactory, new CustomDiscardPolicy());
this.closeConnectionExecutor = createThreadPoolExecutor(maxPoolSize, poolName + " connection closer", threadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); this.closeConnectionExecutor = createThreadPoolExecutor(maxPoolSize, poolName + ":connection-closer", threadFactory, new ThreadPoolExecutor.CallerRunsPolicy());
this.leakTaskFactory = new ProxyLeakTaskFactory(config.getLeakDetectionThreshold(), houseKeepingExecutorService); this.leakTaskFactory = new ProxyLeakTaskFactory(config.getLeakDetectionThreshold(), houseKeepingExecutorService);
@ -229,7 +229,7 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag
connectionBag.close(); connectionBag.close();
final var assassinExecutor = createThreadPoolExecutor(config.getMaximumPoolSize(), poolName + " connection assassinator", final var assassinExecutor = createThreadPoolExecutor(config.getMaximumPoolSize(), poolName + ":connection-assassinator",
config.getThreadFactory(), new ThreadPoolExecutor.CallerRunsPolicy()); config.getThreadFactory(), new ThreadPoolExecutor.CallerRunsPolicy());
try { try {
final var start = currentTime(); final var start = currentTime();
@ -637,7 +637,7 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag
private ScheduledExecutorService initializeHouseKeepingExecutorService() private ScheduledExecutorService initializeHouseKeepingExecutorService()
{ {
if (config.getScheduledExecutor() == null) { if (config.getScheduledExecutor() == null) {
final var threadFactory = Optional.ofNullable(config.getThreadFactory()).orElseGet(() -> new DefaultThreadFactory(poolName + " housekeeper")); final var threadFactory = Optional.ofNullable(config.getThreadFactory()).orElseGet(() -> new DefaultThreadFactory(poolName + ":housekeeper"));
final var executor = new ScheduledThreadPoolExecutor(1, threadFactory, new ThreadPoolExecutor.DiscardPolicy()); final var executor = new ScheduledThreadPoolExecutor(1, threadFactory, new ThreadPoolExecutor.DiscardPolicy());
executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
executor.setRemoveOnCancelPolicy(true); executor.setRemoveOnCancelPolicy(true);

@ -602,7 +602,7 @@ abstract class PoolBase
} }
else { else {
ThreadFactory threadFactory = config.getThreadFactory(); ThreadFactory threadFactory = config.getThreadFactory();
threadFactory = threadFactory != null ? threadFactory : new DefaultThreadFactory(poolName + " network timeout executor"); threadFactory = threadFactory != null ? threadFactory : new DefaultThreadFactory(poolName + ":network-timeout-executor");
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool(threadFactory); ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool(threadFactory);
executor.setKeepAliveTime(15, SECONDS); executor.setKeepAliveTime(15, SECONDS);
executor.allowCoreThreadTimeOut(true); executor.allowCoreThreadTimeOut(true);

Loading…
Cancel
Save