<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;
        mso-fareast-language:EN-US;}
span.EstiloCorreo18
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:11.0pt;
        mso-ligatures:none;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ES link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>Hello Maurizio,<o:p></o:p></p><p class=MsoNormal style='text-indent:35.4pt'>Thank you to provide the right contact of the Panama project (I reached to you in LinkedIn some days ago)<o:p></o:p></p><p class=MsoNormal>I am writing to you on behalf of a backend development team that is trying to accomplish our requirements.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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).<o:p></o:p></p><p class=MsoNormal><span lang=IT>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=IT>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=IT><o:p> </o:p></span></p><p class=MsoNormal><span lang=IT>Does Panama FFI support multiple parallel treads? Does it have any Singleton limitations?<o:p></o:p></span></p><p class=MsoNormal><span lang=IT>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=IT><o:p> </o:p></span></p><p class=MsoNormal><span lang=IT>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=IT><o:p> </o:p></span></p><p class=MsoNormal><span lang=IT>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=IT><o:p> </o:p></span></p><p class=MsoNormal><span lang=IT>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=IT>Also if you have any sample of code that use Arena.ofConfined() or any Custom Arena it would be really fantastic.<o:p></o:p></span></p><p class=MsoNormal><span lang=IT><o:p> </o:p></span></p><p class=MsoNormal><span lang=IT>Thank you in advance for any information and/or support impelmenting Panama in our Project.<o:p></o:p></span></p><p class=MsoNormal><span lang=IT><o:p> </o:p></span></p><p class=MsoNormal><span lang=IT>Roberto Minoletti<o:p></o:p></span></p><p class=MsoNormal><span lang=IT>Trusthub LLC<o:p></o:p></span></p></div></body></html>