HSF source code reading

1 Service Provider Registration and Release

First, the service publishes the initialization bean. The HSFSpringProviderBean implements three interfaces of Spring and binds the publish of HSF to the life cycle of the Spring container.

1) InitializingBean, implement the afterPropertiesSet interface, call before the init method, and execute the initialization information published by the service

2) ApplicationContextAware, the method will be executed before the Spring container loads the bean. The most important thing here is to set isInSpringContainer=true. What does it do for subsequent initialization? Generally, when configuring HSFSpringProviderBean, we will specify its init-method, which is an initialization method executed after the HSFSpringProviderBean is loaded. This initialization method is to judge the value of isInSpringContainer. If it is true, the publish operation will not be performed here.

3) ApplicationListener, this method will be called back by Spring after all beans are initialized, which ensures that when all beans are initialized (including various setting injection and init method execution), it is judged that the event ContextRefreshedEvent is used to execute the publish method. , When Spring is destroyed, it judges the ContextClosedEvent event and executes the shutdown of the service .

2 Service consumers subscribe and be pushed

3 The service consumer initiates a call

4 The service provider processes the request

5 Service consumers get results

 

The process will be supplemented gradually. . . .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326014840&siteId=291194637