Building Dubbo service jar packages with Maven

Source: Internet
Author: User
Tags tomcat

Server: 192.168.1.121 (edu-provider-01)


First, the operation mode of Dubbo service:
1. Running with the servlet container (Tomcat, jetty, etc.)----non-fetching disadvantage: Increased complexity (port, management)

Tomcat/jetty Ports, Dubbo services also require ports

Waste of resources (memory): Starting Tomcat,jetty separately consumes large memory

2, self-built Main method class to run (Spring container)----Not recommended (local debugging available)

Cons: The advanced features provided by DOBBO itself are useless on self-written startup classes that may be defective

3. Use the Main method class provided by the Dubbo Framework to run (Spring container)----Recommended advantages: Provided by the framework itself (Com.alibaba.dubbo.container.Main)

Graceful shutdown Possible (Shutdownhook)

Watch out.

Spring-context.xml

<import resource= "Classpath:spring/xxx.xml"/>

Official: The loading content of the service container can be extended with the built-in spring, jetty, log4j and so on, which can be extended by container extension points.
Dubbo is graceful shutdown through the shutdownhook of the JDK, so if the user uses the "kill-9 pid" and other forced shutdown instructions, it will not perform graceful shutdown, only through the "kill PID" will be executed.
Principle:
When the service provider stops, it is marked as not receiving the new request, and the new request comes in with a direct error, allowing the client to retry the other machine. It then detects if the thread in the thread pool is running, and if so, waits for all threads to complete, forcing it to close unless it times out.
When the service consumer stops, no new call requests are initiated, and all new calls are error on the client side. Then, detects that there are no requested responses that are not returned, waits for the response to return, and forces the shutdown unless it times out.

Ii. maven build Dubbo Service executable jar package configuration

[HTML]  View plain  copy   <span style= "FONT-SIZE:14PX;" ><!--maven Package Duboo executable jar begin -->       <build>            <finalName>edu-service-user</finalName>               <resources>                <resource>                    <targetpath>${ project.build.directory}/classes</targetpath>                    <directory>src/main/resources</directory>                     <filtering>true</filtering>                   <includes>                        <include>**/*.xml</include>                        <include>**/*.properties </include>                    </includes>                </resource>                <!--  Combined com.alibaba.dubbo.container.main -->                <resource>               &nbSp;    <targetpath>${project.build.directory}/classes/meta-inf/spring</targetpath >                    <directory>src/main/resources/spring</directory>                    <filtering>true</filtering>                     <includes>                        <include>spring-context.xml</include>                    </includes

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.