Jgroups [0]-XML Protocol Configuration File

Source: Internet
Author: User

Jgroups is still useful in the cluster environment, such as developing a distributed cache Layer Based on jgroups & memcached, splitting cluster tasks and

Merge computing results, jbosscache component...

XML-protocol stack-an example of TCP. XML standard for jgroups
1. Read the <element> set in the <config> lower part of the XML file. Each <element> is initialized to a protocolconfiguration
-Protocolconfiguration-> protocol_name | Map <key, value>
Form a list <protocolconfiguration>
------
2. protocolconfiguration parameter Processing
A. iterate every key-value of map to process value. If group (1) in the regular expression $ {([^ \}] +)} In value is found, it is extracted for processing.

B. extracts all the Groups (1). If the regular expressions ([^:] +) :( [^:] +) are used, group (1) and group (2) are used) extracted separately, otherwise the entire
As a group (1)

C. if group (1) satisfies [([^,] +),] * ([^,] +), all group iterations are extracted to call system. getproperty (value) if not empty
Exit iteration. If the value obtained by group (1) is null, use group (2) instead. If the value obtained by this layer is not
If it is null, the group (1) of the previous layer uses this value instead. Otherwise, the key-value is deleted from the protocolconfiguration attribute.
------
3. Build protocol stack protocolstack
A. List <protocolconfiguration> to list <protocol> Processing
Iterate protocolconfiguration to initialize the Protocol Class Based on protocolconfiguration. protocol_name.
Protocolconfiguration. properties: Set the properties of protocol. The specific step is to first obtain the outdated Protocol
Properties are removed from properties, and the properties that can be set in protocol can be obtained. If properties contains properties, the properties are set,
Finally, if there are redundant mappings in properties, an exception is thrown. Initialize a list <protocol> generated protocol and add it to this list.

B. List <protocol> Verification
The first step is to verify whether the list <protocol> is repeated, and then the protocol that requires the services provided by the upper and lower layers to be connected to each layer.
And the following protocol to find whether it provides the services it needs

iterate the list to connect the Protocol linked list
-----------
-Protocol protocol: List
-protocol. upprotocol = nextprotocol
-nextprotocol. downprotocol = protocol
-----------
C. protocol Stack protocolstack itself is also a protocol, which maintains two references to top_prot and bottom_prot, where top_prot is
streaming_state_transfer, bottom_prot is TCP, and top_prot's upprotocol is set to protocolstack.
call protocol. init in reverse order to initialize the protocol.

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.