feature: 修改动态线程池包装类命名.

pull/10/head
chen.ma 3 years ago
parent d78c330235
commit 055c48c6d2

@ -11,7 +11,7 @@ import com.github.dynamic.threadpool.starter.core.GlobalThreadPoolManage;
import com.github.dynamic.threadpool.starter.core.DynamicThreadPoolExecutor;
import com.github.dynamic.threadpool.starter.toolkit.thread.QueueTypeEnum;
import com.github.dynamic.threadpool.starter.toolkit.thread.RejectedTypeEnum;
import com.github.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrapper;
import com.github.dynamic.threadpool.starter.wrapper.DynamicThreadPoolWrapper;
import com.google.common.base.Joiner;
import com.taobao.api.ApiException;
import lombok.AllArgsConstructor;

@ -1,6 +1,6 @@
package com.github.dynamic.threadpool.starter.core;
import com.github.dynamic.threadpool.starter.wrap.ManagerListenerWrap;
import com.github.dynamic.threadpool.starter.wrapper.ManagerListenerWrapper;
import com.github.dynamic.threadpool.common.toolkit.ContentUtil;
import com.github.dynamic.threadpool.common.toolkit.Md5Util;
import com.github.dynamic.threadpool.common.constant.Constants;
@ -33,7 +33,7 @@ public class CacheData {
private volatile long localConfigLastModified;
private final CopyOnWriteArrayList<ManagerListenerWrap> listeners;
private final CopyOnWriteArrayList<ManagerListenerWrapper> listeners;
public CacheData(String tenantId, String itemId, String tpId) {
this.tenantId = tenantId;
@ -50,7 +50,7 @@ public class CacheData {
throw new IllegalArgumentException("listener is null");
}
ManagerListenerWrap managerListenerWrap = new ManagerListenerWrap(md5, listener);
ManagerListenerWrapper managerListenerWrap = new ManagerListenerWrapper(md5, listener);
if (listeners.addIfAbsent(managerListenerWrap)) {
log.info("Add listener status :: ok, tpId :: {}, cnt :: {}", tpId, listeners.size());
@ -58,14 +58,14 @@ public class CacheData {
}
public void checkListenerMd5() {
for (ManagerListenerWrap wrap : listeners) {
for (ManagerListenerWrapper wrap : listeners) {
if (!md5.equals(wrap.getLastCallMd5())) {
safeNotifyListener(content, md5, wrap);
}
}
}
private void safeNotifyListener(String content, String md5, ManagerListenerWrap wrap) {
private void safeNotifyListener(String content, String md5, ManagerListenerWrapper wrap) {
Listener listener = wrap.getListener();
Runnable runnable = () -> {

@ -11,7 +11,7 @@ import com.github.dynamic.threadpool.starter.remote.HttpAgent;
import com.github.dynamic.threadpool.starter.toolkit.thread.QueueTypeEnum;
import com.github.dynamic.threadpool.starter.toolkit.thread.RejectedTypeEnum;
import com.github.dynamic.threadpool.starter.toolkit.thread.ThreadPoolBuilder;
import com.github.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrapper;
import com.github.dynamic.threadpool.starter.wrapper.DynamicThreadPoolWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.var;

@ -1,6 +1,6 @@
package com.github.dynamic.threadpool.starter.core;
import com.github.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrapper;
import com.github.dynamic.threadpool.starter.wrapper.DynamicThreadPoolWrapper;
import com.github.dynamic.threadpool.common.model.PoolParameter;
import java.util.Map;

@ -4,7 +4,7 @@ import com.github.dynamic.threadpool.common.model.PoolRunStateInfo;
import com.github.dynamic.threadpool.starter.core.GlobalThreadPoolManage;
import com.github.dynamic.threadpool.starter.toolkit.CalculateUtil;
import com.github.dynamic.threadpool.starter.core.DynamicThreadPoolExecutor;
import com.github.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrapper;
import com.github.dynamic.threadpool.starter.wrapper.DynamicThreadPoolWrapper;
import lombok.extern.slf4j.Slf4j;
import java.net.InetAddress;

@ -1,4 +1,4 @@
package com.github.dynamic.threadpool.starter.wrap;
package com.github.dynamic.threadpool.starter.wrapper;
import com.github.dynamic.threadpool.starter.common.CommonDynamicThreadPool;
import com.github.dynamic.threadpool.starter.core.DynamicThreadPoolExecutor;
@ -8,7 +8,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.Future;
/**
* Dynamic threadPool wrap.
* Dynamic threadPool wrapper.
*
* @author chen.ma
* @date 2021/6/20 16:55

@ -1,24 +1,24 @@
package com.github.dynamic.threadpool.starter.wrap;
package com.github.dynamic.threadpool.starter.wrapper;
import com.github.dynamic.threadpool.starter.core.Listener;
import lombok.Getter;
import lombok.Setter;
/**
* Manager listener wrap.
* Manager listener wrapper.
*
* @author chen.ma
* @date 2021/6/22 17:47
*/
@Getter
@Setter
public class ManagerListenerWrap {
public class ManagerListenerWrapper {
private String lastCallMd5;
final Listener listener;
public ManagerListenerWrap(String md5, Listener listener) {
public ManagerListenerWrapper(String md5, Listener listener) {
this.lastCallMd5 = md5;
this.listener = listener;
}

@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.example.config;
import com.github.dynamic.threadpool.starter.core.DynamicThreadPool;
import com.github.dynamic.threadpool.starter.core.DynamicThreadPoolExecutor;
import com.github.dynamic.threadpool.starter.toolkit.thread.ThreadPoolBuilder;
import com.github.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrapper;
import com.github.dynamic.threadpool.starter.wrapper.DynamicThreadPoolWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@ -2,7 +2,7 @@ package com.github.dynamic.threadpool.example.inittest;
import cn.hutool.core.thread.ThreadUtil;
import com.github.dynamic.threadpool.starter.core.GlobalThreadPoolManage;
import com.github.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrapper;
import com.github.dynamic.threadpool.starter.wrapper.DynamicThreadPoolWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@ -1,7 +1,7 @@
package com.github.dynamic.threadpool.example.inittest;
import com.github.dynamic.threadpool.starter.core.GlobalThreadPoolManage;
import com.github.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrapper;
import com.github.dynamic.threadpool.starter.wrapper.DynamicThreadPoolWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

Loading…
Cancel
Save