Is there any better/smarter way to put
and get
a boolean value from memory system
, but not using any TCP/UDP
nor local file system
method?
For example:
#both running as 1 application separately
$ java -cp /var/tmp/J.jar System.Backend
$ java -cp /var/tmp/J.jar System.Frontend
Where Backend
does memory allocation, and Frontend reads it on the fly, none of them will be able to use TCP/UDP nor File system.
AFAIK, The only way to use shared memory in pure Java is to use memory mapped files.
If you want two pieces of code to share memory, the simplest thing to do is to use one JVM. There is rarely a good reason to use more than one JVM with tightly couple code.
如果您可以使一个应用程序通过Process API启动另一个应用程序,则它们可以通过标准输入与输出进行通信。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.