Skip to content

Commit

Permalink
Merge pull request #129 from HindujaB/java21
Browse files Browse the repository at this point in the history
Migrate to java 21 versions
  • Loading branch information
warunalakshitha authored Nov 19, 2024
2 parents 32e1326 + 89ab851 commit 34590d9
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 48 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17.0.7
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
java-version: 21.0.3
- name: Set version env variable
run: echo "VERSION=$((grep -w "version" | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $GITHUB_ENV
- name: Pre release depenency version update
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The `asyncapi` command in Ballerina is used for AsyncAPI to Ballerina and Baller

### Setting Up the Prerequisites

1. OpenJDK 17 ([Adopt OpenJDK](https://adoptopenjdk.net/) or any other OpenJDK distribution)
1. OpenJDK 21 ([Adopt OpenJDK](https://adoptopenjdk.net/) or any other OpenJDK distribution)

>**Info:** You can also use [Oracle JDK](https://www.oracle.com/java/technologies/javase-downloads.html). Set the JAVA_HOME environment variable to the pathname of the directory into which you installed JDK.
Expand Down
1 change: 1 addition & 0 deletions asyncapi-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ dependencies {
ballerinaStdLibs "io.ballerina.stdlib:rabbitmq-ballerina:${stdlibRabbitMqVersion}"
ballerinaStdLibs "io.ballerina.stdlib:websocket-ballerina:${stdlibWebsocketVersion}"
ballerinaStdLibs "io.ballerina.stdlib:constraint-ballerina:${stdlibConstraintVersion}"
ballerinaStdLibs "io.ballerina.lib:data.jsondata-ballerina:${stdlibDataJsonDataVersion}"
}

clean {
Expand Down
49 changes: 25 additions & 24 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ group=io.ballerina
version=0.9.0-SNAPSHOT

#dependency
ballerinaLangVersion=2201.10.0-20240814-095500-9d14866a
ballerinaLangVersion=2201.11.0-20241117-133400-a3054b77
testngVersion=7.6.1
slf4jVersion=1.7.30
puppycrawlCheckstyleVersion=10.12.0
Expand All @@ -20,38 +20,39 @@ javaModularityVersion=1.8.15
researchgateReleaseVersion=2.8.0

# Stdlib Level 01
stdlibConstraintVersion=1.5.0
stdlibIoVersion=1.6.1
stdlibRegexVersion=1.4.3
stdlibTimeVersion=2.4.0
stdlibUrlVersion=2.4.0
observeVersion=1.3.0-20240814-114100-0f71e1e
stdlibConstraintVersion=1.6.0-20241113-090900-d276ad5
stdlibIoVersion=1.6.2-20241112-233100-995cf5f
stdlibRegexVersion=1.4.4-20241108-130200-fcd3fce
stdlibTimeVersion=2.6.0-20241113-073800-201b904
stdlibUrlVersion=2.4.1-20241113-073900-335ff51
observeVersion=1.4.0-20241113-092000-b83ae74

# Stdlib Level 02
stdlibCryptoVersion=2.7.2
stdlibLogVersion=2.10.0-20240814-120000-f0c3cc8
stdlibOsVersion=1.8.0
stdlibTaskVersion=2.5.0
observeInternalVersion=1.3.0-20240814-114900-8a734a3
stdlibXmldataVersion=1.0.0-20240814-191500-2f18de5
stdlibCryptoVersion=2.7.3-20241113-081400-d015a39
stdlibLogVersion=2.10.1-20241113-120000-4577868
stdlibOsVersion=1.8.1-20241113-122000-cca973b
stdlibTaskVersion=2.5.1-20241113-123500-f905281
observeInternalVersion=1.3.1-20241113-101700-265054d
stdlibXmldataVersion=1.0.1-20241113-122800-f4e815c

# Stdlib Level 03
stdlibCacheVersion=3.8.0
stdlibFileVersion=1.10.0-20240814-133200-74f4d63
stdlibMimeVersion=2.10.0-20240814-133200-6c54439
stdlibUuidVersion=1.8.0
stdlibCacheVersion=3.8.1-20241113-125700-b75a1bf
stdlibFileVersion=1.10.1-20241113-151700-e1a2e38
stdlibMimeVersion=2.10.2-20241113-154200-d953747
stdlibUuidVersion=1.8.1-20241113-154400-443c67b

# Stdlib Level 04
stdlibAuthVersion=2.12.0-20240814-133000-6db5624
stdlibJwtVersion=2.13.0-20240814-133100-630021f
stdlibOAuth2Version=2.12.0-20240814-133400-a7008e4
stdlibAuthVersion=2.12.1-20241113-162300-ded40eb
stdlibDataJsonDataVersion=0.3.0-20241114-143900-285d739
stdlibJwtVersion=2.13.1-20241113-162400-b59ccfa
stdlibOAuth2Version=2.12.1-20241113-162400-4c6ddfe

# Stdlib Level 05
stdlibHttpVersion=2.12.0-20240814-145000-dcdc9a0
stdlibHttpVersion=2.13.0-20241114-182900-7e9f66a

# Stdlib Level 06
stdlibWebsocketVersion=2.12.0-20240814-155600-2780f9f
stdlibWebsocketVersion=2.13.0-20241116-202000-ddd958d

# Ballerinax
stdlibKafkaVersion=4.2.0-20240814-162500-b2f21c4
stdlibRabbitMqVersion=3.1.0-20240811-211500-cd34a3e
stdlibKafkaVersion=4.3.0-20241117-075000-973da92
stdlibRabbitMqVersion=3.2.0-20241117-165100-adfe701
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
package io.ballerinax.event;

import io.ballerina.runtime.api.Environment;
import io.ballerina.runtime.api.Future;
import io.ballerina.runtime.api.Module;
import io.ballerina.runtime.api.async.Callback;
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.values.BError;
import io.ballerina.runtime.api.values.BMap;
Expand All @@ -36,24 +33,16 @@
public class NativeHttpToEventAdaptor {
public static Object invokeRemoteFunction(Environment env, BObject adaptor, BMap<BString, Object> message,
BString eventName, BString eventFunction, BObject serviceObj) {
Future balFuture = env.markAsync();
Module module = ModuleUtils.getModule();
StrandMetadata metadata = new StrandMetadata(module.getOrg(), module.getName(), module.getVersion(),
eventName.getValue());
Object[] args = new Object[]{message, true};
env.getRuntime().invokeMethodAsync(serviceObj, eventFunction.getValue(), null, metadata, new Callback() {
@Override
public void notifySuccess(Object result) {
balFuture.complete(result);
return env.yieldAndRun(() -> {
try {
return env.getRuntime().callMethod(serviceObj, eventFunction.getValue(),
new StrandMetadata(true, null), args);
} catch (BError error) {
BString errorMessage = fromString("service method invocation failed: " + error.getErrorMessage());
BError invocationError = ErrorCreator.createError(errorMessage, error);
return invocationError;
}

@Override
public void notifyFailure(BError bError) {
BString errorMessage = fromString("service method invocation failed: " + bError.getErrorMessage());
BError invocationError = ErrorCreator.createError(errorMessage, bError);
balFuture.complete(invocationError);
}
}, args);
return null;
});
}
}

0 comments on commit 34590d9

Please sign in to comment.