简体   繁体   English

2015年的Java进程间通信(没有锅炉板)?

[英]Java inter-process communication in year 2015 (with no boiler-plate)?

My use-case: 我的用例:

  • process-1 "database" that loads >1GB of data into memory from data-files (just the loading takes 30-60 seconds) process-1“数据库”,从数据文件加载> 1GB的数据到内存中(只需加载30-60秒)
  • process-2 "client" wants to access that data quickly without having to load it all process-2“client”想要快速访问该数据而无需全部加载

They are separate processes ran on same machine. 它们是在同一台机器上运行的独立进程。 Data I would like to transfer between the processes is Collections (lists, maps) containing primitive-types (integers, strings, booleans). 我想在进程之间传输的数据是包含原始类型(整数,字符串,布尔值)的集合(列表,映射)。

I know that this can be done by opening socket-connect (creating some specific protocol in serializing the data) or by RMI (more or less the same thing). 我知道这可以通过打开socket-connect(在序列化数据时创建一些特定协议)或通过RMI(或多或少相同的东西)来完成。 We did both of these already 15 years ago. 我们在15年前做过这两件事。 Hasn't anyone automatized this by now so that by using some library you could just set up @InterProcessMethod("some", "details") and be able to invoke methods on different JVM without having to implement serializations etc. each time? 现在没有人自动化这个,所以通过使用一些库你可以设置@InterProcessMethod("some", "details")并且能够在不同的JVM上调用方法而不必每次都实现序列化等等? (because of the primary types this shouldn't be too complex). (因为主要类型不应该太复杂)。

A company called Caucho used to have some product to tackle this issue but I cannot find it from their webpage anymore. 一家名为Caucho的公司曾经有一些产品来解决这个问题,但我再也找不到他们的网页了。 Then again, it was a sort of web-service instead RPC. 然后,它再次是一种Web服务而不是RPC。

Not that I now of. 不是我现在的。 The more "2015" would be to stay with RMI, or, refactor your backend into a REST API and connect it via JSON, and then, if you want, serialize/deserialize it with Jackson or even by hand (In some very performance oriented scenarios). 更多的“2015”将与RMI保持一致,或者将您的后端重构为REST API并通过JSON连接它,然后,如果您愿意,可以使用Jackson或甚至手动序列化/反序列化它(在一些非常注重性能的方面)场景)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM