feat: 功能持续更新.

pull/161/head
chen.ma 3 years ago
parent e6d452b67d
commit e21ac470b0

@ -13,7 +13,7 @@ import org.springframework.context.annotation.Configuration;
public class CommonConfiguration {
@Bean
public ApplicationContextHolder applicationContextHolder() {
public ApplicationContextHolder simpleApplicationContextHolder() {
return new ApplicationContextHolder();
}

@ -51,4 +51,24 @@
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Implementation-Title>${project.artifactId}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Build-Time>${maven.build.timestamp}</Build-Time>
<Built-By>chen.ma</Built-By>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,43 @@
package io.dynamic.threadpool.starter.core;
import org.springframework.boot.ansi.AnsiColor;
import org.springframework.boot.ansi.AnsiOutput;
import org.springframework.boot.ansi.AnsiStyle;
/**
* 线 Banner
*
* @author chen.ma
* @date 2021/7/4 15:58
*/
public class DynamicThreadPoolBanner {
private static final String DYNAMIC_THREAD_POOL = " :: Dynamic ThreadPool :: ";
private static final int STRAP_LINE_SIZE = 42;
public static void printBanner() {
String banner = "\n___ _ _____ ___ \n" +
"| \\ _ _ _ _ __ _ _ __ (_)__ |_ _| _ \\\n" +
"| |) | || | ' \\/ _` | ' \\| / _| | | | _/\n" +
"|___/ \\_, |_||_\\__,_|_|_|_|_\\__| |_| |_| \n" +
" |__/ \n";
String version = getVersion();
version = (version != null) ? " (v" + version + ")" : "no version.";
StringBuilder padding = new StringBuilder();
while (padding.length() < STRAP_LINE_SIZE - (version.length() + DYNAMIC_THREAD_POOL.length())) {
padding.append(" ");
}
System.out.println(AnsiOutput.toString(banner, AnsiColor.GREEN, DYNAMIC_THREAD_POOL, AnsiColor.DEFAULT,
padding.toString(), AnsiStyle.FAINT, version, "\n"));
}
public static String getVersion() {
final Package pkg = DynamicThreadPoolBanner.class.getPackage();
return pkg != null ? pkg.getImplementationVersion() : "";
}
}

@ -1,17 +1,18 @@
package io.dynamic.threadpool.starter.listener;
import com.alibaba.fastjson.JSON;
import io.dynamic.threadpool.starter.common.CommonThreadPool;
import io.dynamic.threadpool.common.constant.Constants;
import io.dynamic.threadpool.common.config.ApplicationContextHolder;
import io.dynamic.threadpool.common.constant.Constants;
import io.dynamic.threadpool.common.model.PoolParameterInfo;
import io.dynamic.threadpool.common.web.base.Result;
import io.dynamic.threadpool.starter.common.CommonThreadPool;
import io.dynamic.threadpool.starter.config.DynamicThreadPoolProperties;
import io.dynamic.threadpool.starter.core.DynamicThreadPoolBanner;
import io.dynamic.threadpool.starter.core.GlobalThreadPoolManage;
import io.dynamic.threadpool.starter.remote.HttpAgent;
import io.dynamic.threadpool.starter.remote.ServerHttpAgent;
import io.dynamic.threadpool.starter.toolkit.BlockingQueueUtil;
import io.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrap;
import io.dynamic.threadpool.common.model.PoolParameterInfo;
import io.dynamic.threadpool.common.web.base.Result;
import org.springframework.core.annotation.Order;
import javax.annotation.PostConstruct;
@ -38,6 +39,8 @@ public class ThreadPoolRunListener {
@Order(1024)
@PostConstruct
public void run() {
DynamicThreadPoolBanner.printBanner();
Map<String, DynamicThreadPoolWrap> executorMap =
ApplicationContextHolder.getBeansOfType(DynamicThreadPoolWrap.class);
@ -63,5 +66,4 @@ public class ThreadPoolRunListener {
GlobalThreadPoolManage.register(val.getTpId(), ppi, val);
});
}
}

Loading…
Cancel
Save