Actually already has the child shoe to Zico the source code and the running process to carry on the summary, for example: http://www.cnblogs.com/shuaiwang/p/4522905.html. Here I'll add some more content. When we packaged Zico into a war package using MVN install, After extracting it, you can see that the main class specified in the MANIFEST.MF file is: Com.jitlogic.zico.main.ZicoMain, simply look at this class and discover that its primary role is to start jetty Web Server and load the configuration file, Implement some security configurations. So we need to ask, how does this war package implement the receipt and processing of trace data? Let's briefly analyze the following:
We note that its web. XML has more configuration about Resteasy, according to netizens ' blog: Resteasy is one of JBoss's open source projects and is a RESTful website services framework. Bill Burke, Resteasy's developer, is also one of Jax-rs's standard-setting developers for Java EE.
The source of the above passage is here: http://blog.csdn.net/rubyzhudragon/article/details/7355383, in this blog, Also gives the author to use Resteasy when the Web. xml file, for a comparison, we can notice that the above blog is defined in the listener is: Org.jboss.resteasy.plugins.server.servlet.ResteasyBootstra P And in the Zico settings defined is: Com.jitlogic.zico.core.inject.ZicoRestBootstrapListener, against the source, found that the latter is inherited: org.jboss.resteasy.plugins.guice.g Uiceresteasybootstrapservletcontextlistener, by the class name can be guessed, the effect of the implementation is similar. It is important to note that, in terms of the class name, the Guice framework is used here, and Guice is an absolutely lightweight Java IOC container developed by Google Daniel Bob Lee. Bob Lee is also known as "Crazy Bob," whose Twitter ID is: @crazybob, haha, I don't know why this guy has this title, he has left Google a few years ago.
On the other side, the support for Guice is also described in Resteasy's documentation: http://docs.jboss.org/resteasy/docs/3.0.9.Final/userguide/html_single/ Index.html#guice1, combined with the introduction of netizens: http://blog.csdn.net/zhangzz1127/article/details/17428173, we can notice, indeed should be changed to Zico in the kind of configuration. Similarly, according to the official website, to implement the IOC, you need to specify the registration service class in Web. XML, with the following configuration in Zico:
<context-param> <param-name>resteasy.guice.modules</param-name> <param-value> Com.jitlogic.zico.core.inject.prodzicomodule</param-value></context-param>
This class needs to instantiate the Com.google.inject.Module interface and implement its configure (Binder binder) method, specifically to the implementation on Zico, as we can see, Prodzicomodule this inherits the Abstractzicomodule class, and the latter does instantiate the above interface. In the Configure methods of these two classes, there are some operations that rely on injection (or rollover control, IoC).
So the IOC this part of the process is completely clear, the following is a brief talk about how Zico started to receive data and other services, in fact, very simple, We return to the listener:com.jitlogic.zico.core.inject.ZicoRestBootstrapListener we just said and look at its source code a little bit.
Follow Resteasy's Java Doc introduction: Http://docs.jboss.org/resteasy/docs/3.0.9.Final/javadocs/org/jboss/resteasy/plugins/guice /guiceresteasybootstrapservletcontextlistener.html, For class Org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener, The subclass needs to override its Withinjector method and interact with the injector object inside the method, so this is the function, so through this sentence:
Injector.getinstance (Zicoservice.class). Start ();
We actually call the start method of the Com.jitlogic.zico.core.ZicoService class, and we can see that the start-up monitoring functions are implemented here, and then the other functions of Zico start to run (from this process alone, I really don't see the role of the IOC in this area.) )。 I believe that through such a summary, we can have a little in-depth understanding of the Zico operation process.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Zico Source Analysis: Run START process Analysis and summary