Java technology and principles of remote communication options (a)

2011-05-03  来源:本站原创  分类:Java  人气:93 

In a distributed service framework, one of the most basic question is how the remote service communications, there are many areas in Java enables remote communication technologies, such as: RMI, MINA, ESB, Burlap, Hessian, SOAP, EJB and JMS and so on, in the end between these terms is what relationship do they in the end is based on what principle behind the implementation of it, to understand these are the basics of the framework of distributed services, and if the requirements of high performance, then understanding mechanism behind these technologies is a must, and in this blog, we will find out, initiate, welcome to provide more remote communication technologies and principles of the introduction.

Basic principles

To implement the network communication between machines, computer systems must first take a look at the basic principles of network traffic, to see at the bottom level, network communication need to do is to flow from one computer to another computer, based on transport protocol and network IO to achieve, which are relatively well-known transport protocol http, tcp, udp, etc., http, tcp, udp Socket concept is based on certain scenarios and extended as a transport protocol, network IO, mainly bio , nio, aio three ways, all of the distributed application communications are achieved based on this principle, only for the application easy to use, all languages ​​are usually applied to provide some more close-to-use application layer protocol.

Application-level protocol

Remote service communications, need to reach the goal is to initiate a request in a computer, another computer after receiving the request processing and returns the results corresponding to the request side, of which they have, such as one way request, synchronization request, asynchronous request so the request method, in accordance with the principle of network communication, the need to achieve this have to do is convert the request stream, transmitted through the transmission protocol to a remote, the remote computer after receiving the request processing flow, will be disposed of results into streams, and returned to the caller through the transfer protocol client.
Principle is the case, but in order to facilitate the application, the industry introduced a lot of applications based on this principle, the protocol level, so we can not go directly to the underlying operating such a thing, usually application-level protocol for remote communication will provide:

1. To avoid such trouble streaming directly to do to provide a more user-friendly language, or fit a standard transmission format;
2. The realization of the network communication mechanism, that is it for you into a transmission format that will flow through a transmission protocol to transmit to a remote computer, remote computer, after receiving the stream into a transmission format and stored or in a ways to notify the remote computer.

Therefore, a remote learning application level communication protocol, we can learn with these questions:

1. Transmission standard format?
2. How to transmit the request into the flow?
3. How to receive and process flow?
4. Transfer Protocol is?

However, the remote application level communication protocol and transport protocol does not do much on improved, mainly in the flow of operation, the application layer to generate flow and processing flow of this process more of the language fit or standard, as transport protocol is usually optional, well known in the field of java are: RMI, XML-RPC, Binary-RPC, SOAP, CORBA, JMS, to look at the specific application-level remote communication protocol:

RMI

RMI is a typical custom for the java remote communication protocol, and we all know, in the single vm, we can directly call the java object instance to achieve communication, then the remote communication, if the can is the best course in this way , and this remote communication mechanism into RPC (Remote Procedure Call), RMI is born towards this objective.

View Based on a complete remote RMI communication process works:

1. The client initiated the request, the request forwarded to the RMI client stub class;
2. Stub class to the request interfaces, methods, parameters and other information to be serialized;
3. Based on the socket will be serialized stream to the server side;
4. After the server receives forwarded to the appropriate stream skelton class;
5. Skelton class to deserialize the requested information after the call to the actual handler class;
6. Handler class will be processed results back to the skelton class;
7. Skelton class to serialize the results, will be circulated through the socket to the client's stub;
8. Stub after receiving the stream to deserialize, the anti-serialized Java Object returned to the caller.

According to learning theory to answer before the next application-level protocol with several questions:

1. Transmission standard format?
Is a Java ObjectStream.
2. How to transmit the request into the flow?
Java serialization mechanism based on the request of the java object into a stream of information.
3. How to receive and process flow?
According to the agreement with the corresponding start listening port, when there is flow into the post will be based on Java serialization mechanism to deserialize the stream and get under the RMI protocol to the corresponding object information processing, and process a call to deal with the results after also based on java serialization mechanism to return.
4. Transfer Protocol is?
Socket.

XML-RPC

XML-RPC and RMI is a remote call protocol similar to it, and RMI is that it differs from the standard xml format to define the requested information (the request object, method, parameter, etc.) What are the benefits of this , that is, when the cross-language communication can also be used.

XML-RPC protocol under the terms of a remote communication process:

1. The client initiated the request, in accordance with the XML-RPC protocol to fill the request information;
2. Filled after conclusion of the xml into a stream, through the transmission protocol for transmission;
3. Received after receiving the stream is converted to xml, in accordance with the XML-RPC protocol to obtain the requested information and for processing;
4. The result will be disposed of in accordance with the XML-RPC protocol is written in xml and return.

To answer the same questions:

1. Transmission standard format?
Standard format of XML.
2. How to transmit the request into the flow?
XML into the stream.
3. How to receive and process flow?
By listening port access to the requested stream into XML, and to obtain the requested information under the agreement, for processing and writes the results returned in XML.
4. Transfer Protocol is?
Http.

Binary-RPC

Binary-RPC to see the name to know and XML-RPC is about the same, the difference only lies in the standard format for transmission by the XML into a binary format.

To answer the same questions:

1. Transmission standard format?
Standard format binary files.
2. How to transmit the request into the flow?
Binary format files into streams.
3. How to receive and process flow?
By listening port access to the requested stream, into a binary file, under the agreement to obtain the requested information, processing and writes the results returned in XML.
4. Transfer Protocol is?
Http.

SOAP

Intended for the SOAP Simple Object Access Protocol, is an environment for distributed, lightweight, XML-based exchange of information communication protocol, SOAP is the XML RPC can be considered a senior version of the principle of two identical, are http + XML, the only difference is the different between the two specifications define the XML, SOAP service call is Webservice protocol standards used, so this is not more elaborated.

CORBA

Common Object Request Broker Architecture (Common Object Request Broker [schedule] program architecture), is used to define a set of "distributed object system" standard, the OMG (Object Menagement Group) as the initiation and standard-setting units. The purpose is to define a set of CORBA protocols, in line with the agreement of the object can interact with each other, no matter what their language is written, whether they are run on what kind of machine and operating system.
CORBA, in my opinion is similar to the SOA architecture, covering the optional remote communication protocol, but it alone can not be included here in terms of communication protocols, and CORBA basically eliminated, along with CORBA is not on how to understand, in this not be explained.

JMS

JMS it is to achieve a java field of telecommunications means and methods of remote communication based on JMS and the RPC is different, although the effect of RPC can be done, but because it is not defined from the protocol level, so we do not think JMS is an RPC protocol, but it is a long-range communication protocol, in the other language system, there are also things like JMS, can this type of mechanism is called a unified messaging system, while messaging system it is usually high concurrency, distributed Recommended areas of a communication mechanism, where the main problem is fault-tolerant (for details see ErLang paper).

A look at JMS in the process of remote communication:

1. The client will request provisions into line with JMS Message;
2. Through the JMS API into the Message in the JMS Queue or Topic;
3. If the JMS Queue, the corresponding target Queue to send in, such as Topic, are sent to subscribers this Topic in JMS Queue.
4. Processing terminal through the rotation JMS Queue, to get the message, the message is received after the agreement to resolve under the JMS Message and treatment.

Answer the questions:

1. Transmission standard format?
JMS provides the Message.
2. How to transmit the request into the flow?
The parameter information into the Message can be.
3. How to receive and process flow?
Rotation JMS Queue to receive Message, after receiving treatment, after treatment is still a way into the Message Queue to send or Multicast.
4. Transfer Protocol is?
Limited.

Commonly used JMS is based on the asynchronous remote method calls one.

相关文章
  • Java technology and principles of remote communication options (a) 2011-05-03

    In a distributed service framework, one of the most basic question is how the remote service communications, there are many areas in Java enables remote communication technologies, such as: RMI, MINA, ESB, Burlap, Hessian, SOAP, EJB and JMS and so on

  • Java technology and principles of remote communication options 2010-07-23

    Transfer: http://leep123.javaeye.com/blog/169805

  • java simple implementation of remote communication technologies and 2010-11-12

    Transfer from this article: http://staratsky.javaeye.com/blog/345593 In a distributed service framework, one of the most basic question is how the remote service communications, and in many areas of Java can be the underlying remote communication tec

  • java remote communication technologies and easy implementation 2009-04-06

    public String sayHelloToSomeBody (String someBodyName) throws RemoteException; ) 2) remote object implementation package test.rmi; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; /** * User: staratsky * Date: 2008-8-7 21:

  • Enjoy Android Java technology applications Feast 2010-09-12

    Getting started This article describes the complex situation of several Android SDK tools. Develop Android applications that require the latest version of Android SDK, which requires a Java Development Kit (JDK). I am using Android 2.2 and JDK 1.6.0_

  • Remote communication (transfer) 2010-12-07

    In a distributed service framework, one of the most basic question is how the remote service communications, there are many areas in Java enables remote communication technologies, such as: RMI, MINA, ESB, Burlap, Hessian, SOAP, EJB and JMS and so on

  • Getting Started Java technology 2011-01-11

    Java technology? Java technology is both a high-level object-oriented programming language, but also a platform. Java technology is based on Java Virtual Machine (Java virtual machine, JVM) concept - this is the language and the underlying software a

  • Strongly recommended: a well-known social networking site LinkedIn structure of the Java technology 2009-11-13

    2008-10-25 Strongly recommended: a well-known social networking site LinkedIn structure of the Java technology Paste the original URL: http://www.jdon.com/jivejdon/thread/34214.html With the recommendation to see the original link, the article below

  • IBM Web site to talk about source code as well as with design patterns == IBM java technology TechZones 2010-04-04

    IBM Web site to talk about source code as well as with design patterns http://www.ibm.com/developerworks/cn/views/java/libraryview.jsp?view_by=search&search_by = Design Patterns IBM java technology TechZones http://www.ibm.com/developerworks/cn/java/

  • My blog address Sina JAVA technology 2010-04-14

    My Sina JAVA technology blog address: http://blog.sina.com.cn/JiangxiFandunyang These are the problems encountered in my work record; conducive to normal again, when faced easily accessible;

  • Java Technology Research Group 2010-06-15

    Java technology exchange group, basis of comparison, focuses on J2SE, plus interest: 114 571 650

  • Java technology order Part1 2010-06-25

    synchronized: 1. http://caterpillar.onlyfun.net/Gossip/JavaGossip-V2/ThreadSynchronized.htm wait (), notify (), notifyAll (): 1. http://caterpillar.onlyfun.net/Gossip/JavaGossip-V2/WaitNotify.htm 2. http://tw.myblog.yahoo.com/john-klee/article?mid=29

  • Recent study using JAVA technology crawl under, Oh, into the gates, to share their experiences and under 2010-07-17

    Recent study using JAVA technology crawl under, Oh, into the gates, to share their experiences and to provide under the following two methods, one is provided with the apache package. The other is to use JAVA native. Code: / / The first method / / Th

  • Inspirational quote, learn java technology 2010-10-21

    Today, I am determined to learn java technology, threw himself into it every day.

  • Java technology in multi-database System Research 2007-09-21

    Introduction Now a variety of database applications, due to technical, historical and other factors, often in co-existence of a large department with multiple applications. These applications may be scattered in different network nodes, based on diff

  • Java Technology wishing cow needed 25 points of study 2009-02-27

    1. You need to master the object-oriented analysis and design (OOA / OOD), involving patterns (GOF, J2EEDP) as well as the integrated model. You should understand the UML, especially class, object, interaction and statediagrams. 2. You need to learn

  • Java technology 25 study points 2009-02-27

    1. You need to master the object-oriented analysis and design (OOA / OOD), involving patterns (GOF, J2EEDP) as well as the integrated model. You should understand the UML, especially class, object, interaction and statediagrams. 2. You need to learn

  • Prefer to give the required Java technology Daniel 25 learning points (switch) 2010-03-29

    Although we are more than N reprinted, but still keep their own record of it, nothing else to do, you can flick through the ~ ~ ~ 1. You need to proficient in Object-Oriented Analysis and Design (OOA / OOD), involving patterns (GOF, J2EEDP) and the i

  • Daniel, a Java technology learning points required 25 2010-11-09

    1. You need to master the object-oriented analysis and design (OOA / OOD), involving patterns (GOF, J2EEDP) and the integrated model. You should be aware of UML, particularly class, object, interaction, and statediagrams. 2. You need to learn the bas

  • Java technology to collect a variety of SNMP based data. MIB data products 2010-12-09

    ObjectSNMP SNMP is an object-oriented development of components, with a relational database similar to the popular OR Mapping technology to realize the operation of SNMP MIB Object to the map (referred to as OM Mapping), the system provides a Java /