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