You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@artemis.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/06/02 17:47:00 UTC

[jira] [Work logged] (ARTEMIS-5972) Replace JNI with Panama Foreign Function & Memory (FFM) API for Journal Native Layer

     [ https://issues.apache.org/jira/browse/ARTEMIS-5972?focusedWorklogId=1023372&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1023372 ]

ASF GitHub Bot logged work on ARTEMIS-5972:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/Jun/26 17:46
            Start Date: 02/Jun/26 17:46
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on code in PR #6444:
URL: https://github.com/apache/artemis/pull/6444#discussion_r3343275547


##########
tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/ffmaio/FfmMultiThreadAsynchronousFileTest.java:
##########
@@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.unit.core.ffmaio;
+
+import java.lang.foreign.MemorySegment;
+import java.lang.invoke.MethodHandles;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.activemq.artemis.core.io.IOCallback;
+import org.apache.activemq.artemis.core.io.aioffm.libaio.FfmAIOSequentialFile;
+import org.apache.activemq.artemis.core.io.aioffm.libaio.FfmAIOSequentialFileFactory;
+import org.apache.artemis.nativo.jlibaio.LibaioContext;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * You need to define {@literal -Djava.library.path=${project-root}/native/src/.libs} when calling the JVM
+ * If you are running this test in eclipse you should do:
+ * <ol>
+ * <li>Run->Open Run Dialog
+ * <li>Find the class on the list (you will find it if you already tried running this testcase before)
+ * <li>Add {@literal -Djava.library.path=${project-root}/native/src/.libs}
+ * </ol>
+ */
+public class FfmMultiThreadAsynchronousFileTest extends FfmAIOTestBase {

Review Comment:
   nitpick only.. this one should be named FfmAIO... 
   
   (just to follow the extension's name).





Issue Time Tracking
-------------------

    Worklog Id:     (was: 1023372)
    Time Spent: 2.5h  (was: 2h 20m)

> Replace JNI with Panama Foreign Function & Memory (FFM) API for Journal Native Layer
> ------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-5972
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5972
>             Project: Artemis
>          Issue Type: Improvement
>          Components: Native
>            Reporter: Mayank Kunwar
>            Assignee: Clebert Suconic
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> Proposing a modernization of the artemis-journal module by leveraging the Panama Foreign Function & Memory (FFM) API (introduced in JDK 22). This will provide a high-performance alternative to the existing JNI-based native layer for interacting with libaio.
>  
> ||Feature||Current JNI + libaio||Modernize Journal||
> |Call Type|Java -> JNI (C code) -> libaio |Java -> Panama FFM -> libaio|
> |Code Base|Java + C/C++ (Native Repo)|100% Pure Java|
> |I/O Mechanism |Asynchronous via libaio callbacks|Asynchronous via libaio callbacks|
> |Efficiency|Higher overhead (JNI transitions)|Lower overhead (JIT optimized)|



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org