Distributed Database System-Implementation of business travel booking system (7)

Source: Internet
Author: User
Construction of service station

The terminus acts as the transaction processing and coordination in the system. Each client must connect to the terminus before requests are required. Process the service provided by the terminus. In the specific coding implementation, the station's position is the same as that of several other servers. When calling it, you only need to find the method of the corresponding station for processing. The main functions are as follows:

Namespace globalservice {// <summary> // all transactions must be executed using the following processtransaction () method: /// * 1. accept and set the table transaction number string Xid // 2. implement icarremoteservice m_carremoteservice by accepting and setting the service interface of table car; // 3. ihotelremoteservice m_hotelremoteservice is implemented by accepting and setting the service interface of the table hotel; // 4. implement iflightremoteservice m_flightremoteservice by accepting and setting the flight service interface; // 5. implement icustomerremoteservice m_customerremoteservice by accepting and setting the service interface of table customer; // 6. implement ireservationremoteservice m_reservationremoteservice by accepting and setting the service interface of table reservation; // * 7. the transactionentity m_transactionentity service interface of the transactionentity table is accepted and set; // </Summary> public class globalcontrolserviceimpl: externalbyrefobject, iglobalcontrolservice {

Parameter List of the terminus

 

Static void main (string [] ARGs) {# Start the region terminus // tcpserverchannel changlobalservice = new tcpserverchannel (9991); // channelservices. registerchannel (changlobalservice, false); // remotingconfiguration. registerwellknownservicetype (typeof (globalcontrolserviceimpl), "service", wellknownobjectmode. singleton); binaryserverformattersinkprovider serverprovider = new binaryserverformattersinkprovider (); binaryclientformattersinkprovider clientprovider = new binaryclientformattersinkprovider (); serverprovider. typefilterlevel = typefilterlevel. full; idictionary props = new hashtable (); props ["name"] = "remotetcp"; props ["Port"] = "9991"; tcpchannel Chan = new tcpchannel (props, clientprovider, serverprovider); channelservices. registerchannel (Chan, false); remotingconfiguration. registerwellknownservicetype (typeof (globalcontrolserviceimpl), "service", wellknownobjectmode. singleton); remotingconfiguration. registerwellknownservicetype (typeof (queuetransactionserviceimpl), "queue", wellknownobjectmode. singleton); console. writeline ("terminal started successfully... "); console. readline (); # endregion # connect the region terminus to the car table // tcpclientchannel Chan = new tcpclientchannel (); // channelservices. registerchannel (Chan, false); // icarremoteservice carremoteservice = (icarremoteservice) activator. getObject (typeof (icarremoteservice), "TCP: // localhost: 9999/search", null); # endregion}

Terminal startup code

 

Because the terminus needs to operate on each data service set, it must also accept the interface implementation class of each data service set when accepting parameters to ensure normal operation of the data set.


Figure. Relationship between servers, servers, and clients

Related Article

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.