Optimize the comments and logs of the dynamic starter module.

pull/161/head v0.3.0
chen.ma 4 years ago
parent 7a630ba072
commit 34f394a0c5

@ -8,7 +8,7 @@ import com.github.dynamic.threadpool.starter.toolkit.thread.ThreadPoolBuilder;
import java.util.concurrent.TimeUnit;
/**
* Common ThreadPool.
* Common threadPool.
*
* @author chen.ma
* @date 2021/6/16 22:35

@ -9,7 +9,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.List;
/**
* Bootstrap Properties.
* Bootstrap properties.
*
* @author chen.ma
* @date 2021/6/22 09:14

@ -14,7 +14,7 @@ import static com.github.dynamic.threadpool.starter.toolkit.CloudCommonIdUtil.ge
import static com.github.dynamic.threadpool.starter.toolkit.CloudCommonIdUtil.getIpApplicationName;
/**
* Dynamic Tp Discovery Config.
* Dynamic threadPool discovery config.
*
* @author chen.ma
* @date 2021/8/6 21:35

@ -19,7 +19,7 @@ import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
/**
* DynamicTp Auto Configuration.
* DynamicTp auto configuration.
*
* @author chen.ma
* @date 2021/6/22 09:20

@ -14,7 +14,7 @@ import javax.net.ssl.X509TrustManager;
import java.util.concurrent.TimeUnit;
/**
* Http Client Config.
* Http client config.
*
* @author chen.ma
* @date 2021/6/10 13:28

@ -12,7 +12,7 @@ import org.springframework.context.annotation.DependsOn;
import org.springframework.core.env.ConfigurableEnvironment;
/**
* Message Alarm Config.
* Message alarm config.
*
* @author chen.ma
* @date 2021/8/15 15:39

@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
/**
* Pool Run State Controller.
* Pool run state controller.
*
* @author chen.ma
* @date 2021/7/7 21:34

@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* Cache Data.
* Cache data.
*
* @author chen.ma
* @date 2021/6/22 20:46

@ -21,7 +21,7 @@ import java.util.concurrent.TimeUnit;
import static com.github.dynamic.threadpool.common.constant.Constants.*;
/**
* Client Worker.
* Client worker.
*
* @author chen.ma
* @date 2021/6/20 18:34

@ -1,7 +1,7 @@
package com.github.dynamic.threadpool.starter.core;
/**
* Config Adapter.
* Config adapter.
*
* @author chen.ma
* @date 2021/6/22 21:29
@ -9,7 +9,7 @@ package com.github.dynamic.threadpool.starter.core;
public class ConfigAdapter {
/**
* callback Config.
* Callback Config.
*
* @param config
*/

@ -1,7 +1,7 @@
package com.github.dynamic.threadpool.starter.core;
/**
* Config Service.
* Config service.
*
* @author chen.ma
* @date 2021/6/21 21:49
@ -9,7 +9,7 @@ package com.github.dynamic.threadpool.starter.core;
public interface ConfigService {
/**
* , , 使
* Add listener.
*
* @param tenantId
* @param itemId
@ -19,7 +19,7 @@ public interface ConfigService {
void addListener(String tenantId, String itemId, String tpId, Listener listener);
/**
*
* Get server status.
*
* @return
*/

@ -13,7 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.*;
/**
* Discovery Client.
* Discovery client.
*
* @author chen.ma
* @date 2021/7/13 21:51

@ -1,7 +1,7 @@
package com.github.dynamic.threadpool.starter.core;
/**
* Dynamic Tp Client.
* Dynamic tp client.
*
* @author chen.ma
* @date 2021/7/13 21:50

@ -24,7 +24,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Dynamic ThreadPool Post Processor.
* Dynamic threadPool post processor.
*
* @author chen.ma
* @date 2021/8/2 20:40

@ -7,7 +7,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Global ThreadPool Manage.
* Global threadPool manage.
*
* @author chen.ma
* @date 2021/6/20 15:57

@ -11,14 +11,14 @@ import java.util.concurrent.Executor;
public interface Listener {
/**
*
* Get executor.
*
* @return
*/
Executor getExecutor();
/**
*
* Receive config info.
*
* @param configInfo
*/

@ -5,7 +5,7 @@ import com.github.dynamic.threadpool.starter.remote.HttpAgent;
import java.util.Arrays;
/**
* ThreadPool Config Service.
* ThreadPool config service.
*
* @author chen.ma
* @date 2021/6/21 21:50

@ -13,7 +13,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* ThreadPool Dynamic Refresh.
* ThreadPool dynamic refresh.
*
* @author chen.ma
* @date 2021/6/20 15:51

@ -5,7 +5,7 @@ import com.github.dynamic.threadpool.starter.config.BootstrapProperties;
import java.util.concurrent.Executor;
/**
* ThreadPool Operation.
* ThreadPool operation.
*
* @author chen.ma
* @date 2021/6/22 20:25

@ -1,7 +1,7 @@
package com.github.dynamic.threadpool.starter.core;
/**
* ThreadPool Subscribe Callback.
* ThreadPool subscribe callback.
*
* @author chen.ma
* @date 2021/6/22 20:26
@ -9,7 +9,7 @@ package com.github.dynamic.threadpool.starter.core;
public interface ThreadPoolSubscribeCallback {
/**
*
* Callback.
*
* @param config
*/

@ -5,7 +5,7 @@ import org.springframework.context.annotation.Import;
import java.lang.annotation.*;
/**
* Annotation to activate Dynamic ThreadPool related configuration.
* Annotation to activate dynamic threadPool related configuration.
*
* @author chen.ma
* @date 2021/7/8 23:28

@ -4,7 +4,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 线
* Marker configuration.
*
* @author chen.ma
* @date 2021/7/8 23:30

@ -10,7 +10,7 @@ import org.springframework.boot.ansi.AnsiOutput;
import org.springframework.boot.ansi.AnsiStyle;
/**
* 线 Banner.
* Dynamic thread pool print banner.
*
* @author chen.ma
* @date 2021/6/20 16:34

@ -13,7 +13,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Thread Pool Run State Service.
* Thread pool run state service.
*
* @author chen.ma
* @date 2021/7/12 21:25
@ -21,11 +21,11 @@ import java.util.concurrent.ThreadPoolExecutor;
@Slf4j
public class ThreadPoolRunStateHandler {
private static InetAddress addr;
private static InetAddress INET_ADDRESS;
static {
try {
addr = InetAddress.getLocalHost();
INET_ADDRESS = InetAddress.getLocalHost();
} catch (UnknownHostException ex) {
log.error("Local IP acquisition failed.", ex);
}
@ -75,7 +75,7 @@ public class ThreadPoolRunStateHandler {
stateInfo.setQueueCapacity(queueCapacity);
stateInfo.setLargestPoolSize(largestPoolSize);
stateInfo.setCompletedTaskCount(completedTaskCount);
stateInfo.setHost(addr.getHostAddress());
stateInfo.setHost(INET_ADDRESS.getHostAddress());
stateInfo.setTpId(tpId);
int rejectCount = pool instanceof CustomThreadPoolExecutor

@ -5,7 +5,7 @@ import com.github.dynamic.threadpool.common.web.base.Result;
import java.util.Map;
/**
* Http Agent.
* Http agent.
*
* @author chen.ma
* @date 2021/6/23 20:45
@ -13,26 +13,26 @@ import java.util.Map;
public interface HttpAgent {
/**
*
* Start.
*/
void start();
/**
*
* Get tenant id.
*
* @return
*/
String getTenantId();
/**
*
* Get encode.
*
* @return
*/
String getEncode();
/**
* Http Post By Discovery
* Send HTTP post request by discovery.
*
* @param path
* @param body
@ -41,7 +41,7 @@ public interface HttpAgent {
Result httpPostByDiscovery(String path, Object body);
/**
* Http Get By
* Send HTTP get request by dynamic config.
*
* @param path
* @param headers
@ -53,7 +53,7 @@ public interface HttpAgent {
long readTimeoutMs);
/**
* Http Post By
* Send HTTP post request by dynamic config.
*
* @param path
* @param headers
@ -65,7 +65,7 @@ public interface HttpAgent {
long readTimeoutMs);
/**
* Http Delete By
* Send HTTP delete request by dynamic config.
*
* @param path
* @param headers

@ -7,7 +7,7 @@ import com.github.dynamic.threadpool.starter.toolkit.HttpClientUtil;
import java.util.Map;
/**
* Server Http Agent.
* Server http agent.
*
* @author chen.ma
* @date 2021/6/23 20:50

@ -7,7 +7,7 @@ import org.springframework.util.StringUtils;
import java.util.*;
/**
* Server List Manager.
* Server list manager.
*
* @author chen.ma
* @date 2021/6/23 20:42
@ -39,7 +39,7 @@ public class ServerListManager {
for (String serverAddr : serverAddrsArr) {
if (serverAddr.startsWith(HTTPS) || serverAddr.startsWith(HTTP)) {
// TODO 固定写,后面优化
// TODO Temporarily fixed write, later optimized
currentServerAddr = serverAddr;
serverAddrs.add(serverAddr);
}
@ -71,7 +71,7 @@ public class ServerListManager {
final Iterator<RandomizedServerAddress> iter;
public ServerAddressIterator(List<String> source) {
sorted = new ArrayList<RandomizedServerAddress>();
sorted = new ArrayList();
for (String address : source) {
sorted.add(new RandomizedServerAddress(address));
}

@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.starter.spi;
import java.util.concurrent.BlockingQueue;
/**
* Custom BlockingQueue.
* Custom blockingQueue.
*
* @author chen.ma
* @date 2021/7/11 00:51

@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.starter.spi;
import java.util.concurrent.RejectedExecutionHandler;
/**
* Custom RejectedExecution Handler.
* Custom rejectedExecution handler.
*
* @author chen.ma
* @date 2021/7/10 23:51

@ -5,7 +5,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/**
* Dynamic ThreadPool Service Loader.
* Dynamic threadPool service loader.
*
* @author chen.ma
* @date 2021/7/10 23:45

@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.starter.toolkit;
import java.lang.reflect.Array;
/**
* Array Util.
* Array util.
*
* @author chen.ma
* @date 2021/7/5 21:54

@ -1,7 +1,7 @@
package com.github.dynamic.threadpool.starter.toolkit;
/**
* Calculate Util.
* Calculate util.
*
* @author chen.ma
* @date 2021/8/15 14:29

@ -6,7 +6,7 @@ import org.springframework.core.env.PropertyResolver;
import java.net.InetAddress;
/**
* Cloud Common Id Util.
* Cloud common id util.
*
* @author chen.ma
* @date 2021/8/6 21:02

@ -11,7 +11,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* HttpClient Util.
* HttpClient util.
*
* @author chen.ma
* @date 2021/6/10 13:30

@ -10,7 +10,7 @@ import java.util.concurrent.*;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;
/**
* Abstract Build ThreadPool Template.
* Abstract build threadPool template.
*
* @author chen.ma
* @date 2021/7/5 21:45

@ -11,9 +11,9 @@ import java.io.Serializable;
public interface Builder<T> extends Serializable {
/**
*
* Build.
*
* @return
* @return
*/
T build();

@ -18,7 +18,7 @@ import java.util.concurrent.locks.ReentrantLock;
import static com.github.dynamic.threadpool.common.constant.Constants.MAP_INITIAL_CAPACITY;
/**
* Custom Thread Pool Wrap.
* Custom threadPool wrap.
*
* @author chen.ma
* @date 2021/7/8 21:47

@ -9,7 +9,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Fast ThreadPool Executor.
* Fast threadPool executor.
*
* @author chen.ma
* @date 2021/7/5 21:00

@ -10,7 +10,7 @@ import java.util.Optional;
import java.util.concurrent.*;
/**
* Queue Type Enum.
* Queue type enum.
*
* @author chen.ma
* @date 2021/6/25 12:30

@ -6,7 +6,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
/**
* Rejected Policies.
* Rejected policies.
*
* @author chen.ma
* @date 2021/7/5 21:23

@ -6,7 +6,7 @@ import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.LinkedBlockingQueue;
/**
* Resizable Capacity LinkedBlockIngQueue.
* Resizable capacity linkedBlockIngQueue.
*
* @author chen.ma
* @date 2021/6/20 14:24

@ -5,7 +5,7 @@ import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
/**
* Task Queue.
* Task queue.
*
* @author chen.ma
* @date 2021/7/5 21:00

@ -5,7 +5,7 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;
/**
* ThreadFactory Builder.
* ThreadFactory builder.
*
* @author chen.ma
* @date 2021/7/5 21:53

@ -8,7 +8,7 @@ import java.math.BigDecimal;
import java.util.concurrent.*;
/**
* ThreadPool Builder.
* ThreadPool builder.
*
* @author chen.ma
* @date 2021/6/28 17:29

@ -5,7 +5,7 @@ import com.github.dynamic.threadpool.starter.toolkit.ArrayUtil;
import java.util.concurrent.*;
/**
* ThreadPool Executor Template.
* ThreadPool executor template.
*
* @author chen.ma
* @date 2021/7/5 21:59

@ -8,7 +8,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.Future;
/**
* Dynamic ThreadPool Wrap.
* Dynamic threadPool wrap.
*
* @author chen.ma
* @date 2021/6/20 16:55

@ -5,7 +5,7 @@ import lombok.Getter;
import lombok.Setter;
/**
* Manager Listener Wrap.
* Manager listener wrap.
*
* @author chen.ma
* @date 2021/6/22 17:47

Loading…
Cancel
Save