Improve the dynamic registration thread pool logic

pull/512/head
chen.ma 2 years ago
parent 840e9bdab4
commit d0552f2d05

@ -17,6 +17,7 @@
package cn.hippo4j.common.model; package cn.hippo4j.common.model;
import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -50,6 +51,7 @@ public class ThreadPoolParameterInfo implements ThreadPoolParameter, Serializabl
/** /**
* Thread-pool id * Thread-pool id
*/ */
@JsonAlias("threadPoolId")
private String tpId; private String tpId;
/** /**
@ -112,6 +114,7 @@ public class ThreadPoolParameterInfo implements ThreadPoolParameter, Serializabl
/** /**
* Liveness alarm * Liveness alarm
*/ */
@JsonAlias("activeAlarm")
private Integer livenessAlarm; private Integer livenessAlarm;
/** /**

@ -103,4 +103,8 @@ public class DynamicThreadPoolRegisterParameter {
* Execute timeout * Execute timeout
*/ */
private Long executeTimeOut; private Long executeTimeOut;
public Integer getAllowCoreThreadTimeOut() {
return this.allowCoreThreadTimeOut ? 1 : 0;
}
} }

@ -159,7 +159,7 @@ public class ConfigServiceImpl implements ConfigService {
configAllInfo.setTenantId(registerWrapper.getTenantId()); configAllInfo.setTenantId(registerWrapper.getTenantId());
configAllInfo.setItemId(registerWrapper.getItemId()); configAllInfo.setItemId(registerWrapper.getItemId());
configAllInfo.setTpId(registerParameter.getThreadPoolId()); configAllInfo.setTpId(registerParameter.getThreadPoolId());
configAllInfo.setAllowCoreThreadTimeOut(registerParameter.getAllowCoreThreadTimeOut() ? 1 : 0); configAllInfo.setAllowCoreThreadTimeOut(registerParameter.getAllowCoreThreadTimeOut());
return configAllInfo; return configAllInfo;
} }

Loading…
Cancel
Save