WangHan
2024-09-12 d5855a4926926698b740bc6c7ba489de47adb68b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package tech.powerjob.worker.common;
 
import org.apache.commons.lang3.StringUtils;
import tech.powerjob.common.utils.JavaUtils;
 
/**
 * 获取 Worker 版本,便于开发者排查问题
 *
 * @author tjq
 * @since 2020/5/11
 */
public final class PowerJobWorkerVersion {
 
    private static String CACHE = null;
 
    /**
     * Return the full version string of the present OhMyScheduler-Worker codebase, or {@code null}
     * if it cannot be determined.
     * @return the version of OhMyScheduler-Worker or {@code null}
     * @see Package#getImplementationVersion()
     */
    public static String getVersion() {
        if (StringUtils.isEmpty(CACHE)) {
            CACHE = JavaUtils.determinePackageVersion(PowerJobWorkerVersion.class);
        }
        return CACHE;
    }
 
}