Skip to content

Commit

Permalink
Merge pull request #118 from warunalakshitha/updateLang
Browse files Browse the repository at this point in the history
Migrate to new Runtime APIs
  • Loading branch information
warunalakshitha authored Nov 13, 2024
2 parents cdc3cb3 + b9773d8 commit 265054d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ org.gradle.caching=true
group=io.ballerina
version=1.3.1-SNAPSHOT

ballerinaLangVersion=2201.10.0-20241011-161100-51978649
ballerinaLangVersion=2201.11.0-20241112-214900-6b80ab87
githubSpotbugsVersion=6.0.18
githubJohnrengelmanShadowVersion=8.1.1
underCouchDownloadVersion=5.4.0
Expand All @@ -28,7 +28,7 @@ openTelemetryVersion=1.7.0
nettyCodecVersion=4.1.100.Final
gsonVersion=2.10.1

observeVersion=1.3.1-20241007-161000-645452d
observeVersion=1.4.0-20241113-092000-b83ae74

# Test Dependency Versions
testngVersion=7.6.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.ballerina.testobserve.listenerendpoint;

import io.ballerina.runtime.api.Environment;
import io.ballerina.runtime.api.async.StrandMetadata;
import io.ballerina.runtime.api.concurrent.StrandMetadata;
import io.ballerina.runtime.api.creators.ErrorCreator;
import io.ballerina.runtime.api.creators.ValueCreator;
import io.ballerina.runtime.api.types.ObjectType;
Expand Down Expand Up @@ -243,22 +243,12 @@ protected void channelRead0(ChannelHandlerContext ctx, Object o) {

Map<String, Object> properties = new HashMap<>();
properties.put(ObservabilityConstants.KEY_OBSERVER_CONTEXT, observerContext);

StrandMetadata strandMetadata = new StrandMetadata(TEST_OBSERVE_PACKAGE.getOrg(),
TEST_OBSERVE_PACKAGE.getName(), TEST_OBSERVE_PACKAGE.getMajorVersion(),
resourceFunctionName);
Utils.logInfo("Dispatching resource " + resourcePath);
ObjectType objectType = (ObjectType) serviceObject.getOriginalType();
Object result;

try {
if (objectType.isIsolated() && objectType.isIsolated(resourceFunctionName)) {
result = env.getRuntime().startIsolatedWorker(serviceObject, resourceFunctionName, null,
strandMetadata, properties, args).get();
} else {
result = env.getRuntime().startNonIsolatedWorker(serviceObject, resourceFunctionName, null,
strandMetadata, properties, args).get();
}
boolean isConcurrentSafe = objectType.isIsolated() && objectType.isIsolated(resourceFunctionName);
StrandMetadata metadata = new StrandMetadata(isConcurrentSafe, properties);
Object result = env.getRuntime().callMethod(serviceObject, resourceFunctionName, metadata, args);
handleResult(ctx, result, resourcePath);
} catch (BError error) {
handleError(ctx, error, resourcePath);
Expand Down

0 comments on commit 265054d

Please sign in to comment.