feat: 修改 pom & 修改文件包名.

pull/161/head
chen.ma 3 years ago
parent 3644f97a78
commit e12b34c2e2

@ -1,37 +0,0 @@
package io.dtp.server.model;
import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author chen.ma
* @date 2021/6/20 14:05
*/
@Data
public class ConfigInfoBase implements Serializable {
private static final long serialVersionUID = -1892597426099265730L;
/**
* TpId
*/
private String tpId;
/**
* ItemId
*/
private String itemId;
/**
*
*/
private String content;
/**
* MD5
*/
private String md5;
}

@ -1,2 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=io.dtp.starter.config.CommonConfiguration, \
io.dtp.starter.config.OkHttpClientConfig

@ -4,12 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.dynamic-thread-pool</groupId>
<artifactId>dtp-parent</artifactId>
<groupId>io.dynamic-threadpool</groupId>
<artifactId>parent</artifactId>
<version>${revision}</version>
</parent>
<artifactId>dtp-spring-boot-starter</artifactId>
<artifactId>dynamic-threadpool-spring-boot-starter</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
@ -27,7 +27,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>

@ -1,4 +1,4 @@
package io.dtp.starter.config;
package io.dynamic.threadpool.starter.config;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;

@ -1,6 +1,6 @@
package io.dtp.starter.config;
package io.dynamic.threadpool.starter.config;
import io.dtp.starter.core.ThreadPoolRunListener;
import io.dynamic.threadpool.starter.core.ThreadPoolRunListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@ -1,6 +1,6 @@
package io.dtp.starter.config;
package io.dynamic.threadpool.starter.config;
import io.dtp.starter.toolkit.HttpClientUtil;
import io.dynamic.threadpool.starter.toolkit.HttpClientUtil;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;

@ -1,6 +1,6 @@
package io.dtp.starter.core;
package io.dynamic.threadpool.starter.core;
import io.dtp.starter.wrap.DynamicThreadPoolWrap;
import io.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@ -1,11 +1,11 @@
package io.dtp.starter.core;
package io.dynamic.threadpool.starter.core;
import io.dtp.starter.common.CommonThreadPool;
import io.dtp.starter.config.ApplicationContextHolder;
import io.dtp.starter.model.PoolParameterInfo;
import io.dtp.starter.toolkit.BlockingQueueUtil;
import io.dtp.starter.toolkit.HttpClientUtil;
import io.dtp.starter.wrap.DynamicThreadPoolWrap;
import io.dynamic.threadpool.starter.common.CommonThreadPool;
import io.dynamic.threadpool.starter.config.ApplicationContextHolder;
import io.dynamic.threadpool.starter.model.PoolParameterInfo;
import io.dynamic.threadpool.starter.toolkit.BlockingQueueUtil;
import io.dynamic.threadpool.starter.toolkit.HttpClientUtil;
import io.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;

@ -0,0 +1,10 @@
package io.dynamic.threadpool.starter.listener;
/**
*
*
* @author chen.ma
* @date 2021/6/20 18:34
*/
public class ClientWorker {
}

@ -0,0 +1,21 @@
package io.dynamic.threadpool.starter.listener;
/**
*
*
* @author chen.ma
* @date 2021/6/20 18:37
*/
public class LongPollingRunnable implements Runnable {
private final int taskId;
public LongPollingRunnable(Integer taskId) {
this.taskId = taskId;
}
@Override
public void run() {
}
}

@ -1,4 +1,4 @@
package io.dtp.starter.model;
package io.dynamic.threadpool.starter.model;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@ -61,13 +61,4 @@ public class PoolParameterInfo implements Serializable {
* 线
*/
private Integer keepAliveTime;
public void setContent(String content) {
JSONObject poolParam = JSON.parseObject(content);
this.coreSize = poolParam.getInteger("coreSize");
this.maxSize = poolParam.getInteger("maxSize");
this.capacity = poolParam.getInteger("capacity");
this.queueType = poolParam.getInteger("queueType");
this.keepAliveTime = poolParam.getInteger("keepAliveTime");
}
}

@ -1,8 +1,8 @@
package io.dtp.starter.monitor;
package io.dynamic.threadpool.starter.monitor;
import io.dtp.starter.core.GlobalThreadPoolManage;
import io.dtp.starter.core.ResizableCapacityLinkedBlockIngQueue;
import io.dtp.starter.wrap.DynamicThreadPoolWrap;
import io.dynamic.threadpool.starter.core.GlobalThreadPoolManage;
import io.dynamic.threadpool.starter.core.ResizableCapacityLinkedBlockIngQueue;
import io.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrap;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@ -1,6 +1,6 @@
package io.dtp.starter.toolkit;
package io.dynamic.threadpool.starter.toolkit;
import io.dtp.starter.core.ResizableCapacityLinkedBlockIngQueue;
import io.dynamic.threadpool.starter.core.ResizableCapacityLinkedBlockIngQueue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

@ -1,4 +1,4 @@
package io.dtp.starter.toolkit;
package io.dynamic.threadpool.starter.toolkit;
import com.alibaba.fastjson.JSON;
import lombok.SneakyThrows;

@ -1,6 +1,6 @@
package io.dtp.starter.wrap;
package io.dynamic.threadpool.starter.wrap;
import io.dtp.starter.common.CommonThreadPool;
import io.dynamic.threadpool.starter.common.CommonThreadPool;
import lombok.Data;
import java.util.concurrent.Callable;
@ -32,9 +32,7 @@ public class DynamicThreadPoolWrap {
* @param threadPoolId
*/
public DynamicThreadPoolWrap(String tenant, String itemId, String threadPoolId) {
this.tenant = tenant;
this.itemId = itemId;
this.tpId = threadPoolId;
this(tenant, itemId, threadPoolId, null);
}
/**
@ -46,6 +44,8 @@ public class DynamicThreadPoolWrap {
* @param threadPoolExecutor
*/
public DynamicThreadPoolWrap(String tenant, String itemId, String threadPoolId, ThreadPoolExecutor threadPoolExecutor) {
this.tenant = tenant;
this.itemId = itemId;
this.tpId = threadPoolId;
this.pool = threadPoolExecutor;
}

@ -0,0 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=io.dynamic.threadpool.starter.config.CommonConfiguration, \
io.dynamic.threadpool.starter.config.OkHttpClientConfig

@ -1,6 +1,6 @@
package io.dtp.starter.test;
package io.dynamic.threadpool.starter.test;
import io.dtp.starter.core.ResizableCapacityLinkedBlockIngQueue;
import io.dynamic.threadpool.starter.core.ResizableCapacityLinkedBlockIngQueue;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.LinkedBlockingQueue;

@ -4,15 +4,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.dynamic-thread-pool</groupId>
<artifactId>dtp-parent</artifactId>
<groupId>io.dynamic-threadpool</groupId>
<artifactId>parent</artifactId>
<version>${revision}</version>
</parent>
<artifactId>dtp-example</artifactId>
<artifactId>dynamic-threadpool-example</artifactId>
<packaging>jar</packaging>
<name>dtp-example</name>
<name>${project.artifactId}</name>
<description>Demo project for Spring Boot</description>
<properties>

@ -1,4 +1,4 @@
package io.dtp.example;
package io.dynamic.threadpool.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@ -1,4 +1,4 @@
package io.dtp.example.config;
package io.dynamic.threadpool.example.config;
import io.dtp.starter.wrap.DynamicThreadPoolWrap;
import org.springframework.context.annotation.Bean;

@ -1,4 +1,4 @@
package io.dtp.example;
package io.dynamic.threadpool.example;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@ -3,8 +3,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.dynamic-thread-pool</groupId>
<artifactId>dtp-parent</artifactId>
<groupId>io.dynamic-threadpool</groupId>
<artifactId>parent</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
@ -23,9 +23,9 @@
</properties>
<modules>
<module>dtp-server</module>
<module>dtp-example</module>
<module>dtp-spring-boot-starter</module>
<module>server</module>
<module>example</module>
<module>dynamic-threadpool-spring-boot-starter</module>
</modules>
<dependencyManagement>
@ -53,9 +53,15 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<artifactId>hutool-all</artifactId>
<version>${hutool-core.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
</dependencies>
</dependencyManagement>

@ -4,12 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.dynamic-thread-pool</groupId>
<artifactId>dtp-parent</artifactId>
<groupId>io.dynamic-threadpool</groupId>
<artifactId>parent</artifactId>
<version>${revision}</version>
</parent>
<artifactId>dtp-server</artifactId>
<artifactId>dynamic-threadpool-server</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
@ -36,6 +36,11 @@
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
</dependencies>
<build>

@ -1,4 +1,4 @@
package io.dtp.server;
package io.dynamic.threadpool.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@ -1,4 +1,4 @@
package io.dtp.server.constant;
package io.dynamic.threadpool.server.constant;
/**
*

@ -1,8 +1,8 @@
package io.dtp.server.controller;
package io.dynamic.threadpool.server.controller;
import io.dtp.server.constant.Constants;
import io.dtp.server.model.ConfigInfoBase;
import io.dtp.server.service.ConfigService;
import io.dynamic.threadpool.server.constant.Constants;
import io.dynamic.threadpool.server.model.ConfigInfoBase;
import io.dynamic.threadpool.server.service.ConfigService;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;

@ -1,6 +1,6 @@
package io.dtp.server.mapper;
package io.dynamic.threadpool.server.mapper;
import io.dtp.server.model.ConfigAllInfo;
import io.dynamic.threadpool.server.model.ConfigAllInfo;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
@ -12,13 +12,11 @@ import java.sql.SQLException;
* @author chen.ma
* @date 2021/6/20 15:57
*/
public final class RowMapperManager {
public static final ConfigAllInfoRowMapper CONFIG_ALL_INFO_ROW_MAPPER = new ConfigAllInfoRowMapper();
public static class ConfigAllInfoRowMapper implements RowMapper<ConfigAllInfo> {
@Override
public ConfigAllInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
ConfigAllInfo configAllInfo = new ConfigAllInfo();
@ -26,6 +24,14 @@ public final class RowMapperManager {
configAllInfo.setItemId(rs.getString("item_id"));
configAllInfo.setTenant(rs.getString("tenant_id"));
configAllInfo.setContent(rs.getString("content"));
configAllInfo.setCoreSize(rs.getInt("core_size"));
configAllInfo.setMaxSize(rs.getInt("max_size"));
configAllInfo.setQueueType(rs.getInt("queue_type"));
configAllInfo.setCapacity(rs.getInt("capacity"));
configAllInfo.setKeepAliveTime(rs.getInt("keep_alive_time"));
configAllInfo.setIsAlarm(rs.getInt("is_alarm"));
configAllInfo.setCapacityAlarm(rs.getInt("capacity_alarm"));
configAllInfo.setLivenessAlarm(rs.getInt("liveness_alarm"));
configAllInfo.setMd5(rs.getString("md5"));
configAllInfo.setCreateTime(rs.getTimestamp("gmt_modified").getTime());
configAllInfo.setModifyTime(rs.getTimestamp("gmt_modified").getTime());

@ -1,4 +1,4 @@
package io.dtp.server.model;
package io.dynamic.threadpool.server.model;
import lombok.Data;

@ -1,4 +1,4 @@
package io.dtp.server.model;
package io.dynamic.threadpool.server.model;
import lombok.Data;

@ -0,0 +1,77 @@
package io.dynamic.threadpool.server.model;
import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author chen.ma
* @date 2021/6/20 14:05
*/
@Data
public class ConfigInfoBase implements Serializable {
private static final long serialVersionUID = -1892597426099265730L;
/**
* TpId
*/
private String tpId;
/**
* ItemId
*/
private String itemId;
/**
* 线
*/
private Integer coreSize;
/**
* 线
*/
private Integer maxSize;
/**
*
*/
private Integer queueType;
/**
*
*/
private Integer capacity;
/**
* 线
*/
private Integer keepAliveTime;
/**
*
*/
private Integer isAlarm;
/**
*
*/
private Integer capacityAlarm;
/**
*
*/
private Integer livenessAlarm;
/**
* MD5
*/
private String md5;
/**
*
*/
private String content;
}

@ -1,6 +1,6 @@
package io.dtp.server.service;
package io.dynamic.threadpool.server.service;
import io.dtp.server.model.ConfigAllInfo;
import io.dynamic.threadpool.server.model.ConfigAllInfo;
/**
*

@ -1,8 +1,8 @@
package io.dtp.server.service.impl;
package io.dynamic.threadpool.server.service.impl;
import io.dtp.server.mapper.RowMapperManager;
import io.dtp.server.model.ConfigAllInfo;
import io.dtp.server.service.ConfigService;
import io.dynamic.threadpool.server.mapper.RowMapperManager;
import io.dynamic.threadpool.server.model.ConfigAllInfo;
import io.dynamic.threadpool.server.service.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

@ -0,0 +1,34 @@
package io.dynamic.threadpool.server.toolkit;
import cn.hutool.crypto.digest.DigestUtil;
import io.dynamic.threadpool.server.model.ConfigAllInfo;
/**
* Md5
*
* @author chen.ma
* @date 2021/6/21 18:32
*/
public class Md5ConfigUtil {
/**
* ThreadPool Md5
*
* @param config
* @return
*/
public String getTpContentMd5(ConfigAllInfo config) {
StringBuilder stringBuilder = new StringBuilder();
String targetStr = stringBuilder.append(config.getCoreSize())
.append(config.getMaxSize())
.append(config.getQueueType())
.append(config.getCapacity())
.append(config.getKeepAliveTime())
.append(config.getIsAlarm())
.append(config.getCapacityAlarm())
.append(config.getLivenessAlarm())
.toString();
return DigestUtil.md5Hex(targetStr);
}
}
Loading…
Cancel
Save