You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by ca...@apache.org on 2022/04/29 15:51:45 UTC
[incubator-linkis] 08/11: optimize code add locker
This is an automated email from the ASF dual-hosted git repository.
casion pushed a commit to branch dev-1.1.2
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
commit 2b8503f638acbb94a601250649b6eb36bd648bb3
Author: peacewong <wp...@gmail.com>
AuthorDate: Thu Apr 28 19:59:26 2022 +0800
optimize code add locker
---
.../main/scala/org/apache/linkis/orchestrator/plans/ast/Job.scala | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/linkis-orchestrator/linkis-orchestrator-core/src/main/scala/org/apache/linkis/orchestrator/plans/ast/Job.scala b/linkis-orchestrator/linkis-orchestrator-core/src/main/scala/org/apache/linkis/orchestrator/plans/ast/Job.scala
index 04fbb6161..cd0ddbb6f 100644
--- a/linkis-orchestrator/linkis-orchestrator-core/src/main/scala/org/apache/linkis/orchestrator/plans/ast/Job.scala
+++ b/linkis-orchestrator/linkis-orchestrator-core/src/main/scala/org/apache/linkis/orchestrator/plans/ast/Job.scala
@@ -32,6 +32,9 @@ trait Job extends ASTOrchestration[Job] {
private var idInfo: String = _
+ private val idLock = new Array[Byte](0)
+ private val idInfoLock = new Array[Byte](0)
+
override def isVisited: Boolean = visited
override def setVisited(): Unit = this.visited = true
@@ -45,7 +48,7 @@ trait Job extends ASTOrchestration[Job] {
def copyWithNewStages(stages: Array[Stage]): Job
override def getId: String = {
- if (null == id) synchronized {
+ if (null == id) idLock synchronized {
if (null == id) {
id = OrchestratorIDCreator.getAstJobIDCreator.nextID("astJob")
}
@@ -54,7 +57,7 @@ trait Job extends ASTOrchestration[Job] {
}
def getIDInfo(): String = {
- if (null == idInfo) synchronized {
+ if (null == idInfo) idInfoLock synchronized {
if (null == idInfo) {
val context = getASTContext
if (null != context && null != context.getParams && null != context.getParams.getRuntimeParams && null != context.getParams.getRuntimeParams.toMap) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org