Java C++ without JNI

anon :

My app is written in Java. There is a C++ library I need to utilize. I don't want to use JNI.

60 times a second, the C++ app needs to send the Java app 10MB of data; and the Java app needs to send the C++ app 10 MB of data.

Both apps are running on the same machine; the OS is either Linux or Mac OS X.

What is the most efficient way to do this? (At the moment, I'm considering TCPIP ports; but in C++, I can do memory mapping -- can I do something similar in Java?)

Thanks!

bmargulies :

Using mapped files is a way of hand-rolling a highly optimized rpc. You might consider starting with a web service talking over local sockets, using MTOM for attaching the data, or just dropping it into a file. Then you could measure the performance. If the data was a problem, you could then use mapping.

Note that there are some odd restrictions on this that make your code sensitive to whether it is running on Windows or not. On Windows, you can't delete something that is open.

I should point out that I have done exactly what you are proposing here. It has a control channel on a socket, and the data is shared via a file that is mmapped in C++ (or the Windows equivalent) and NIO mapped in Java. It works. I've never measured maximum throughput, though.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

JNI: From C code to Java and JNI

From Java

write a buffer in memory from C/C++ and read from it in java without JNI

From Dev

call android activity from jni directly from c++ process without java side

From Dev

Java-Program terminating early without error-message after being called from C++ via JNI

From Dev

c++ Plugin -> JNI --> Java Classpath

From Dev

C++ Multithread Java JNI method Call

From Java

Java / C++ Encryption and the JNI interface

From Java

Passing pointers between C and Java through JNI

From Java

C++ Java wrapper construction with JNI

From Java

JNI Invocation API - NoClassDefFoundError (C/Java)

From Java

Rewrite C code in Java or use JNI?

From Java

Send C++ string to Java via JNI

From Java

passing string array from java to C with JNI

From Java

Returning a C++ class to Java via JNI

From Java

Wrapping a Java library with C++ (JNI)

From Java

How to send Java ByteBuffer to C using JNI?

From Java

JNI: passing integer array from Java to C

From Dev

JNI conversion from Java to C++

From Dev

Android "hello world" app in C++ without JNI

From Java

Java JNI - associating resources allocated in C with java objects?

From Java

Passing Java ArryList<String> to JNI C function and print the list in C

From Java

How to Use Eclipse to Debug JNI code (Java & C/C++)

From Dev

Unable to make JNI call from c++ to java in android lollipop using jni

From Java

How to manage memory deallocation properly between C++ and Java with JNI?

From Dev

How to call a function with arguments in C++ from JAVA using JNI?

From Dev

Call a function in java from C outside of a JNI function (Android)?

From Java

How to pass List from Java to JNI C++ as vector by ref?

From Java

Can't call java methods from c++ wrapper in JNI

From Java

In JNI, can you pass a C integer parameter to a Java primitive int?

Related Related

  1. 1

    JNI: From C code to Java and JNI

  2. 2

    write a buffer in memory from C/C++ and read from it in java without JNI

  3. 3

    call android activity from jni directly from c++ process without java side

  4. 4

    Java-Program terminating early without error-message after being called from C++ via JNI

  5. 5

    c++ Plugin -> JNI --> Java Classpath

  6. 6

    C++ Multithread Java JNI method Call

  7. 7

    Java / C++ Encryption and the JNI interface

  8. 8

    Passing pointers between C and Java through JNI

  9. 9

    C++ Java wrapper construction with JNI

  10. 10

    JNI Invocation API - NoClassDefFoundError (C/Java)

  11. 11

    Rewrite C code in Java or use JNI?

  12. 12

    Send C++ string to Java via JNI

  13. 13

    passing string array from java to C with JNI

  14. 14

    Returning a C++ class to Java via JNI

  15. 15

    Wrapping a Java library with C++ (JNI)

  16. 16

    How to send Java ByteBuffer to C using JNI?

  17. 17

    JNI: passing integer array from Java to C

  18. 18

    JNI conversion from Java to C++

  19. 19

    Android "hello world" app in C++ without JNI

  20. 20

    Java JNI - associating resources allocated in C with java objects?

  21. 21

    Passing Java ArryList<String> to JNI C function and print the list in C

  22. 22

    How to Use Eclipse to Debug JNI code (Java & C/C++)

  23. 23

    Unable to make JNI call from c++ to java in android lollipop using jni

  24. 24

    How to manage memory deallocation properly between C++ and Java with JNI?

  25. 25

    How to call a function with arguments in C++ from JAVA using JNI?

  26. 26

    Call a function in java from C outside of a JNI function (Android)?

  27. 27

    How to pass List from Java to JNI C++ as vector by ref?

  28. 28

    Can't call java methods from c++ wrapper in JNI

  29. 29

    In JNI, can you pass a C integer parameter to a Java primitive int?

HotTag

Archive