Java Inter-process communication

Source: Internet
Author: User

The approach that Java interprocess communication can take:

Socket/rmi/webservice/webserver, all of which enable direct data exchange
Database/file, these allow for indirect data exchange
See if your business requires real-time, and if not, it's easier to Exchange databases

In addition to sockets, the preferred IPC can either use RMI or CORBA.
In fact, the CORBA implementation of Java is also achieved through RMI, and RMI in the final analysis by the socket to achieve.
So the most basic means of communication between Java processes is that the socket is not too.

Inter-thread communication:

You can directly pass in shared variables to implement

If it's a two-computer communication ... Everything is a socket ... What Mina Ah, MQ Ah, HTTP ah, can achieve AH

If it is local, the method is more, file, database, memory ...

You can use the Actor model Java or Scala implementation, now Akka and Jactor can try, but it is recommended that you use Akka, Java version of the API, the use is very simple, performance is also possible.

The traditional way of interprocess communication is as follows: (1)    pipe   (2)    named pipe (FIFO)   (3)    semaphore (Semphore)   (4)    message Queue (MessageQueue)   (5)    shared memory (sharedmemory)   < EM id= "__mcedel" > (6)    Socket

How Java supports inter-process communication. We understand the Java process as a JVM process. It is clear that most of these traditional technologies cannot be exploited by our applications (these interprocess communication is implemented by system calls). But there are many ways in which Java can communicate between processes.

In addition to the socket mentioned above, of course the preferred IPC can use RMI, or CORBA can also. In addition, Java NiO's mappedbytebuffer can also be used to implement interprocess communication (shared memory) through a memory-mapped file.

Java Inter-process communication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.