mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
[release] v3.1.2(Merge branch 'v3.1.2')
This commit is contained in:
commit
0e181ef7ec
@ -10,11 +10,11 @@
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>powerjob-client</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.1.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<powerjob.common.version>3.1.1</powerjob.common.version>
|
||||
<powerjob.common.version>3.1.2</powerjob.common.version>
|
||||
<junit.version>5.6.1</junit.version>
|
||||
</properties>
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>powerjob-common</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.1.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>powerjob-server</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.1.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
<springboot.version>2.2.6.RELEASE</springboot.version>
|
||||
<powerjob.common.version>3.1.1</powerjob.common.version>
|
||||
<powerjob.common.version>3.1.2</powerjob.common.version>
|
||||
<mysql.version>8.0.19</mysql.version>
|
||||
<h2.db.version>1.4.200</h2.db.version>
|
||||
<zip4j.version>2.5.2</zip4j.version>
|
||||
|
@ -87,6 +87,7 @@ public class InstanceManager {
|
||||
// 综上,直接把 status 和 runningNum 同步到DB即可
|
||||
if (TimeExpressionType.frequentTypes.contains(timeExpressionType)) {
|
||||
|
||||
instanceInfo.setResult(req.getResult());
|
||||
instanceInfo.setRunningTimes(req.getTotalTaskNum());
|
||||
instanceInfoRepository.saveAndFlush(instanceInfo);
|
||||
return;
|
||||
|
@ -10,12 +10,12 @@
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>powerjob-worker-agent</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.1.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<properties>
|
||||
<powerjob.worker.version>3.1.1</powerjob.worker.version>
|
||||
<powerjob.worker.version>3.1.2</powerjob.worker.version>
|
||||
<logback.version>1.2.3</logback.version>
|
||||
<picocli.version>4.3.2</picocli.version>
|
||||
|
||||
|
@ -10,11 +10,11 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>powerjob-worker-samples</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.1.2</version>
|
||||
|
||||
<properties>
|
||||
<springboot.version>2.2.6.RELEASE</springboot.version>
|
||||
<powerjob.worker.version>3.1.1</powerjob.worker.version>
|
||||
<powerjob.worker.version>3.1.2</powerjob.worker.version>
|
||||
<fastjson.version>1.2.68</fastjson.version>
|
||||
|
||||
<!-- 部署时跳过该module -->
|
||||
|
@ -10,12 +10,12 @@
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>powerjob-worker</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.1.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<spring.version>5.2.4.RELEASE</spring.version>
|
||||
<powerjob.common.version>3.1.1</powerjob.common.version>
|
||||
<powerjob.common.version>3.1.2</powerjob.common.version>
|
||||
<h2.db.version>1.4.200</h2.db.version>
|
||||
<hikaricp.version>3.4.2</hikaricp.version>
|
||||
<junit.version>5.6.1</junit.version>
|
||||
|
@ -19,7 +19,7 @@ public class LRUCache<K, V> {
|
||||
public LRUCache(int cacheSize) {
|
||||
innerCache = CacheBuilder.newBuilder()
|
||||
.concurrencyLevel(2)
|
||||
.initialCapacity(cacheSize)
|
||||
.maximumSize(cacheSize)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ public class FrequentTaskTracker extends TaskTracker {
|
||||
|
||||
private static final int HISTORY_SIZE = 10;
|
||||
private static final String LAST_TASK_ID_PREFIX = "L";
|
||||
private static final int MIN_INTERVAL = 1000;
|
||||
|
||||
protected FrequentTaskTracker(ServerScheduleJobReq req) {
|
||||
super(req);
|
||||
@ -89,6 +90,10 @@ public class FrequentTaskTracker extends TaskTracker {
|
||||
// 2. 启动任务发射器
|
||||
launcher = new Launcher();
|
||||
if (timeExpressionType == TimeExpressionType.FIX_RATE) {
|
||||
// 固定频率需要设置最小间隔
|
||||
if (timeParams < MIN_INTERVAL) {
|
||||
throw new OmsException("time interval too small, please set the timeExpressionInfo >= 1000");
|
||||
}
|
||||
scheduledPool.scheduleAtFixedRate(launcher, 1, timeParams, TimeUnit.MILLISECONDS);
|
||||
}else {
|
||||
scheduledPool.schedule(launcher, 0, TimeUnit.MILLISECONDS);
|
||||
@ -97,8 +102,7 @@ public class FrequentTaskTracker extends TaskTracker {
|
||||
// 3. 启动任务分发器(事实上,秒级任务应该都是单机任务,且感觉不需要失败重试机制,那么 Dispatcher 的存在就有点浪费系统资源了...)
|
||||
scheduledPool.scheduleWithFixedDelay(new Dispatcher(), 1, 2, TimeUnit.SECONDS);
|
||||
// 4. 启动状态检查器
|
||||
scheduledPool.scheduleWithFixedDelay(new Checker(), 5000, Math.min(timeParams, 10000), TimeUnit.MILLISECONDS);
|
||||
|
||||
scheduledPool.scheduleWithFixedDelay(new Checker(), 5000, Math.min(Math.max(timeParams, 5000), 15000), TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -213,6 +217,11 @@ public class FrequentTaskTracker extends TaskTracker {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (finished.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
checkStatus();
|
||||
reportStatus();
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.github.kfcfans.powerjob.function;
|
||||
|
||||
import com.github.kfcfans.powerjob.worker.common.utils.LRUCache;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* LRU cache test
|
||||
*
|
||||
* @author tjq
|
||||
* @since 2020/6/26
|
||||
*/
|
||||
public class LRUCacheTest {
|
||||
|
||||
@Test
|
||||
public void testCache() {
|
||||
LRUCache<Long, String> cache = new LRUCache<>(10);
|
||||
for (long i = 0; i < 100; i++) {
|
||||
cache.put(i, "STR:" + i);
|
||||
}
|
||||
cache.forEach((x, y) -> System.out.println("key:" + x));
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user