Client can NOT call EJB direct, but through mediator
JMS in case of MDB(Message Driven Bean)
Container provides class implementing bean's interface: component interface & home interface
Instance of class implementing component interface is called EJBObject
client call EJB through two player: EJBObject & container
Things to remember - Inside a Bean
-
Do not directly read/write File Descriptor
-
Never try to obstain security policy of source code
-
Never use object substitute or subclass feature of java serializable protocol
-
Never pass this as parametor or return
-
Do not implement Bean as Server-like activity e.g. listener, multicasting on a socket
-
Never create/set/access classloader
-
Never set/create security manager
-
Never try to stop JVM
-
Never try to change input/output , error stream
-
Never try to set factory that is used by Server socket, and stream handle factory that is used by URL
-
Never
-
start, stop, resume a thread
-
change priority of a thread
-
change name of a thread
Same Bean can not define two env entries with same name
Different Bean can defined same env entries with same name, as when they access from bean it get its own variable
EJB communicate with container through SessionContext & SessionBean Interface
Home interface has create() and remove() method, create() needs to be defined, but remove() is inherited from parent
Create method in EJB
|
StateFul |
StateLess |
declare |
mandatory, no argument method |
at least one create() is mandatory, e.g.
createABC(...)
createBBB(...)
|
Bean instance creation |
create a new bean |
get bean from pooling |
Common property |
argument must be serializable, primitive |
argument must be serializable,primitive |
Remove method in EJB
|
Entity |
StateFul |
StateLess |
1. Remove(PrimaryKey)
2. Remove(Handle)
|
1 |
2. will remove instance |
2. no effect, will go back to pool
|
Common |
|
Contaner event, client can not call |
Contaner event, client can not call |
There is exactly one Object for each Session Bean Type, Multi EJBObject
e.g. 100 clients have 1 HomeInterface, but 100 EJbObject
method starting with ejbMethodA...() is container callback method
method can not throw RunTimeException(...)
isdential() method of EJBObject
-
stateful bean never been true
-
stateless bean return true, if referenced the client's handled by the same homeInterface
-
EjbObject are compared by isIdentical(), NOT equals()
EJBObject's remove() doesnt have argument, remove itself
HomeInterface's remove(...) has argument, as it needs argument to determine which one to remove
HomeLocalInterface does NOT have method for Handler & metaDate( in save JVM, information of method can be abtained from reflection)
Local HomeInterface doesn't have remove(handler), remove can be done directly call the LocalEJBOBject to remove itself
Remove sessionbean client can remove via RemoteHomeInterface & remote EJBObject
LocalHomeInterface can NOT be passed to remove call
In Bean method, dont declare throw RemoteException
setEntityContext and setSessionContext are used to setup sessionBean to interact with container
For stateful bean, when user call create(), createABC() in home Interface, EJB container will call ejbCreate() or ejbCreateABC() defined in session Bean respectively
EntityContext & SessionContext
-
One difference is that the entityContext has getPrimaryKey()
-
setSessionContext() can call two method of container: get Home Interface, and JNDI access
-
following method ejbCreate().
remove method call for statelss bean is ignored
Container will not passivate if session is in Transaction
remove is not call under:
-
time out in passivate state
-
bean throw exception
-
server crashes
Entity Bean
-
If can not find single entity, throw ObjectNotFoundException
-
If can not find group entity, return empty collection
For CMP, don't need write find method
For BMP, each findXXX method in Home Interface, must have a match ejbFindXXX in Bean Class
Home Interface can implement business logic which is not entity related
for each method, you are required to write ejbHomeXXX method in Bean
Each Bean Type has its own pool
Entity bean can only use ONLY CMT demartation, can NEVER use getUserTransaction method
Only difference between EntityContext & SessionContext is getPrimaryKey() defined in EntityContext
EJB Remote interface is closely related to RMI-IIOP protocol
Parameter passed into EJB method must be RMI-IIOP conpatible
EJB Object - Container generated Remote Interface Implementation
Local Object - Container generated local interface implementation
Home Object - Container generated home interface implementation
Loca home Object - Container generated local home interface implementation
System exception - Container will process it
Application excepton - should throw back to client/ the only exception for remote EJB thrown back is REMOTE or its subClass
EJB bean is called via EJB Object, thus if your bean calls another bean, you must pass reference to your bean's EJB Object rather than reference of your bean; Just like another client, everything must go through EJB Object
When bean is passivated, it might hold reference to container-implemented object, the following object will be passivated as well
-
EJB Object reference
-
Home Object reference
-
EJB context reference
-
JNDI naming context
Stateless can define a few overloaded ejbCreate(...)
Stateful can only define one empty ejbCreate()
The biggest difference between the stateful session bean and the other bean types is that stateful session beans don't use
instance pooling.
相关推荐
根据提供的文档内容,我们可以归纳出一系列关于SCBCD(Sun Certified Business Component Developer)考试准备的知识点。这份文档由作者周家帆撰写,并经过多次修订,最终版本为V1.0,发布日期为2009年8月10日。下面...
计算机硬件控制_驱动级键盘鼠标同步_PS2接口UDP协议多机协同_基于rabirdwinio和pynput的跨设备输入共享系统_实现多台Windows电脑的键盘鼠标同步操作_支持
嵌入式八股文面试题库资料知识宝典-TCPIP协议栈.zip
少儿编程scratch项目源代码文件案例素材-开膛手杰克.zip
基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型,个人经导师指导并认可通过的高分设计项目,评审分99分,代码完整确保可以运行,小白也可以亲自搞定,主要针对计算机相关专业的正在做大作业的学生和需要项目实战练习的学习者,可作为毕业设计、课程设计、期末大作业,代码资料完整,下载可用。 基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现遥感图像滑坡识别源码+数据集+训练好的模型基于深度学习CNN网络+pytorch框架实现
内容概要:本文详细探讨了电力弹簧技术在主动配电网规划及运行优化调度中的应用。首先介绍了电力弹簧技术作为智能电网调控手段的优势,如自适应性强、响应速度快、节能环保等。接着阐述了主动配电网规划的目标和策略,包括优化电网结构、提高能源利用效率和降低故障风险。随后讨论了运行优化调度的原则和方法,强调了实时监测、智能调度策略以及优化调度模型的重要性。最后通过实际案例分析展示了电力弹簧技术在提升电网稳定性、可靠性和能效方面的显著效果,展望了其广阔的应用前景。 适合人群:从事电力系统规划、运行管理的研究人员和技术人员,以及对智能电网感兴趣的学者和学生。 使用场景及目标:适用于希望深入了解电力弹簧技术及其在主动配电网规划和运行优化调度中具体应用的专业人士。目标是掌握电力弹簧技术的工作原理、优势及其在实际项目中的实施方法。 其他说明:本文不仅提供了理论分析,还有具体的案例支持,有助于读者全面理解电力弹簧技术的实际应用价值。
嵌入式八股文面试题库资料知识宝典-C语言思维导图.zip
电路教学与科研案例的结合—以最大功率传输定理为例.pdf
内容概要:本文深入介绍了HarmonyOS文件系统及其在万物互联时代的重要性。HarmonyOS自2019年发布以来,逐步覆盖多种智能设备,构建了庞大的鸿蒙生态。文件系统作为其中的“数字管家”,不仅管理存储资源,还实现多设备间的数据协同。文章详细介绍了常见的文件系统类型,如FAT、NTFS、UFS、EXT3和ReiserFS,各自特点和适用场景。特别强调了HarmonyOS的分布式文件系统(hmdfs),它通过分布式软总线技术,打破了设备界限,实现了跨设备文件的无缝访问。此外,文章对比了HarmonyOS与Android、iOS文件系统的差异,突出了其在架构、跨设备能力和安全性方面的优势。最后,从开发者视角讲解了开发工具、关键API及注意事项,并展望了未来的技术发展趋势和对鸿蒙生态的影响。 适合人群:对操作系统底层技术感兴趣的开发者和技术爱好者,尤其是关注物联网和多设备协同的用户。 使用场景及目标:①理解HarmonyOS文件系统的工作原理及其在多设备协同中的作用;②掌握不同文件系统的特性和应用场景;③学习如何利用HarmonyOS文件系统进行应用开发,提升跨设备协同和数据安全。 阅读建议:本文内容详实,涵盖了从基础概念到高级开发技巧的多个层次,建议读者结合自身需求,重点关注感兴趣的部分,并通过实践加深理解。特别是开发者可参考提供的API示例和开发技巧,尝试构建基于HarmonyOS的应用。
嵌入式八股文面试题库资料知识宝典-海康嵌入式笔试题.zip
内容概要:本文详细介绍了基于瞬时无功功率理论的三电平有源电力滤波器(APF)仿真研究。主要内容涵盖并联型APF的工作原理、三相三电平NPC结构、谐波检测方法(ipiq)、双闭环控制策略(电压外环+电流内环PI控制)以及SVPWM矢量调制技术。仿真结果显示,在APF投入前后,电网电流THD从21.9%降至3.77%,显著提高了电能质量。 适用人群:从事电力系统研究、电力电子技术开发的专业人士,尤其是对有源电力滤波器及其仿真感兴趣的工程师和技术人员。 使用场景及目标:适用于需要解决电力系统中谐波污染和无功补偿问题的研究项目。目标是通过仿真验证APF的有效性和可行性,优化电力系统的电能质量。 其他说明:文中提到的仿真模型涉及多个关键模块,如三相交流电压模块、非线性负载、信号采集模块、LC滤波器模块等,这些模块的设计和协同工作对于实现良好的谐波抑制和无功补偿至关重要。
基于环比增长的销售统计分析——2019年中青杯全国数学建模竞赛C题.pdf
嵌入式八股文面试题库资料知识宝典-linux面试题.zip
嵌入式八股文面试题库资料知识宝典-linux常见面试题.zip
内容概要:本文探讨了小电流接地系统在配电网络中的应用,特别是在单相故障情况下的仿真分析。文中介绍了小电流接地系统的背景和发展现状,重点讨论了两种常见的接地方式——中性点不接地和中性点经消弧线圈接地。利用Matlab作为仿真工具,作者构建了详细的电路模型,模拟了单相故障的发生过程,并通过多个结果图表展示了故障电流、电压波形及系统运行状态。此外,文章还包括了详细的设计说明书和PPT介绍,帮助读者全面理解仿真过程和技术细节。 适合人群:从事电力系统研究、维护的技术人员,尤其是关注配电网络安全和稳定的工程师。 使用场景及目标:适用于希望深入了解小电流接地系统的工作原理和故障处理机制的专业人士。通过本研究,读者可以掌握如何使用Matlab进行电力系统仿真,评估不同接地方式的效果,优化配电网络的安全性能。 其他说明:随文附带完整的仿真工程文件、结果图、设计说明书及PPT介绍,便于读者进一步探索和实践。
少儿编程scratch项目源代码文件案例素材-激烈的殴斗.zip
嵌入式八股文面试题库资料知识宝典-小米嵌入式软件工程师笔试题目解析.zip
内容概要:本文详细探讨了车辆主动避撞技术中的两种常见策略——纵向紧急制动避撞和横向紧急转向避撞。首先介绍了这两种避撞策略的基本概念,接着深入分析了临界纵向安全距离的概念及其对避撞模式选择的影响。文中特别强调了五次多项式换道轨迹模型在计算横向紧急转向避撞安全距离中的应用。最后,通过一个简化的程序实现了避撞策略的模拟和可视化展示,帮助读者更好地理解不同避撞方式的应用场景和技术细节。 适合人群:汽车工程技术人员、交通安全研究人员、自动驾驶开发者。 使用场景及目标:适用于研究和开发车辆主动避撞系统的专业人士,旨在提高对避撞策略的理解,优化避撞算法的设计,提升行车安全性。 其他说明:文章不仅提供了理论分析,还结合了具体的数学模型和程序实现,使读者能够从多个角度全面掌握车辆避撞技术的关键要素。
基于MPPSK调制的数字对讲机系统.pdf
嵌入式八股文面试题库资料知识宝典-Nec试题回忆二.zip