Skip to content

Commit

Permalink
worker和agent支持java17和java8同步运行 #10586
Browse files Browse the repository at this point in the history
  • Loading branch information
tangruotian committed Sep 5, 2024
1 parent e5fd508 commit 0f15708
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 21 deletions.
1 change: 0 additions & 1 deletion src/agent/agent/src/pkg/upgrade/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ func DoUpgradeOperation(upItems *upgradeItems) error {

func DoUpgradeJdk() error {
logs.Info("agentUpgrade|jdk changed, replace jdk file")
defer third_components.Jdk.AddUpgradeTime()

workDir := systemutil.GetWorkDir()

Expand Down
4 changes: 0 additions & 4 deletions src/agent/agent/src/pkg/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ func AgentUpgrade(upgradeItem *api.UpgradeItem, hasBuild bool) {
Jdk: upgradeItem.Jdk,
DockerInitFile: upgradeItem.DockerInitFile,
}
// 检查JDK是否超过最大升级次数
if upItems.Jdk && !third_components.Jdk.CheckUpgradeTime() {
upItems.Jdk = false
}

if upItems.NoChange() {
return
Expand Down
2 changes: 1 addition & 1 deletion src/agent/agent/src/pkg/upgrader/upgrader_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const (

// DoUpgradeAgent 升级agent
// 1、通过service启动的daemon因为go本身内部注册了daemon导致权限模型有些未知问题,无法更新daemon后启动,只能更新agent
// 2、通过执行计划启动的daemon因为具有登录态,可以直接执行脚本拉起
// 2、通过执行计划启动的daemon因为具有登录态,可以直接执行脚本拉起,如果执行计划存在问题,则无法拉起,需要使用 1 中的方式更新
// 3、用户双击启动的daemon和service一样,无法更新daemon,只能更新agent
func DoUpgradeAgent() error {
logs.Info("start upgrade agent")
Expand Down
15 changes: 0 additions & 15 deletions src/agent/agent/src/third_components/jdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"os"
"strings"
"sync"
"sync/atomic"
"time"
)

Expand All @@ -29,20 +28,6 @@ const (
type JdkType struct {
Jdk8 JdkVersionType
Jdk17 JdkVersionType
// 升级次数
upgradeTime int32
}

func (j *JdkType) AddUpgradeTime() {
atomic.AddInt32(&j.upgradeTime, 1)
}

func (j *JdkType) CheckUpgradeTime() bool {
if atomic.LoadInt32(&j.upgradeTime) >= JdkMaxUpgradeTime {
logs.Warnf("JDK upgrade times have exceeded the maximum of %d times, not upgraded", JdkMaxUpgradeTime)
return false
}
return true
}

// JdkVersionType jdk版本信息缓存
Expand Down

0 comments on commit 0f15708

Please sign in to comment.