Skip to content

Commit

Permalink
deal with double
Browse files Browse the repository at this point in the history
  • Loading branch information
aiceflower committed Dec 20, 2024
1 parent b9283d1 commit 7dd46d2
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ abstract class EntranceServer extends Logging {
) {
val priorityValue: AnyRef = properties.get(ENGINE_PRIORITY_RUNTIME_KEY)
if (priorityValue != null) {
val value: Int = priorityValue.toString.toInt
val value: Int = getPriority(priorityValue.toString)
job.setPriority(value)
}
}
Expand Down Expand Up @@ -316,6 +316,23 @@ abstract class EntranceServer extends Logging {
startTimeOutCheck()
}

val DOT = "."
val DEFAULT_PRIORITY = 100

private def getPriority(value: String): Int = {
var priority: Int = -1
Utils.tryAndWarn({
priority =
if (value.contains(DOT)) value.substring(0, value.indexOf(DOT)).toInt else value.toInt
})
if (priority < 0 || priority > Integer.MAX_VALUE - 1) {
logger.warn(s"illegal queue priority: ${value}")
DEFAULT_PRIORITY
} else {
priority
}
}

}

object EntranceServer {
Expand Down

0 comments on commit 7dd46d2

Please sign in to comment.