Skip to content

ARTEMIS-5972: Replace JNI with Panama Foreign Function & Memory (FFM)…#6444

Open
mayankkunwar wants to merge 1 commit into
apache:mainfrom
mayankkunwar:ARTEMIS-5972
Open

ARTEMIS-5972: Replace JNI with Panama Foreign Function & Memory (FFM)…#6444
mayankkunwar wants to merge 1 commit into
apache:mainfrom
mayankkunwar:ARTEMIS-5972

Conversation

@mayankkunwar

Copy link
Copy Markdown

… API for Journal Native Layer

@clebertsuconic

Copy link
Copy Markdown
Contributor

nice one @mayankkunwar

@mayankkunwar mayankkunwar force-pushed the ARTEMIS-5972 branch 2 times, most recently from 17ca830 to 758dfd6 Compare May 14, 2026 00:05
Comment thread pom.xml Outdated
@mayankkunwar mayankkunwar force-pushed the ARTEMIS-5972 branch 8 times, most recently from a91e37f to f177963 Compare May 20, 2026 18:01
Comment thread artemis-ffm/etc/checkstyle-suppressions.xml Outdated
Comment thread artemis-ffm/pom.xml Outdated
@mayankkunwar mayankkunwar force-pushed the ARTEMIS-5972 branch 7 times, most recently from 8ddbb55 to 8bcceee Compare June 2, 2026 17:25
@mayankkunwar mayankkunwar force-pushed the ARTEMIS-5972 branch 4 times, most recently from bda5293 to fbd575c Compare June 2, 2026 20:28
@mayankkunwar mayankkunwar force-pushed the ARTEMIS-5972 branch 7 times, most recently from b602e56 to 9fc249c Compare June 5, 2026 17:07
@clebertsuconic clebertsuconic force-pushed the ARTEMIS-5972 branch 2 times, most recently from beabca5 to a89db8c Compare June 5, 2026 20:24
@mayankkunwar mayankkunwar force-pushed the ARTEMIS-5972 branch 6 times, most recently from 017c72c to 571ebec Compare June 8, 2026 08:28
Comment thread artemis-distribution/pom.xml Outdated
</build>

<profiles>
<profile>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now that you made the optional compilation in the ffm module, this could always be present, right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I just need to link artemis-ffm changes to artemis-journal, and after that we can always have it.

Comment thread artemis-journal/pom.xml Outdated
</activation>
<dependencies>
<dependency>
<groupId>org.apache.artemis</groupId>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this could always be present?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, let me push the linking part to artemis-journal, and after this we can.

Comment thread artemis-journal/pom.xml
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>java24-compile</id>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we still need this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, we will need this as latest changes has FFM related component like MemorySegment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what if we changed the signature to use ByteBuffer (at least what's exposed to this level?)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

actually.. never mind... the implementation of the SequentialFactory itself is dependent on other internal parts. I think we need it.

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we still need this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess for this case we do, but just double checking with you.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, we will need this part as well

@clebertsuconic

Copy link
Copy Markdown
Contributor

having the optional compilation in FFM simplifies thing a lot... nice one

@mayankkunwar mayankkunwar force-pushed the ARTEMIS-5972 branch 6 times, most recently from 5c113de to dd41139 Compare June 10, 2026 08:42
private boolean aio;

@Option(names = "--aio2", description = "Set the journal as asyncio 2 (Panama FFM).")
private boolean aio2;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd wonder about either something like --aio-ffm, (or maybe just reusing the existing aio option and having an additional toggle that says whether it is ffm or not (i.e jni).

'aio2' seems more like a distinct version of aio, not 'use different way to access same aio version'...and if there ever were such an aio version, it would clash.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

aio could have more variants than this, like currently we are using libaio for kernel level I/O operations and later we can replace libaio with io_uring or something else.
So the naming conventions would again change in future.
What if we mention underlying I/O libs something like: --libaio-jni / --libaio-ffm / --iouring-ffm ? or --aio-libaio-jni / --aio-libaio-ffm / --aio-iouring-ffm?
Any suggestions from this POV?


if (aio) {
if (aio2) {
journalType = JournalType.ASYNCIO_2;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

similarly

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Let's decide on an agreeable naming convention.

Comment thread artemis-journal/pom.xml Outdated
Comment on lines +97 to +98
<version>${project.version}</version>
<scope>compile</scope>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldnt need the version here. Implies missing entry in artemis-bom. Compile scope is default so it can be omitted.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch! Entry is missing in artemis-bom, will add an entry there and update this code

Comment thread artemis-distribution/pom.xml Outdated
<dependency>
<groupId>org.apache.artemis</groupId>
<artifactId>artemis-ffm</artifactId>
<version>${project.version}</version>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldnt need this at all if the journal depends on it, since the journal will bring it in (and note the journal isnt specified here either)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The artemis-server depends on artemis-journal, I guess we can remove this.

}

public static void setForceSyscall(boolean value) {
throw new UnsupportedOperationException("Not supported for JDK < 22.");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since its building to 24+, I'd make this message match?

If all the messages are the same, perhaps extract this to a constant and then update the constant.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will remove the unused methods.

Comment thread tests/integration-tests/pom.xml Outdated
<dependency>
<groupId>org.apache.artemis</groupId>
<artifactId>artemis-ffm</artifactId>
<version>${project.version}</version>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As earlier comment, version shouldnt be needed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

okay

Comment thread tests/integration-tests/pom.xml Outdated
</activation>
<properties>
<its-surefire-extra-args>--add-exports java.security.jgss/sun.security.krb5=ALL-UNNAMED</its-surefire-extra-args>
<its-surefire-extra-args>--add-exports java.security.jgss/sun.security.krb5=ALL-UNNAMED

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems a non-change and could be unwound.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

okay

Comment thread tests/performance-jmh/pom.xml Outdated
<dependency>
<groupId>org.apache.artemis</groupId>
<artifactId>artemis-ffm</artifactId>
<version>${project.version}</version>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As earlier comments.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

okay

Comment thread tests/unit-tests/pom.xml Outdated
<dependency>
<groupId>org.apache.artemis</groupId>
<artifactId>artemis-ffm</artifactId>
<version>${project.version}</version>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As earlier comments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

okay

Comment thread pom.xml
<module>artemis-jakarta-client-osgi</module>
<module>artemis-jms-server</module>
<module>artemis-jakarta-server</module>
<module>artemis-ffm</module>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do wonder if this is the best module name. If its basically specific to the journal I'd wonder if it should have that in the name.

Or if the whole lot could go in the existing journal module, which is already depending on this and having its own multi-release build etc.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Can we rename it as "artemis-aio" or something similar, or any other suggestions on this?
As we have a totally different repo for artemis-native, I thought it would be better to have these changes in separate module.

…, which is now introducing libaio.

In the configuration we are naming it as ASYNCIO_2.

Co-Authored-By: Clebert Suconic <clebertsuconic@apache.org>
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.

4 participants