Explorar o código

:bookmark: Releasing / Version tags. 2.6.0 . 鄙视某些人的分享/盗窃,持续开源!

冷冷 %!s(int64=6) %!d(string=hai) anos
pai
achega
910739c090
Modificáronse 36 ficheiros con 201 adicións e 130 borrados
  1. 1 1
      docker-compose.yml
  2. 1 1
      pigx-auth/pom.xml
  3. 1 1
      pigx-common/pigx-common-bom/pom.xml
  4. 1 1
      pigx-common/pigx-common-core/pom.xml
  5. 1 1
      pigx-common/pigx-common-data/pom.xml
  6. 1 1
      pigx-common/pigx-common-gateway/pom.xml
  7. 1 1
      pigx-common/pigx-common-job/pom.xml
  8. 1 1
      pigx-common/pigx-common-log/pom.xml
  9. 1 1
      pigx-common/pigx-common-minio/pom.xml
  10. 1 1
      pigx-common/pigx-common-security/pom.xml
  11. 2 9
      pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/annotation/EnablePigxResourceServer.java
  12. 3 52
      pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxResourceServerConfigurerAdapter.java
  13. 0 10
      pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxSecurityBeanDefinitionRegistrar.java
  14. 93 0
      pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxUserAuthenticationConverter.java
  15. 1 1
      pigx-common/pigx-common-swagger/pom.xml
  16. 1 1
      pigx-common/pigx-common-transaction/pom.xml
  17. 1 1
      pigx-common/pom.xml
  18. 1 1
      pigx-config/pom.xml
  19. 1 1
      pigx-eureka/pom.xml
  20. 1 1
      pigx-gateway/pom.xml
  21. 1 1
      pigx-upms/pigx-upms-api/pom.xml
  22. 1 1
      pigx-upms/pigx-upms-biz/pom.xml
  23. 1 1
      pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/PigxAdminApplication.java
  24. 1 1
      pigx-upms/pom.xml
  25. 1 1
      pigx-visual/pigx-activiti/pom.xml
  26. 1 1
      pigx-visual/pigx-codegen/pom.xml
  27. 1 1
      pigx-visual/pigx-daemon/pom.xml
  28. 2 2
      pigx-visual/pigx-monitor/pom.xml
  29. 1 1
      pigx-visual/pigx-sso-client-demo/pom.xml
  30. 1 1
      pigx-visual/pigx-tx-manager/pom.xml
  31. 2 3
      pigx-visual/pigx-tx-manager/src/main/java/com/pig4cloud/pigx/manager/compensate/service/impl/CompensateServiceImpl.java
  32. 53 0
      pigx-visual/pigx-tx-manager/src/main/java/com/pig4cloud/pigx/manager/config/ExecutorConfig.java
  33. 18 26
      pigx-visual/pigx-tx-manager/src/main/java/com/pig4cloud/pigx/manager/netty/service/impl/NettyServerServiceImpl.java
  34. 1 1
      pigx-visual/pigx-zipkin/pom.xml
  35. 1 1
      pigx-visual/pom.xml
  36. 1 1
      pom.xml

+ 1 - 1
docker-compose.yml

@@ -1,4 +1,4 @@
-# 使用说明 V2.1.0
+# 使用说明 V2.6.0
 # 1. 使用docker-compose  宿主机不需要配置host来发现
 # 2. 无需修改源码,根目录  docker-compose up 即可
 # 3. 静静等待服务启动

+ 1 - 1
pigx-auth/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-auth</artifactId>

+ 1 - 1
pigx-common/pigx-common-bom/pom.xml

@@ -16,7 +16,7 @@
 	<description>pigx 公共版本控制</description>
 
 	<properties>
-		<pigx.version>2.5.1</pigx.version>
+		<pigx.version>2.6.0</pigx.version>
 		<jackson.modules>2.9.6</jackson.modules>
 		<mybatis-plus.version>3.1.0</mybatis-plus.version>
 		<mysql.connector.version>8.0.13</mysql.connector.version>

+ 1 - 1
pigx-common/pigx-common-core/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-common</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-common-core</artifactId>

+ 1 - 1
pigx-common/pigx-common-data/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-common</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-common-data</artifactId>

+ 1 - 1
pigx-common/pigx-common-gateway/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-common</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-common-gateway</artifactId>

+ 1 - 1
pigx-common/pigx-common-job/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-common</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-common-job</artifactId>

+ 1 - 1
pigx-common/pigx-common-log/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-common</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-common-log</artifactId>

+ 1 - 1
pigx-common/pigx-common-minio/pom.xml

@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-common</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-common-minio</artifactId>

+ 1 - 1
pigx-common/pigx-common-security/pom.xml

@@ -23,7 +23,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-common</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-common-security</artifactId>

+ 2 - 9
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/annotation/EnablePigxResourceServer.java

@@ -31,20 +31,13 @@ import java.lang.annotation.*;
  * <p>
  * 资源服务注解
  */
-@Target({ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
 @Documented
 @Inherited
 @EnableResourceServer
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
 @EnableGlobalMethodSecurity(prePostEnabled = true)
 @Import({PigxResourceServerAutoConfiguration.class, PigxSecurityBeanDefinitionRegistrar.class})
 public @interface EnablePigxResourceServer {
 
-	/**
-	 * false:上下文获取用户名
-	 * true: 上下文获取全部用户信息
-	 *
-	 * @return
-	 */
-	boolean details() default false;
 }

+ 3 - 52
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxResourceServerConfigurerAdapter.java

@@ -17,18 +17,16 @@
 
 package com.pig4cloud.pigx.common.security.component;
 
-import lombok.Setter;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
 import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
-import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
 import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
 import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter;
-import org.springframework.security.oauth2.provider.token.DefaultUserAuthenticationConverter;
 import org.springframework.security.oauth2.provider.token.RemoteTokenServices;
+import org.springframework.security.oauth2.provider.token.UserAuthenticationConverter;
 import org.springframework.web.client.RestTemplate;
 
 /**
@@ -45,13 +43,9 @@ public class PigxResourceServerConfigurerAdapter extends ResourceServerConfigure
 	@Autowired
 	protected RemoteTokenServices remoteTokenServices;
 	@Autowired
-	protected UserDetailsService userDetailsService;
-	@Autowired
 	private PermitAllUrlProperties permitAllUrlProperties;
 	@Autowired
 	private RestTemplate lbRestTemplate;
-	@Setter
-	private boolean details;
 
 	/**
 	 * 默认的配置,对外暴露
@@ -72,58 +66,15 @@ public class PigxResourceServerConfigurerAdapter extends ResourceServerConfigure
 			.and().csrf().disable();
 	}
 
-	/**
-	 * 提供子类重写
-	 * <p>
-	 * 1. 不重写,默认支持获取用户名
-	 * 2. 重写notGetUser,提供性能
-	 * <p>
-	 * see codegen ResourceServerConfigurer
-	 *
-	 * @param resources
-	 */
 	@Override
 	public void configure(ResourceServerSecurityConfigurer resources) {
-		if (details) {
-			canGetUser(resources);
-		} else {
-			notGetUser(resources);
-		}
-	}
-
-
-	/**
-	 * 不获取用户详细 只有用户名
-	 *
-	 * @param resources
-	 */
-	protected void notGetUser(ResourceServerSecurityConfigurer resources) {
 		DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter();
-		DefaultUserAuthenticationConverter userTokenConverter = new DefaultUserAuthenticationConverter();
+		UserAuthenticationConverter userTokenConverter = new PigxUserAuthenticationConverter();
 		accessTokenConverter.setUserTokenConverter(userTokenConverter);
 
 		remoteTokenServices.setRestTemplate(lbRestTemplate);
 		remoteTokenServices.setAccessTokenConverter(accessTokenConverter);
 		resources.authenticationEntryPoint(resourceAuthExceptionEntryPoint)
-			.tokenServices(remoteTokenServices);
+				.tokenServices(remoteTokenServices);
 	}
-
-
-	/**
-	 * 上下文中获取用户全部信息,两次调用userDetailsService,影响性能
-	 *
-	 * @param resources
-	 */
-	private void canGetUser(ResourceServerSecurityConfigurer resources) {
-		DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter();
-		DefaultUserAuthenticationConverter userTokenConverter = new DefaultUserAuthenticationConverter();
-		userTokenConverter.setUserDetailsService(userDetailsService);
-		accessTokenConverter.setUserTokenConverter(userTokenConverter);
-
-		remoteTokenServices.setRestTemplate(lbRestTemplate);
-		remoteTokenServices.setAccessTokenConverter(accessTokenConverter);
-		resources.authenticationEntryPoint(resourceAuthExceptionEntryPoint)
-			.tokenServices(remoteTokenServices);
-	}
-
 }

+ 0 - 10
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxSecurityBeanDefinitionRegistrar.java

@@ -18,16 +18,12 @@
 package com.pig4cloud.pigx.common.security.component;
 
 import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
-import com.pig4cloud.pigx.common.security.annotation.EnablePigxResourceServer;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.MutablePropertyValues;
 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 import org.springframework.beans.factory.support.GenericBeanDefinition;
 import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
 import org.springframework.core.type.AnnotationMetadata;
 
-import java.util.Map;
-
 /**
  * @author lengleng
  * @date 2018-11-24
@@ -49,12 +45,6 @@ public class PigxSecurityBeanDefinitionRegistrar implements ImportBeanDefinition
 
 		GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
 		beanDefinition.setBeanClass(PigxResourceServerConfigurerAdapter.class);
-		MutablePropertyValues mpv = new MutablePropertyValues();
-		Map<String, Object> annotationAttributes = metadata.getAnnotationAttributes(
-			EnablePigxResourceServer.class.getName());
-		Object details = annotationAttributes.get("details");
-		mpv.add("details", details);
-		beanDefinition.setPropertyValues(mpv);
 		registry.registerBeanDefinition(SecurityConstants.RESOURCE_SERVER_CONFIGURER, beanDefinition);
 
 	}

+ 93 - 0
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxUserAuthenticationConverter.java

@@ -0,0 +1,93 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+package com.pig4cloud.pigx.common.security.component;
+
+import com.pig4cloud.pigx.common.security.service.PigxUser;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.AuthorityUtils;
+import org.springframework.security.oauth2.provider.token.UserAuthenticationConverter;
+import org.springframework.util.StringUtils;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author lengleng
+ * @date 2019-03-07
+ * <p>
+ * 根据checktoken 的结果转化用户信息
+ */
+public class PigxUserAuthenticationConverter implements UserAuthenticationConverter {
+	private static final String USER_ID = "user_id";
+	private static final String DEPT_ID = "dept_id";
+	private static final String TENANT_ID = "tenant_id";
+	private static final String N_A = "N/A";
+
+	/**
+	 * Extract information about the user to be used in an access token (i.e. for resource servers).
+	 *
+	 * @param authentication an authentication representing a user
+	 * @return a map of key values representing the unique information about the user
+	 */
+	@Override
+	public Map<String, ?> convertUserAuthentication(Authentication authentication) {
+		Map<String, Object> response = new LinkedHashMap<>();
+		response.put(USERNAME, authentication.getName());
+		if (authentication.getAuthorities() != null && !authentication.getAuthorities().isEmpty()) {
+			response.put(AUTHORITIES, AuthorityUtils.authorityListToSet(authentication.getAuthorities()));
+		}
+		return response;
+	}
+
+	/**
+	 * Inverse of {@link #convertUserAuthentication(Authentication)}. Extracts an Authentication from a map.
+	 *
+	 * @param map a map of user information
+	 * @return an Authentication representing the user or null if there is none
+	 */
+	@Override
+	public Authentication extractAuthentication(Map<String, ?> map) {
+		if (map.containsKey(USERNAME)) {
+			Collection<? extends GrantedAuthority> authorities = getAuthorities(map);
+
+			String username = (String) map.get(USERNAME);
+			Integer id = (Integer) map.get(USER_ID);
+			Integer deptId = (Integer) map.get(DEPT_ID);
+			Integer tenantId = (Integer) map.get(TENANT_ID);
+			PigxUser user = new PigxUser(id, deptId, tenantId, username, N_A, true
+					, true, true, true, authorities);
+			return new UsernamePasswordAuthenticationToken(user, N_A, authorities);
+		}
+		return null;
+	}
+
+	private Collection<? extends GrantedAuthority> getAuthorities(Map<String, ?> map) {
+		Object authorities = map.get(AUTHORITIES);
+		if (authorities instanceof String) {
+			return AuthorityUtils.commaSeparatedStringToAuthorityList((String) authorities);
+		}
+		if (authorities instanceof Collection) {
+			return AuthorityUtils.commaSeparatedStringToAuthorityList(StringUtils
+					.collectionToCommaDelimitedString((Collection<?>) authorities));
+		}
+		throw new IllegalArgumentException("Authorities must be either a String or a Collection");
+	}
+}

+ 1 - 1
pigx-common/pigx-common-swagger/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-common</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-common-swagger</artifactId>

+ 1 - 1
pigx-common/pigx-common-transaction/pom.xml

@@ -5,7 +5,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-common</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-common-transaction</artifactId>

+ 1 - 1
pigx-common/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-common</artifactId>

+ 1 - 1
pigx-config/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-config</artifactId>

+ 1 - 1
pigx-eureka/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-eureka</artifactId>

+ 1 - 1
pigx-gateway/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-gateway</artifactId>

+ 1 - 1
pigx-upms/pigx-upms-api/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-upms</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-upms-api</artifactId>

+ 1 - 1
pigx-upms/pigx-upms-biz/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-upms</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-upms-biz</artifactId>

+ 1 - 1
pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/PigxAdminApplication.java

@@ -34,7 +34,7 @@ import org.springframework.cloud.client.SpringCloudApplication;
 @EnablePigxSwagger2
 @SpringCloudApplication
 @EnablePigxFeignClients
-@EnablePigxResourceServer(details = true)
+@EnablePigxResourceServer
 public class PigxAdminApplication {
 	public static void main(String[] args) {
 		SpringApplication.run(PigxAdminApplication.class, args);

+ 1 - 1
pigx-upms/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-upms</artifactId>

+ 1 - 1
pigx-visual/pigx-activiti/pom.xml

@@ -23,7 +23,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-visual</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-activiti</artifactId>

+ 1 - 1
pigx-visual/pigx-codegen/pom.xml

@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-visual</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-codegen</artifactId>

+ 1 - 1
pigx-visual/pigx-daemon/pom.xml

@@ -23,7 +23,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-visual</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-daemon</artifactId>

+ 2 - 2
pigx-visual/pigx-monitor/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-visual</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-monitor</artifactId>
@@ -36,7 +36,7 @@
 		<dependency>
 			<groupId>com.pig4cloud</groupId>
 			<artifactId>pigx-common-core</artifactId>
-			<version>2.5.1</version>
+			<version>2.6.0</version>
 		</dependency>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>

+ 1 - 1
pigx-visual/pigx-sso-client-demo/pom.xml

@@ -29,7 +29,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-visual</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<dependencies>

+ 1 - 1
pigx-visual/pigx-tx-manager/pom.xml

@@ -5,7 +5,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx-visual</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-tx-manager</artifactId>

+ 2 - 3
pigx-visual/pigx-tx-manager/src/main/java/com/pig4cloud/pigx/manager/compensate/service/impl/CompensateServiceImpl.java

@@ -45,7 +45,6 @@ import org.springframework.stereotype.Service;
 
 import java.util.*;
 import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
 
 /**
  * @author LCN on 2017/11/11
@@ -68,8 +67,8 @@ public class CompensateServiceImpl implements CompensateService {
 	@Autowired
 	private TxManagerService managerService;
 
-
-	private Executor threadPool = Executors.newFixedThreadPool(20);
+	@Autowired
+	private Executor threadPool;
 
 	@Override
 	public boolean saveCompensateMsg(final TransactionCompensateMsg transactionCompensateMsg) {

+ 53 - 0
pigx-visual/pigx-tx-manager/src/main/java/com/pig4cloud/pigx/manager/config/ExecutorConfig.java

@@ -0,0 +1,53 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+package com.pig4cloud.pigx.manager.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * @author lengleng
+ * @date 2019-03-07
+ * <p>
+ * LCN线程池配置
+ */
+@Configuration
+public class ExecutorConfig {
+	private static final String LCN_SERVICE = "lcn-service-";
+
+	@Bean
+	public Executor threadPoolTaskExecutor() {
+		ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+		//配置核心线程数
+		executor.setCorePoolSize(10);
+		//配置最大线程数
+		executor.setMaxPoolSize(50);
+		//配置队列大小
+		executor.setQueueCapacity(99999);
+		//配置线程池中的线程的名称前缀
+		executor.setThreadNamePrefix(LCN_SERVICE);
+		executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+		//执行初始化
+		executor.initialize();
+		return executor;
+	}
+}

+ 18 - 26
pigx-visual/pigx-tx-manager/src/main/java/com/pig4cloud/pigx/manager/netty/service/impl/NettyServerServiceImpl.java

@@ -40,29 +40,22 @@ import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
+import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
 
 /**
- *@author LCN on 2017/6/30.
+ * @author LCN on 2017/6/30.
  */
 @Service
 public class NettyServerServiceImpl implements NettyServerService, DisposableBean {
-
-
-	@Autowired
-	private NettyService nettyService;
-
 	private Logger logger = LoggerFactory.getLogger(NettyServerServiceImpl.class);
-
 	private EventLoopGroup bossGroup;
 	private EventLoopGroup workerGroup;
-
 	private TxCoreServerHandler txCoreServerHandler;
-
-	private ExecutorService threadPool = Executors.newFixedThreadPool(100);
-
+	@Autowired
+	private NettyService nettyService;
+	@Autowired
+	private Executor threadPool;
 	@Autowired
 	private ConfigReader configReader;
 
@@ -76,20 +69,20 @@ public class NettyServerServiceImpl implements NettyServerService, DisposableBea
 		try {
 			ServerBootstrap b = new ServerBootstrap();
 			b.group(bossGroup, workerGroup)
-				.channel(NioServerSocketChannel.class)
-				.option(ChannelOption.SO_BACKLOG, 100)
-				.handler(new LoggingHandler(LogLevel.INFO))
-				.childHandler(new ChannelInitializer<SocketChannel>() {
-					@Override
-					public void initChannel(SocketChannel ch) {
-						ch.pipeline().addLast("timeout", new IdleStateHandler(heartTime, heartTime, heartTime, TimeUnit.SECONDS));
+					.channel(NioServerSocketChannel.class)
+					.option(ChannelOption.SO_BACKLOG, 100)
+					.handler(new LoggingHandler(LogLevel.INFO))
+					.childHandler(new ChannelInitializer<SocketChannel>() {
+						@Override
+						public void initChannel(SocketChannel ch) {
+							ch.pipeline().addLast("timeout", new IdleStateHandler(heartTime, heartTime, heartTime, TimeUnit.SECONDS));
 
-						ch.pipeline().addLast(new LengthFieldPrepender(4, false));
-						ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4));
+							ch.pipeline().addLast(new LengthFieldPrepender(4, false));
+							ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4));
 
-						ch.pipeline().addLast(txCoreServerHandler);
-					}
-				});
+							ch.pipeline().addLast(txCoreServerHandler);
+						}
+					});
 
 			// Start the server.
 			b.bind(Constants.socketPort);
@@ -115,6 +108,5 @@ public class NettyServerServiceImpl implements NettyServerService, DisposableBea
 	@Override
 	public void destroy() {
 		close();
-		threadPool.shutdown();
 	}
 }

+ 1 - 1
pigx-visual/pigx-zipkin/pom.xml

@@ -22,7 +22,7 @@
 	<parent>
 		<artifactId>pigx-visual</artifactId>
 		<groupId>com.pig4cloud</groupId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 	<modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
pigx-visual/pom.xml

@@ -24,7 +24,7 @@
 	<parent>
 		<groupId>com.pig4cloud</groupId>
 		<artifactId>pigx</artifactId>
-		<version>2.5.1</version>
+		<version>2.6.0</version>
 	</parent>
 
 	<artifactId>pigx-visual</artifactId>

+ 1 - 1
pom.xml

@@ -24,7 +24,7 @@
 
 	<groupId>com.pig4cloud</groupId>
 	<artifactId>pigx</artifactId>
-	<version>2.5.1</version>
+	<version>2.6.0</version>
 	<name>${project.artifactId}</name>
 	<packaging>pom</packaging>
 	<organization>