Merge branch '5.1.0-bugfix'

This commit is contained in:
tjq 2024-10-31 00:23:52 +08:00
commit 0bb069fa5b
27 changed files with 100 additions and 88 deletions

View File

@ -6,7 +6,7 @@
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<artifactId>powerjob</artifactId> <artifactId>powerjob</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>powerjob</name> <name>powerjob</name>
<url>http://www.powerjob.tech</url> <url>http://www.powerjob.tech</url>

View File

@ -5,19 +5,19 @@
<parent> <parent>
<artifactId>powerjob</artifactId> <artifactId>powerjob</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-client</artifactId> <artifactId>powerjob-client</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<junit.version>5.9.1</junit.version> <junit.version>5.9.1</junit.version>
<logback.version>1.2.13</logback.version> <logback.version>1.2.13</logback.version>
<fastjson.version>1.2.83</fastjson.version> <fastjson.version>1.2.83</fastjson.version>
<powerjob.common.version>5.1.0</powerjob.common.version> <powerjob.common.version>5.1.0-bugfix</powerjob.common.version>
<mvn.shade.plugin.version>3.2.4</mvn.shade.plugin.version> <mvn.shade.plugin.version>3.2.4</mvn.shade.plugin.version>
</properties> </properties>

View File

@ -5,12 +5,12 @@
<parent> <parent>
<artifactId>powerjob</artifactId> <artifactId>powerjob</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-common</artifactId> <artifactId>powerjob-common</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>

View File

@ -5,12 +5,12 @@
<parent> <parent>
<artifactId>powerjob</artifactId> <artifactId>powerjob</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-official-processors</artifactId> <artifactId>powerjob-official-processors</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
@ -20,7 +20,7 @@
<!-- 不会被打包的部分scope 只能是 test 或 provide --> <!-- 不会被打包的部分scope 只能是 test 或 provide -->
<junit.version>5.9.1</junit.version> <junit.version>5.9.1</junit.version>
<logback.version>1.2.13</logback.version> <logback.version>1.2.13</logback.version>
<powerjob.worker.version>5.1.0</powerjob.worker.version> <powerjob.worker.version>5.1.0-bugfix</powerjob.worker.version>
<h2.db.version>2.2.224</h2.db.version> <h2.db.version>2.2.224</h2.db.version>
<mysql.version>8.0.28</mysql.version> <mysql.version>8.0.28</mysql.version>
<spring.version>5.3.31</spring.version> <spring.version>5.3.31</spring.version>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>powerjob</artifactId> <artifactId>powerjob</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging> <packaging>pom</packaging>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>powerjob-remote</artifactId> <artifactId>powerjob-remote</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -21,8 +21,8 @@
<logback.version>1.2.13</logback.version> <logback.version>1.2.13</logback.version>
<springboot.version>2.7.18</springboot.version> <springboot.version>2.7.18</springboot.version>
<powerjob-remote-impl-http.version>5.1.0</powerjob-remote-impl-http.version> <powerjob-remote-impl-http.version>5.1.0-bugfix</powerjob-remote-impl-http.version>
<powerjob-remote-impl-akka.version>5.1.0</powerjob-remote-impl-akka.version> <powerjob-remote-impl-akka.version>5.1.0-bugfix</powerjob-remote-impl-akka.version>
<gatling.version>3.9.0</gatling.version> <gatling.version>3.9.0</gatling.version>
<gatling-maven-plugin.version>4.2.9</gatling-maven-plugin.version> <gatling-maven-plugin.version>4.2.9</gatling-maven-plugin.version>

View File

@ -5,11 +5,11 @@
<parent> <parent>
<artifactId>powerjob-remote</artifactId> <artifactId>powerjob-remote</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<artifactId>powerjob-remote-framework</artifactId> <artifactId>powerjob-remote-framework</artifactId>
<properties> <properties>
@ -17,7 +17,7 @@
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<powerjob-common.version>5.1.0</powerjob-common.version> <powerjob-common.version>5.1.0-bugfix</powerjob-common.version>
<reflections.version>0.10.2</reflections.version> <reflections.version>0.10.2</reflections.version>

View File

@ -5,19 +5,19 @@
<parent> <parent>
<artifactId>powerjob-remote</artifactId> <artifactId>powerjob-remote</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-remote-impl-akka</artifactId> <artifactId>powerjob-remote-impl-akka</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<powerjob-remote-framework.version>5.1.0</powerjob-remote-framework.version> <powerjob-remote-framework.version>5.1.0-bugfix</powerjob-remote-framework.version>
<akka.version>2.6.13</akka.version> <akka.version>2.6.13</akka.version>
</properties> </properties>

View File

@ -5,12 +5,12 @@
<parent> <parent>
<artifactId>powerjob-remote</artifactId> <artifactId>powerjob-remote</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-remote-impl-http</artifactId> <artifactId>powerjob-remote-impl-http</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
@ -18,7 +18,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vertx.version>4.3.7</vertx.version> <vertx.version>4.3.7</vertx.version>
<powerjob-remote-framework.version>5.1.0</powerjob-remote-framework.version> <powerjob-remote-framework.version>5.1.0-bugfix</powerjob-remote-framework.version>
</properties> </properties>
<dependencies> <dependencies>

View File

@ -5,12 +5,12 @@
<parent> <parent>
<artifactId>powerjob</artifactId> <artifactId>powerjob</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
@ -51,9 +51,9 @@
<groovy.version>3.0.10</groovy.version> <groovy.version>3.0.10</groovy.version>
<cron-utils.version>9.2.1</cron-utils.version> <cron-utils.version>9.2.1</cron-utils.version>
<powerjob-common.version>5.1.0</powerjob-common.version> <powerjob-common.version>5.1.0-bugfix</powerjob-common.version>
<powerjob-remote-impl-http.version>5.1.0</powerjob-remote-impl-http.version> <powerjob-remote-impl-http.version>5.1.0-bugfix</powerjob-remote-impl-http.version>
<powerjob-remote-impl-akka.version>5.1.0</powerjob-remote-impl-akka.version> <powerjob-remote-impl-akka.version>5.1.0-bugfix</powerjob-remote-impl-akka.version>
<springdoc-openapi-ui.version>1.6.14</springdoc-openapi-ui.version> <springdoc-openapi-ui.version>1.6.14</springdoc-openapi-ui.version>
<aliyun-sdk-oss.version>3.17.1</aliyun-sdk-oss.version> <aliyun-sdk-oss.version>3.17.1</aliyun-sdk-oss.version>
<aws-java-sdk-s3.version>1.12.665</aws-java-sdk-s3.version> <aws-java-sdk-s3.version>1.12.665</aws-java-sdk-s3.version>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -15,32 +15,24 @@ import org.apache.commons.lang3.time.DateUtils;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Conditional;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import tech.powerjob.common.enums.SwitchableStatus;
import tech.powerjob.common.serialize.JsonUtils; import tech.powerjob.common.serialize.JsonUtils;
import tech.powerjob.common.utils.CommonUtils; import tech.powerjob.common.utils.CommonUtils;
import tech.powerjob.common.enums.SwitchableStatus;
import tech.powerjob.server.common.spring.condition.PropertyAndOneBeanCondition; import tech.powerjob.server.common.spring.condition.PropertyAndOneBeanCondition;
import tech.powerjob.server.extension.dfs.DFsService; import tech.powerjob.server.extension.dfs.*;
import tech.powerjob.server.extension.dfs.DownloadRequest;
import tech.powerjob.server.extension.dfs.FileLocation;
import tech.powerjob.server.extension.dfs.FileMeta;
import tech.powerjob.server.extension.dfs.StoreRequest;
import tech.powerjob.server.persistence.storage.AbstractDFsService; import tech.powerjob.server.persistence.storage.AbstractDFsService;
import javax.annotation.Priority;
import javax.sql.DataSource;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.sql.Blob; import java.sql.*;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import javax.annotation.Priority;
import javax.sql.DataSource;
/** /**
* postgresql 数据库存储使用的版本是14 * postgresql 数据库存储使用的版本是14
@ -93,13 +85,13 @@ public class PostgresqlSeriesDfsService extends AbstractDFsService {
private static final String DEFAULT_TABLE_NAME = "powerjob_files"; private static final String DEFAULT_TABLE_NAME = "powerjob_files";
private static final String POWERJOB_FILES_ID_SEQ = "CREATE SEQUENCE powerjob_files_id_seq\n" + private static final String POWERJOB_FILES_ID_SEQ = "CREATE SEQUENCE if not exists powerjob_files_id_seq\n" +
" START WITH 1\n" + " START WITH 1\n" +
" INCREMENT BY 1\n" + " INCREMENT BY 1\n" +
" NO MINVALUE\n" + " NO MINVALUE\n" +
" NO MAXVALUE\n" + " NO MAXVALUE\n" +
" CACHE 1;" ; " CACHE 1;" ;
private static final String CREATE_TABLE_SQL = "CREATE TABLE powerjob_files (\n" + private static final String CREATE_TABLE_SQL = "CREATE TABLE if not exists powerjob_files (\n" +
" id bigint NOT NULL DEFAULT nextval('powerjob_files_id_seq') PRIMARY KEY,\n" + " id bigint NOT NULL DEFAULT nextval('powerjob_files_id_seq') PRIMARY KEY,\n" +
" bucket varchar(255) NOT NULL,\n" + " bucket varchar(255) NOT NULL,\n" +
" name varchar(255) NOT NULL,\n" + " name varchar(255) NOT NULL,\n" +
@ -160,7 +152,6 @@ public class PostgresqlSeriesDfsService extends AbstractDFsService {
con = dataSource.getConnection(); con = dataSource.getConnection();
//pg库提示报错org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode. //pg库提示报错org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode.
con.setAutoCommit(false); con.setAutoCommit(false);
log.info("[PostgresqlSeriesDfsService] set autocommit false.");
pst = con.prepareStatement(insertSQL); pst = con.prepareStatement(insertSQL);
@ -185,13 +176,12 @@ public class PostgresqlSeriesDfsService extends AbstractDFsService {
if(con != null){ if(con != null){
con.rollback(); con.rollback();
} }
log.error("[PostgresqlSeriesDfsService] store [{}] failed!", fileLocation); log.error("[PostgresqlSeriesDfsService] store [{}] failed!", fileLocation, e);
ExceptionUtils.rethrow(e); ExceptionUtils.rethrow(e);
}finally { }finally {
if(con != null){ if(con != null){
//设置回来恢复自动提交模式 //设置回来恢复自动提交模式
con.setAutoCommit(true); con.setAutoCommit(true);
log.info("[PostgresqlSeriesDfsService] set autocommit true.");
con.close(); con.close();
} }
if(null != pst){ if(null != pst){
@ -246,8 +236,17 @@ public class PostgresqlSeriesDfsService extends AbstractDFsService {
return; return;
} }
Blob dataBlob = resultSet.getBlob("data"); // PostgreSQL bytea 类型的数据并不直接映射为 JDBC Blob 类型相反bytea 数据应当被处理为字节数组 (byte[]) 而不是 Blob 对象
FileUtils.copyInputStreamToFile(new BufferedInputStream(dataBlob.getBinaryStream()), downloadRequest.getTarget()); try {
byte[] dataBytes = resultSet.getBytes("data");
try (FileOutputStream fos = new FileOutputStream(downloadRequest.getTarget())) {
fos.write(dataBytes);
}
} catch (Exception ignore) {
// 测试发现会报错 报错不良的类型值 long但并未有用户反馈问题暂时保留老写法可能是不同DB获取方式不同
Blob dataBlob = resultSet.getBlob("data");
FileUtils.copyInputStreamToFile(new BufferedInputStream(dataBlob.getBinaryStream()), downloadRequest.getTarget());
}
log.info("[PostgresqlSeriesDfsService] download [{}] successfully, cost: {}", fileLocation, sw); log.info("[PostgresqlSeriesDfsService] download [{}] successfully, cost: {}", fileLocation, sw);
@ -331,7 +330,7 @@ public class PostgresqlSeriesDfsService extends AbstractDFsService {
HikariConfig config = new HikariConfig(); HikariConfig config = new HikariConfig();
config.setDriverClassName(property.driver); config.setDriverClassName(StringUtils.isEmpty(property.driver) ? "org.postgresql.Driver" : property.driver);
config.setJdbcUrl(property.url); config.setJdbcUrl(property.url);
config.setUsername(property.username); config.setUsername(property.username);
config.setPassword(property.password); config.setPassword(property.password);
@ -404,4 +403,4 @@ public class PostgresqlSeriesDfsService extends AbstractDFsService {
return DFsService.class; return DFsService.class;
} }
} }
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -46,6 +46,7 @@ public class OpenApiInterceptor implements HandlerInterceptor {
public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler) throws Exception { public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler) throws Exception {
if (!enableOpenApiAuth) { if (!enableOpenApiAuth) {
response.addHeader(OpenAPIConstant.RESPONSE_HEADER_AUTH_STATUS, Boolean.TRUE.toString());
return true; return true;
} }

View File

@ -6,7 +6,7 @@ import tech.powerjob.common.model.SystemMetrics;
import tech.powerjob.common.utils.CommonUtils; import tech.powerjob.common.utils.CommonUtils;
import tech.powerjob.server.common.module.WorkerInfo; import tech.powerjob.server.common.module.WorkerInfo;
import java.text.DecimalFormat; import java.text.NumberFormat;
/** /**
* Worker机器状态 * Worker机器状态
@ -48,32 +48,40 @@ public class WorkerStatusVO {
* 27.7%(2.9/8.0 GB) * 27.7%(2.9/8.0 GB)
*/ */
private static final String OTHER_FORMAT = "%s%%%s / %s GB"; private static final String OTHER_FORMAT = "%s%%%s / %s GB";
private static final DecimalFormat df = new DecimalFormat("#.#");
private static final double THRESHOLD = 0.8; private static final double THRESHOLD = 0.8;
// 静态 NumberFormat 实例线程安全
private static final NumberFormat NUMBER_FORMAT;
// 静态初始化块配置 NumberFormat 的格式
static {
NUMBER_FORMAT = NumberFormat.getInstance();
// 设置最小小数位数为 0
NUMBER_FORMAT.setMinimumFractionDigits(0);
// 设置最大小数位数为 1
NUMBER_FORMAT.setMaximumFractionDigits(1);
}
public WorkerStatusVO(WorkerInfo workerInfo) { public WorkerStatusVO(WorkerInfo workerInfo) {
SystemMetrics systemMetrics = workerInfo.getSystemMetrics(); SystemMetrics systemMetrics = workerInfo.getSystemMetrics();
this.status = 1; this.status = 1;
this.address = workerInfo.getAddress(); this.address = workerInfo.getAddress();
this.cpuLoad = String.format(CPU_FORMAT, df.format(systemMetrics.getCpuLoad()), systemMetrics.getCpuProcessors()); this.cpuLoad = String.format(CPU_FORMAT, NUMBER_FORMAT.format(systemMetrics.getCpuLoad()), systemMetrics.getCpuProcessors());
if (systemMetrics.getCpuLoad() > systemMetrics.getCpuProcessors() * THRESHOLD) { if (systemMetrics.getCpuLoad() > systemMetrics.getCpuProcessors() * THRESHOLD) {
this.status ++; this.status ++;
} }
String menL = df.format(systemMetrics.getJvmMemoryUsage() * 100); String menL = NUMBER_FORMAT.format(systemMetrics.getJvmMemoryUsage() * 100);
String menUsed = df.format(systemMetrics.getJvmUsedMemory()); String menUsed = NUMBER_FORMAT.format(systemMetrics.getJvmUsedMemory());
String menMax = df.format(systemMetrics.getJvmMaxMemory()); String menMax = NUMBER_FORMAT.format(systemMetrics.getJvmMaxMemory());
this.memoryLoad = String.format(OTHER_FORMAT, menL, menUsed, menMax); this.memoryLoad = String.format(OTHER_FORMAT, menL, menUsed, menMax);
if (systemMetrics.getJvmMemoryUsage() > THRESHOLD) { if (systemMetrics.getJvmMemoryUsage() > THRESHOLD) {
this.status ++; this.status ++;
} }
String diskL = df.format(systemMetrics.getDiskUsage() * 100); String diskL = NUMBER_FORMAT.format(systemMetrics.getDiskUsage() * 100);
String diskUsed = df.format(systemMetrics.getDiskUsed()); String diskUsed = NUMBER_FORMAT.format(systemMetrics.getDiskUsed());
String diskMax = df.format(systemMetrics.getDiskTotal()); String diskMax = NUMBER_FORMAT.format(systemMetrics.getDiskTotal());
this.diskLoad = String.format(OTHER_FORMAT, diskL, diskUsed, diskMax); this.diskLoad = String.format(OTHER_FORMAT, diskL, diskUsed, diskMax);
if (systemMetrics.getDiskUsage() > THRESHOLD) { if (systemMetrics.getDiskUsage() > THRESHOLD) {
this.status ++; this.status ++;

View File

@ -5,24 +5,24 @@
<parent> <parent>
<artifactId>powerjob</artifactId> <artifactId>powerjob</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-worker-agent</artifactId> <artifactId>powerjob-worker-agent</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<powerjob.worker.version>5.1.0</powerjob.worker.version> <powerjob.worker.version>5.1.0-bugfix</powerjob.worker.version>
<logback.version>1.2.13</logback.version> <logback.version>1.2.13</logback.version>
<picocli.version>4.3.2</picocli.version> <picocli.version>4.3.2</picocli.version>
<spring.version>5.3.31</spring.version> <spring.version>5.3.31</spring.version>
<spring.boot.version>2.3.4.RELEASE</spring.boot.version> <spring.boot.version>2.3.4.RELEASE</spring.boot.version>
<powerjob.official.processors.version>5.1.0</powerjob.official.processors.version> <powerjob.official.processors.version>5.1.0-bugfix</powerjob.official.processors.version>
<!-- dependency for dynamic sql processor --> <!-- dependency for dynamic sql processor -->
<mysql.version>8.0.28</mysql.version> <mysql.version>8.0.28</mysql.version>

View File

@ -12,6 +12,9 @@ import picocli.CommandLine;
import picocli.CommandLine.Command; import picocli.CommandLine.Command;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;
import java.util.ArrayList;
import java.util.List;
/** /**
* powerjob-worker-agent entry * powerjob-worker-agent entry
* *
@ -56,7 +59,8 @@ public class MainApplication implements Runnable {
cfg.setAppName(appName); cfg.setAppName(appName);
cfg.setPort(port); cfg.setPort(port);
cfg.setServerAddress(Splitter.on(",").splitToList(server)); List<String> servers = new ArrayList<>(Splitter.on(",").splitToList(server));
cfg.setServerAddress(servers);
cfg.setStoreStrategy(StoreStrategy.MEMORY.name().equals(storeStrategy) ? StoreStrategy.MEMORY : StoreStrategy.DISK); cfg.setStoreStrategy(StoreStrategy.MEMORY.name().equals(storeStrategy) ? StoreStrategy.MEMORY : StoreStrategy.DISK);
cfg.setMaxResultLength(length); cfg.setMaxResultLength(length);
cfg.setTag(tag); cfg.setTag(tag);

View File

@ -5,22 +5,22 @@
<parent> <parent>
<artifactId>powerjob</artifactId> <artifactId>powerjob</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-worker-samples</artifactId> <artifactId>powerjob-worker-samples</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<properties> <properties>
<springboot.version>2.7.18</springboot.version> <springboot.version>2.7.18</springboot.version>
<powerjob.worker.starter.version>5.1.0</powerjob.worker.starter.version> <powerjob.worker.starter.version>5.1.0-bugfix</powerjob.worker.starter.version>
<fastjson.version>1.2.83</fastjson.version> <fastjson.version>1.2.83</fastjson.version>
<powerjob.official.processors.version>5.1.0</powerjob.official.processors.version> <powerjob.official.processors.version>5.1.0-bugfix</powerjob.official.processors.version>
<!-- 部署时跳过该module --> <!-- 部署时跳过该module -->
<maven.deploy.skip>true</maven.deploy.skip> <maven.deploy.skip>true</maven.deploy.skip>
<powerjob-client.version>5.1.0</powerjob-client.version> <powerjob-client.version>5.1.0-bugfix</powerjob-client.version>
</properties> </properties>
<dependencies> <dependencies>

View File

@ -5,16 +5,16 @@
<parent> <parent>
<artifactId>powerjob</artifactId> <artifactId>powerjob</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-worker-spring-boot-starter</artifactId> <artifactId>powerjob-worker-spring-boot-starter</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<powerjob.worker.version>5.1.0</powerjob.worker.version> <powerjob.worker.version>5.1.0-bugfix</powerjob.worker.version>
<springboot.version>2.7.18</springboot.version> <springboot.version>2.7.18</springboot.version>
</properties> </properties>

View File

@ -5,12 +5,12 @@
<parent> <parent>
<artifactId>powerjob</artifactId> <artifactId>powerjob</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-worker</artifactId> <artifactId>powerjob-worker</artifactId>
<version>5.1.0</version> <version>5.1.0-bugfix</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
@ -21,10 +21,10 @@
<logback.version>1.2.13</logback.version> <logback.version>1.2.13</logback.version>
<powerjob-common.version>5.1.0</powerjob-common.version> <powerjob-common.version>5.1.0-bugfix</powerjob-common.version>
<powerjob-remote-framework.version>5.1.0</powerjob-remote-framework.version> <powerjob-remote-framework.version>5.1.0-bugfix</powerjob-remote-framework.version>
<powerjob-remote-impl-akka.version>5.1.0</powerjob-remote-impl-akka.version> <powerjob-remote-impl-akka.version>5.1.0-bugfix</powerjob-remote-impl-akka.version>
<powerjob-remote-impl-http.version>5.1.0</powerjob-remote-impl-http.version> <powerjob-remote-impl-http.version>5.1.0-bugfix</powerjob-remote-impl-http.version>
</properties> </properties>
<dependencies> <dependencies>