Hello,
I am working for a product company, where we are trying to build an application which has the following layers:-
1. Presentation Layer (Developed using Java - Android App facing the user)
2. Client Layer - biz logic and client to the Server layer below - C/C++
3. Server Layer - mainly a single file database manager (our own database) and communication manager for internet communication - C/C++
Now, we are doing various experiments to find the best way to achieve intra-process communication in these three layers - layers 2 and 3 are straight forward, they are talking natively using C/C++ classes/methods/functions. We are mainly looking for a way to communicate between Layer 1(Java) and Layer 2(C/C++). One obvious choice is JNI. But JNI comes with lots of overhead - the data conversions/serialization being one of them. Secondly, our database going to store large objects and using JNI to pass objects between them are not really an option.
Therefore we are exploring the option to share data through Android kernel - named pipe, shared memory etc. - where we can handle raw data. We found the share memory has very limited suport (POSIX standards not implemented). We also tried using file-backed mmap() - there the problem is it very unreliable.
Keeping in mind that we will be supporting Android API level 21 onwards (Lollipop), what is the best way forward for this architecture?
Regards,
Tuhin Sengupta