Support request about FFI Panama Implementation
roberto.minoletti at trusthub.cloud
roberto.minoletti at trusthub.cloud
Wed Feb 5 00:03:03 UTC 2025
Hello Maurizio,
Thank you to provide the right contact of the Panama project (I reached to
you in LinkedIn some days ago)
I am writing to you on behalf of a backend development team that is trying
to accomplish our requirements.
We need to interact from our java code (JDK21 that we can easely update to
JDK23 if required and Spring Web-Flux) to a C++ library that allow to create
Slots, generate Keypairs store Certificates simulating a real HSM (Hardware
Security Module). This is named libsofthsm2.so (SoftHSM2).
As I mentioned we customized this library as we need to store certificates
and keys in a different path for each user. One important requirement is
that we need to be able to process many requests coming from many different
users to the same library that should operate in different paths at the same
time.
We preliminary resolved a POC using JNA but when tried to execute many
parallel treads we faced with his singleton limitation and after a deep
reasearch we founded Panama project.
Does Panama FFI support multiple parallel treads? Does it have any Singleton
limitations?
What we need is to get many objects/treads at the same time (paralley)
loading its own different instance of the same library, getting its own
memory context, variables and states, all completely isolated but working at
the same time. This was not possible for us because JNA uses the Singleton
pattern to load the library directly into the process, making it only
possible to have a single instance of the library for the entire process.
The goal is that each object/tread parallely instantiate the same library
but having isolated states, configurations and variables stored in a
dedicated memory slot for each tread, so even if the C++ library maybe does
not completely support cuncurrency itself it should attend multiple treads
as it is virtually responding at once having one specific configuration per
user.
What we are looking for is that each ARENA has access to libsofthsm2.so and
its internal variables using that dedicated memory space to each tread to
calculate the operations it must perform.
Does Panama FFI allow all this? This is the first basic question we have.
After this we will be able to perform more specific questions.
Also if you have any sample of code that use Arena.ofConfined() or any
Custom Arena it would be really fantastic.
Thank you in advance for any information and/or support impelmenting Panama
in our Project.
Roberto Minoletti
Trusthub LLC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20250204/262b0a98/attachment.htm>
More information about the panama-dev
mailing list