feat: 动态线程池功能逻辑完善.

pull/161/head
chen.ma 3 years ago
parent 999a3c46ea
commit e2d01931f7

@ -717,6 +717,15 @@ public final class CustomThreadPoolExecutor extends ThreadPoolExecutorTemplate {
addWorker(null, true);
}
void ensurePrestart() {
int wc = workerCountOf(ctl.get());
if (wc < corePoolSize) {
addWorker(null, true);
} else if (wc == 0) {
addWorker(null, false);
}
}
@Override
public int prestartAllCoreThreads() {
int n = 0;

@ -18,7 +18,7 @@ public class ResizableCapacityLinkedBlockIngQueue<E> extends LinkedBlockingQueue
super(capacity);
}
public boolean setCapacity(Integer capacity) {
public synchronized boolean setCapacity(Integer capacity) {
boolean successFlag = true;
try {
ReflectUtil.setFieldValue(this, "capacity", capacity);

Loading…
Cancel
Save