1 / 30

本课件仅用于北京航空航天大学计算机学院的教学; 本课件修改采用了一些网络资源(论文、研究报告、技术报告等),在采用的时候并没有准确标注引用信息。

声明. 本课件仅用于北京航空航天大学计算机学院的教学; 本课件修改采用了一些网络资源(论文、研究报告、技术报告等),在采用的时候并没有准确标注引用信息。. 第 5 章 JBoss 分析. 北航计算机学院 linxl@buaa.edu.cn 2006 年 2 月 1 日. JBoss Overview EJB Container Framework Container ContainerInvoker How does it work JBoss Source Code. 5.1 JBoss 概况. JBoss

umeko
Download Presentation

本课件仅用于北京航空航天大学计算机学院的教学; 本课件修改采用了一些网络资源(论文、研究报告、技术报告等),在采用的时候并没有准确标注引用信息。

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 声明 • 本课件仅用于北京航空航天大学计算机学院的教学; • 本课件修改采用了一些网络资源(论文、研究报告、技术报告等),在采用的时候并没有准确标注引用信息。

  2. 第5章 JBoss分析 北航计算机学院 linxl@buaa.edu.cn 2006年 2 月 1 日

  3. JBoss Overview • EJB Container Framework • Container • ContainerInvoker • How does it work • JBoss Source Code

  4. 5.1 JBoss概况 • JBoss • JBoss is a free, open source J2EE implementation distributed under the LGPL license • It provides the basic EJB container as well as EJB services such as database access(JDBC), transactions(JTA/JTS), messaging(JTS), naming (JNDI) and management support(JMX) • It is 100% pure java and can run on any platform

  5. JBoss Architecture JMX is a reusable framework that can expose the applications to the remote or local management tools

  6. 5.2 EJB Container Framework • The client does not access to the ejb instance direclty rather than interacts with home (EJBHome) and remote object (EJBObject) interfaces provided by the container. • The Container forward the calls from client to bean instance to perform operations. EJB Container Framework EJB (n) (1) (n) Home Object Remote Object

  7. EJB Container Framework EJB (n) (1) (n) Home Object Remote Object • Container Conceptual Architecture Model

  8. 5.3 Container • There are four subclasses of Container • StatlessSessionContainer • StatefulSessionContainer • EntityContainer • MessageDrivenContainer. • Containers are created and initialized at the deployment time by the ContainerFactory according to the bean type. EJB Container Framework EJB (n) (1) (n) Home Object Remote Object

  9. StatefulSessionContainer EJB1 StatefulSessionContainer EJB2 EJB1 StatefulSessionContainer EJB2 EJB5 EJB3 EJB4 StatefulSessionContainer EJB3 StatefulSessionContainer EJB4 StatefulSessionContainer EJB5 一个萝卜一个坑

  10. 5.4 ContainerFactory • A ContainerFactory is used to create EJB container and deploy EJB into the container. • ContainerFactory is implemented as a MBean. • Its services start as the JBoss server starts. • It can be given a URL to an EJB-jar XML file. • ContainerFactory use the metadata in EJB-jar XML to instantiate containers and make them available for invocation

  11. During the deployment, the functionality of ContainerFactory includes: • Create subclasses of Container depending on the EJB type in the deployment descriptor files • Set the container attributed based on jboss.xml and standardjboss.html files • Create and add container interceptors as configured in standardjboss.html files • Associate the container with the application object EJB Container Framework EJB Container EJB Home Object Remote Object

  12. 5.5 ContainerInvoker • EJB Container并没有接收Remote Object的调用,而是接收ContainerInvoker的调用 • ContainerInvoker通过客户端的请求 (request)方法来调用相应的容器。可以看作客户端请求和容器间的接口 EJB Container Framework EJB Container Container -Invoker EJB Home Object Remote Object

  13. EJB Container Framework EJB Container JRM Container Invoker EJB Home Object Remote Object public interface Adder extends EJBObject { public int add(int x, int y) throws RemoteException; } 调用过程涉及的环节是否过多? 5. 函数调用 3. 函数调用信息:对象标识,函数名(add) , 参数信息( x=1, y=2) 4. 函数调用信息(Invocation) JRMP 2. 函数调用 1. 远程调用信息:对象标识,函数名(add),参数信息( x=1, y=2)

  14. EJB Container Framework EJB Container JRM Container Invoker EJB Home Object Remote Object JRMP 都是Container动态生成的,可否合并?

  15. In the design of JBoss EJB container, there is NO EJBHome and EJBObject object implementation at all. EJB Container Framework EJB Container EJB ContainerInvoker JRMP

  16. ContainerInvoker • ContainerInvoker will invoke the container for the method invocation representing of client request. It is interface between client request and container. • ContainerInvoker works in the communication layer and it can be associated with a particular protocol. • A ContainerInvoker seperates the communnication protocal with the EJB implementation.

  17. JRMPContainerInvoker • JBoss communication layer replies on Sun's RMI using JRMP. • The RMI of version of ContainerInvoker is JRMPContainerInvoker. • It utilizes the RMI exporting to make itself available to accept calls from both remote clients living in other JVMs and from other beans of the same EJB application within the same JVM.

  18. JRMPContainerIvoker - home proxy • At the deployment time the ContainerFactory creates and initializes containers.The home object is generated as a dynamic proxy by JRMPContainerIvoker, • The proxy is serializible and it can be sent to the remote client across network. When a client looks up the EJBHome from JNDI and the home proxy instance is serialized. • At the client side, the home proxy instance is unserialized. Becasue the proxy implements the bean's home interface, it can be cast and used as the home interface.

  19. JRMPContainerIvoker – EJB object proxy • When a client requests a EJBObject using home object reference. The EJBObjectdynamic proxy is generated by the code shown above. • The same as home proxy, EJB object proxy can also be serialized and sent to the remote client across network. • Fianlly the client gets the handle of EJB object and can use it to invoke business method implemented in server side beans.

  20. JRMPContainerIvoker • JRMPContainerInvoker has optimization for handling the method invocation by providing two version of invoke() and invokeHome() method • The method invocation information is converted to MethodInvocation and passed to the container

  21. 5.6 How does it work

  22. Instance Pool • EJB object instances can be pooled to reduce the overhead at run time to creat them. • A pooled instance is not associated with any ejb object. They are managed by InstancePool. • Stateful session bean and entity bean instances can be cached. They have states in their life-cycle. • A cached instance is obtained from instance pool and associated with a particular object and has an identity. • The states are handled by InstanceCache, such as synchronization of the instance state in cache and in second storage

  23. Inteceptor • accepts the method invocation forwarded by container. • In the container configuration standardjboss.html file, the interceptors that the method invocation must pass through are defined in order.

  24. 5.7 JBoss源码 • 网址:http://www.jboss.com http://sourceforge.net/projects/jboss • 文件名:jboss-4.0.4RC1.zip jboss-4.0.4RC1-installer.jar jboss-4.0.4RC1-src.tar.gz • 解压缩:*.tar.gz文件请使用WinRAR 3.2以上版本,低版本WinRAR无法解压,提示文件破坏信息。 • 主要代码位于:/server/main/org.jboss.ejb

  25. 主要参考资料 • An Analysis of JBoss Architecture, Jenny Liu, 2002, http://www.huihoo.org/jboss/jboss.html

  26. The End!

  27. EJB Container ejb ejb EJB (n) (1) (n) Home Object Remote Object ?

More Related