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

Update to Java 17 #4307

Merged
merged 10 commits into from
Sep 28, 2023
Merged

Update to Java 17 #4307

merged 10 commits into from
Sep 28, 2023

Conversation

olivergrabinski
Copy link
Contributor

@olivergrabinski olivergrabinski commented Sep 26, 2023

Closes #3645

@olivergrabinski olivergrabinski changed the title [test] Update to JRE 17 Update to Java 17 Sep 26, 2023
@@ -31,7 +32,7 @@ class BlazegraphSlowQueryStoreSuite
SparqlQuery(""),
failed = true,
1.second,
Instant.now(),
Instant.now().truncatedTo(ChronoUnit.MILLIS),
Copy link
Contributor Author

@olivergrabinski olivergrabinski Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[The clock used by Instant.now()] is based on the best available system clock. This may use System.currentTimeMillis(), or a higher resolution clock if one is available.

https://docs.oracle.com/javase/8/docs/api/java/time/Clock.html#systemUTC--

Based on this perhaps calls to Instant.now() should be made with a specific clock, especially outside of tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in production code we are safe, as we should never be calling Instant.now() directly. In tests it's more annoying to have to use a clock.

One possible solution is to be a bit more relaxed in tests. I know that we use a fixed clock and check exact timestamps, but an alternative approach is to use a normal clock be a little more flexible. That is probably too big a change though

Perhaps there is some sort of typeclass equality that could rescue us..?

@olivergrabinski olivergrabinski marked this pull request as ready for review September 27, 2023 08:34
Comment on lines +17 to +22
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
check-latest: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you necessarily have to do it in this PR, but here is something interesting: https://github.com/marketplace/actions/setup-java-jdk#caching-sbt-dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried it but for some reason it takes ages to recover the cache. Example: https://github.com/BlueBrain/nexus/actions/runs/6318630985/job/17158027837 It takes 2m45 to fetch the cache but doesn't speed up the actual build/tests 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw there is caching added to the release and snapshot pipelines to try it out. My suspicion is that it should work ok on the cloud runners. If it is also slow I will remove it.

@olivergrabinski olivergrabinski merged commit 65e2ba3 into BlueBrain:master Sep 28, 2023
8 checks passed
@olivergrabinski olivergrabinski deleted the jre-17 branch September 28, 2023 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to JRE 17
3 participants