实体Bean容器与容器管理持久化的研究与实现
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
EJB(Enterprise Java Bean)是为开发和部署基于组件的分布式应用而定义的组件体系结构。与其他组件技术相比,EJB组件具有可扩展性、事务性和并发访问安全性,而且EJB组件使用纯Java编写,具有更好的平台独立性,在分布式系统的开发方面有显著的优势。
     实体Bean是EJB的一种。EJB规范定义两种实现实体Bean的方法:BeanManagedPersistence(BMP)和ContainerManagedPresistence(CMP)。使用CMP时,容器自动将对象操作转换为数据库操作,是一种典型的对象持久化技术。当前存在多种对象持久化技术,包括对象数据库技术、JDO技术和DAO技术等,但是它们都有自身的缺陷,不能高效的用于分布式应用的丌发。相比之下,实体Bean技术应用广泛,经过不断的发展,已经具备了比较完善的功能,并形成了全面细致的规范。
     实体Bean规范规定了实体Bean的开发方法,实体Bean容器的功能和持久化管理器的功能。但是该规范没有规定后两者的实现方法。目前大多数的J2EE应用服务器都实现了实体Bean容器和持久化管理器,但随着实体Bean应用的推广,都暴露出一些缺陷,例如:没有完全遵守规范;并发访问效率较低;容易发生死锁;配置性较低等。此外,实体Bean规范也暴露出很多不足。
     本文提出了一种实体Bean容器和CMP持久化管理器的实现方法。为了避免上述缺陷,同时获得较高的性能,我们在设计时除了考虑基本的需求,还重点研究了线程池、并发控制和死锁检测算法。在实现CMP持久化方面,我们使用关系数据库作为存储介质,通过选择最佳的映射策略能够保存实体Bean的对象特性,并通过优化数据库访问操作获得较高的性能。整个实现不仅完全遵守实体Bean2.1规范,还对规范中不方便编程的部分进行了增强,并具有较高的性能和较强的定制功能。
     该实体Bean容器和持久化管理器已经在网络应用服务器OnceAS中实现,OnceAS遵守J2EE1.3规范。
The Enterprise JavaBeans architecture is a component architecture for the development and deployment of component-based distributed business applications. Applications written using the Enterprise JavaBeans architecture are scalable, transactional, and multi-user secure. Programmed with pure Java, The EJB component is independent of the platform. For this independence, the EJB is more fittable to develop distributed application than other component-based technology.
    The entity bean is one type of EJB. Because it can persist its state, it is often used to represent the business entity. There are many kinds of technology that can be used to persist object, but none of them except the entity bean can be efficiently used to develop a distributed application. One reason is that they don't have a complete specification. But the entity bean has one.
    The EJB specification defines how to develop an entity bean and what support is necessary for it to run. However, it is not specified how to provide those supports. There are many application servers that implement the functions defined in the sepecification. However, as the entity bean is more and more widely used, the deficiency and inconvenience is more and more clear. A better implementation is expected.
    This paper represents an implementation of parts of the specification for the entity bean. In the implementation, we try to avoid the known deficiencies. So we adopt the following mechanisms: an object cache, a configurable synchronize policy and a dead-lock-detection algorithem. Besides, we also try to improve the persistent mechanism by adopting the following: selection of the best OR mapping, optimization of the database-access operation. In one word, the implementation is high performance, EJB2.0 compliant and easy to configure.
    The implementation is a key component of OnceAS, which is a J2EE1.3 compliant application server developed independently by TCSE, ISCAS.
引文
[1] Sun Microsystems, JavaTM 2 Platform Enterprise Edition Specification,vl.3, March 30,2001.
    [2] Sun Microsystems, Enterprise JavaBeansTM Specification, Version 2.1, July 3, 2003.
    [3] Ed Roman, Scott Ambler, et al, Mastering Enterprise JavaBeansTM, Second Edition, 2002.
    [4] Bruce Eckle, Thinking in Java, 2nd Edition, September 13, 2002.
    [5] David Jordan, Craig Russell, JDO or CMP, URL:http://www.onjava.com/pub/a/onjava/2003/05/21/jdo.html, May 21, 2003.
    [6] JavaDataObjectsExpertGroup, JavaTM Data Objects version 1.0.1,May 31,2003.
    [7] Sun Microsystems, Java Naming and Directory Interface Application Programming Interface, July 14,1999.
    [8] Sun MicroSystems Inc., JDBC 2.1 API, October 5,1999.
    [9] Mark L. Fusell, Foundation of Object Relational Mapping, July 15,1997.
    [9] Wolfgang Keller, Mapping Objects to Tables-A pattern language, 1997.
    [10] Scott W.Ambler,张笑猛译,鲁棒的数据库持久层设计,1998.
    [11] Bil lewis, Daniel J.Berg, PThreads Primer-a guide to multithread programming, 1996.
    [12] DouglasSehmidt, Pattern-oriented software architecture, patterns for Concurrent and NetWorked Objects, Volume 2, 2000.
    [13] C.J.Date, An Introduction to Database System, seventh edition, 1999
    [14] Erich Gamma, Richard Helm, et al, Design Patterns, Elements of Resusable Object-Oriented Software, 1995.
    [15] Scott Oaks, Henry Wong, Java Threads, 2nd Edition, January 1999.
    [16] WebLogic Server,实体Bean的承诺,December 2002.
    [17] Johnathan Lurie, Develop a Gneric Cahcing Service To Improve Performance, URL:http://java.sun.com/developer/technicalArticles/ALT/cachingservices/, July,2001.
    [18] Yasmin Akbar-Husain, Eoin Lane, Optimistic Locking pattern for EJBs-
    
    Deploy transactionally safe EJB code, URL:http://www.javaworld.corn/javaworld/jw-07-2001/jw-0713-optimism.html,June, 2000.
    [19]Arunabh Hazarika, Srikant Subramaniam, WebLogic Server 性能调优,URL: http://www.cn-java.com/target/news.php?news id=2061, Oct, 2002.
    [20]JFox 小组讨论,JFoxEJB的设计和实现,URL: http://www.huihoo.org/chat/jfox 20030317.html, March, 2003.
    [21]板桥里人,为什么要使用FIB?URL:http://www.jdon.com/artichect/whyEJB.htm, Mar, 2004
    [22]李清勇,从java内核看性能分析与设计,URL:http://www.ccw.com.cn/htm/center/tech/02 6 24 5.asp, July,2002
    [23]林世彪,Webframe应用服务器EJB容器关键技术研究与实现,硕士毕业论文,June,2003。
    [24]陈宁江,金蓓弘,范国闯,多层企业应用的关键:J2EE应用服务器,计算机科学,Vol 30(1),2003。
    [25]冯玉琳,黄涛,金蓓弘,网络分布计算和软件工程,科学出版社,2003年5月。
    [26]范国闯,林世彪,等,WebFrame:一种多层次可扩展的Web应用服务器,计算机学报,27(4),2004。
    [27]冯玉琳,黄涛,倪彬,对象技术导论,科学出版社,1998。

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700