Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Reduce Locks #2178

Open
wants to merge 3 commits into
base: 2201.9.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ballerina-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
org = "ballerina"
name = "graphql_tests"
version = "1.13.3"
version = "1.13.4"

[build-options]
observabilityIncluded = true
14 changes: 7 additions & 7 deletions ballerina-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ distribution-version = "2201.9.0"
[[package]]
org = "ballerina"
name = "auth"
version = "2.11.0"
version = "2.11.2"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "jballerina.java"},
Expand Down Expand Up @@ -44,7 +44,7 @@ modules = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.0"
version = "2.7.2"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "time"}
Expand All @@ -67,7 +67,7 @@ modules = [
[[package]]
org = "ballerina"
name = "graphql"
version = "1.13.3"
version = "1.13.4"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -99,7 +99,7 @@ modules = [
[[package]]
org = "ballerina"
name = "graphql_tests"
version = "1.13.3"
version = "1.13.4"
dependencies = [
{org = "ballerina", name = "constraint"},
{org = "ballerina", name = "file"},
Expand All @@ -123,7 +123,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http"
version = "2.11.0"
version = "2.11.9"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -155,7 +155,7 @@ modules = [
[[package]]
org = "ballerina"
name = "io"
version = "1.6.0"
version = "1.6.3"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.value"}
Expand Down Expand Up @@ -388,7 +388,7 @@ modules = [
[[package]]
org = "ballerina"
name = "websocket"
version = "2.11.0"
version = "2.11.2"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "constraint"},
Expand Down
10 changes: 5 additions & 5 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
org = "ballerina"
name = "graphql"
version = "1.13.3"
version = "1.13.4"
authors = ["Ballerina"]
export=["graphql", "graphql.subgraph", "graphql.dataloader"]
keywords = ["gql", "network", "query", "service"]
Expand All @@ -16,11 +16,11 @@ graalvmCompatible = true
[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "graphql-native"
version = "1.13.3"
path = "../native/build/libs/graphql-native-1.13.3.jar"
version = "1.13.4"
path = "../native/build/libs/graphql-native-1.13.4-SNAPSHOT.jar"

[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "graphql-commons"
version = "1.13.3"
path = "../commons/build/libs/graphql-commons-1.13.3.jar"
version = "1.13.4"
path = "../commons/build/libs/graphql-commons-1.13.4-SNAPSHOT.jar"
4 changes: 2 additions & 2 deletions ballerina/CompilerPlugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id = "graphql-compiler-plugin"
class = "io.ballerina.stdlib.graphql.compiler.GraphqlCompilerPlugin"

[[dependency]]
path = "../compiler-plugin/build/libs/graphql-compiler-plugin-1.13.3.jar"
path = "../compiler-plugin/build/libs/graphql-compiler-plugin-1.13.4-SNAPSHOT.jar"

[[dependency]]
path = "../commons/build/libs/graphql-commons-1.13.3.jar"
path = "../commons/build/libs/graphql-commons-1.13.4-SNAPSHOT.jar"
12 changes: 6 additions & 6 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ distribution-version = "2201.9.0"
[[package]]
org = "ballerina"
name = "auth"
version = "2.11.0"
version = "2.11.2"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "jballerina.java"},
Expand Down Expand Up @@ -47,7 +47,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.0"
version = "2.7.2"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "time"}
Expand All @@ -73,7 +73,7 @@ modules = [
[[package]]
org = "ballerina"
name = "graphql"
version = "1.13.3"
version = "1.13.4"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -106,7 +106,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http"
version = "2.11.0"
version = "2.11.9"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -138,7 +138,7 @@ modules = [
[[package]]
org = "ballerina"
name = "io"
version = "1.6.0"
version = "1.6.3"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.value"}
Expand Down Expand Up @@ -390,7 +390,7 @@ modules = [
[[package]]
org = "ballerina"
name = "websocket"
version = "2.11.0"
version = "2.11.2"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "constraint"},
Expand Down
23 changes: 12 additions & 11 deletions ballerina/ping_message_job.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// specific language governing permissions and limitations
// under the License.

import ballerina/websocket;
import ballerina/task;
import ballerina/websocket;

class PingMessageJob {
*task:Job;
Expand Down Expand Up @@ -49,18 +49,19 @@

private isolated function sendPeriodicPingMessageRequests() {
do {
task:JobId? id;
lock {
task:JobId? id = self.id;
if id == () {
return;
}
if !self.caller.isOpen() {
check self.unschedule();
return;
}
PingMessage message = {'type: WS_PING};
check writeMessage(self.caller, message);
id = self.id;
}
if id == () {
return;

Check warning on line 57 in ballerina/ping_message_job.bal

View check run for this annotation

Codecov / codecov/patch

ballerina/ping_message_job.bal#L57

Added line #L57 was not covered by tests
}
if !self.caller.isOpen() {
check self.unschedule();
return;
}
PingMessage message = {'type: WS_PING};
check writeMessage(self.caller, message);
} on fail error cause {
string message = cause is websocket:Error ? "Failed to send ping message: "
: "Failed to unschedule PingMessageJob: ";
Expand Down
16 changes: 6 additions & 10 deletions ballerina/place_holder.bal
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,13 @@ isolated class Placeholder {
self.setField('field);
}

isolated function setValue(anydata value) {
lock {
self.value = value.clone();
}
}
isolated function setValue(anydata value) = @java:Method {
'class: "io.ballerina.stdlib.graphql.runtime.engine.Placeholder"
} external;

isolated function getValue() returns anydata {
lock {
return self.value.clone();
}
}
isolated function getValue() returns anydata = @java:Method {
'class: "io.ballerina.stdlib.graphql.runtime.engine.Placeholder"
} external;

isolated function setField(Field 'field) = @java:Method {
name: "setFieldValue",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,20 @@
* This class provides native implementations of the Ballerina Placeholder class.
*/
public class Placeholder {
private static final BString PLACE_HOLDER_VALUE_OBJECT = StringUtils.fromString("value");
private static final BString PLACE_HOLDER_FIELD_OBJECT = StringUtils.fromString("field");

private Placeholder() {
}

public static void setValue(BObject placeholder, Object value) {
placeholder.set(PLACE_HOLDER_VALUE_OBJECT, value);
}

public static Object getValue(BObject placeholder) {
return placeholder.get(PLACE_HOLDER_VALUE_OBJECT);
}

public static void setFieldValue(BObject placeholder, BObject field) {
placeholder.set(PLACE_HOLDER_FIELD_OBJECT, field);
}
Expand Down