[KYUUBI #6531] Fix SPARK-EngineTab stop/gracefulstop not work

# 🔍 Description
## Issue References 🔗

This pull request fixes #6531

## Describe Your Solution 🔧

Fix SPARK-EngineTab stop/gracefulstop not work

## Types of changes 🔖

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪

#### Behavior Without This Pull Request ⚰️

#### Behavior With This Pull Request 🎉

#### Related Unit Tests

---

# Checklist 📝

- [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

**Be nice. Be informative.**

Closes #6533 from promising-forever/patch-1.

Closes #6531

66be0fdfd [promising-forever] [KYUUBI #6531] Fix SPARK-EngineTab stop/gracefulstop not work

Authored-by: promising-forever <79634622+promising-forever@users.noreply.github.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
promising-forever 2024-07-12 17:25:27 +08:00 committed by Cheng Pan
parent 53b3911935
commit 8e84c2a72f

View File

@ -105,24 +105,26 @@ case class EngineTab(
.buildChecked(ui)
if (SPARK_ENGINE_RUNTIME_VERSION >= "4.0") {
attachHandlerMethod.invoke {
val createRedirectHandlerMethod = DynMethods.builder("createRedirectHandler")
.impl(
JettyUtils.getClass,
classOf[String],
classOf[String],
classOf[jakarta.servlet.http.HttpServletRequest => Unit],
classOf[String],
classOf[Set[String]])
.buildChecked(JettyUtils)
val createRedirectHandlerMethod = DynMethods.builder("createRedirectHandler")
.impl(
JettyUtils.getClass,
classOf[String],
classOf[String],
classOf[jakarta.servlet.http.HttpServletRequest => Unit],
classOf[String],
classOf[Set[String]])
.buildChecked(JettyUtils)
attachHandlerMethod.invoke {
val killHandler =
(_: jakarta.servlet.http.HttpServletRequest) => handleKill()
val gracefulKillHandler =
(_: jakarta.servlet.http.HttpServletRequest) => handleGracefulKill()
createRedirectHandlerMethod
.invoke("/kyuubi/stop", "/kyuubi", killHandler, "", Set("GET", "POST"))
}
attachHandlerMethod.invoke {
val gracefulKillHandler =
(_: jakarta.servlet.http.HttpServletRequest) => handleGracefulKill()
createRedirectHandlerMethod
.invoke("/kyuubi/gracefulstop", "/kyuubi", gracefulKillHandler, "", Set("GET", "POST"))
}
@ -140,11 +142,14 @@ case class EngineTab(
attachHandlerMethod.invoke {
val killHandler =
(_: javax.servlet.http.HttpServletRequest) => handleKill()
val gracefulKillHandler =
(_: javax.servlet.http.HttpServletRequest) => handleGracefulKill()
createRedirectHandlerMethod
.invoke("/kyuubi/stop", "/kyuubi", killHandler, "", Set("GET", "POST"))
}
attachHandlerMethod.invoke {
val gracefulKillHandler =
(_: javax.servlet.http.HttpServletRequest) => handleGracefulKill()
createRedirectHandlerMethod
.invoke("/kyuubi/gracefulstop", "/kyuubi", gracefulKillHandler, "", Set("GET", "POST"))
}