Skip to content

Commit

Permalink
Revert "able to avoid locks for js in same scenario #2222 #2204"
Browse files Browse the repository at this point in the history
This reverts commit 94d7afe.

ci failed although it worked locally, so abort this attempt
  • Loading branch information
ptrthomas committed Feb 4, 2023
1 parent 94d7afe commit c61712c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,6 @@ public static ScenarioEngine forTempUse(HttpClientFactory hcf) {

private static final ThreadLocal<ScenarioEngine> THREAD_LOCAL = new ThreadLocal<ScenarioEngine>();

public static boolean isOnSameThreadAs(Value value) {
ScenarioEngine se = get();
if (se == null || se.JS == null) {
return false;
}
return se.JS.context.equals(value.getContext());
}

public static ScenarioEngine get() {
return THREAD_LOCAL.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
package com.intuit.karate.graal;

import com.intuit.karate.JsonUtils;
import com.intuit.karate.core.ScenarioEngine;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -305,9 +304,6 @@ public Object execute(Value... args) {
for (int i = 0; i < newArgs.length; i++) {
newArgs[i] = JsValue.fromJava(args[i]);
}
if (ScenarioEngine.isOnSameThreadAs(v)) {
return new JsValue(v.execute(newArgs)).value;
}
synchronized (LOCK) {
return new JsValue(v.execute(newArgs)).value;
}
Expand All @@ -327,9 +323,6 @@ public Object newInstance(Value... args) {
for (int i = 0; i < newArgs.length; i++) {
newArgs[i] = JsValue.fromJava(args[i]);
}
if (ScenarioEngine.isOnSameThreadAs(v)) {
return new JsValue(v.execute(newArgs)).value;
}
synchronized (LOCK) {
return new JsValue(v.execute(newArgs)).value;
}
Expand Down

0 comments on commit c61712c

Please sign in to comment.