The Difference between <resource-ref> and <resource-env-ref>,the title should be long...

本文详细解释了EJB 2.0中resource-ref与resource-env-ref两个概念的区别,帮助开发者理解如何在编码时正确使用它们。
Howdy 
Good question (and one you should know for the exam)
resource-ref is for "resource manager connection factory" objects that can give you connections to a resource manager. The typical example is for javax.sql.DataSource from which you can get JDBC connections (javax.sql.Connection).
The resource-ref is so that you can have a 'logical name' used in code -- that the deployer then binds to the *actual* resource factory configured into the server. So when you think of resource-ref, think of "Programmer's made-up/fake name for the datasource." Since the programmer may not know, at the time of coding, what the *real* name is going to be (and since the component model demands that the name of these things is something that can be configured at deploy-time without changing code.)
So... what's the deal with resource-env-ref?
1) It is new to EJB 2.0
2) It was added because of message-driven beans/JMS
3) It has the WORST name, designed, I'm certain, just to confuse you.
For example, a resource manager connection factory is certainly an entry in the bean's environment -- so it would be perfectly logical to assume that resource-env-ref is an appropriate name for what is actually resource-ref.
But...you have to memorize it differently.

A resource-env-ref is for "administered objects associated with resources", and the most obvious example (and the reason it was added) was for JMS destinations. The idea is the same as resource-ref (or security-role-ref) in that it stands for "programmer's made-up/fake name", only instead of a name for a resource factory, it is a name for a 'resource'. 
The main difference:
resource-ref: 
things that give you CONNECTIONS (including URL connection - JavaMail connection factory, JDBC connection --DataSource, and -- for the really confusing one -- QueueConnectionFactory for obtaining JMS connections.)
resource-env-ref:
things that give you access to a resource, but which are NOT factories that give you connections. In other words, with resource-ref you are getting something that you then can use to GET to a resource, but with resource-env-ref, you get right to the resource without going through a factory.
The way I think of it, for the purposes of the exam is:
resource-ref: "Programmer's made-up name for the database driver"
[just a way to remember, not the exact technically correct way to say it]
resource-env-ref: "Programmer's made-up name for the JMS destination"
From what I've heard, the resource-env-ref really should have just been called JMS-resource-ref, but that would have been more limiting. Much clearer, though.
The only resource example used in the spec is for JMS destination, and although I'm sure there may be other examples, I have no idea what they might be.
=======================
So, yes its confusing, but hopefully you can simply "burn-in" the differences between the two. I think the most important thing to remember is that wherever you see 'ref' you can think of "Programmer's made-up / lookup name" 
cheers,
Kath
已经博主授权,源码转载自 https://pan.quark.cn/s/fdfcb1303993 ### 高速电路接口原理与应用详解 #### 引言 信息技术的迅猛进步推动了高速数据传输需求的持续提升,特别是在高性能计算、网络通信等关键领域。为了达成高效的数据交换,高速集成电路间的互连技术成为了研究的热点。本文将系统阐述几种典型的高速接口规范——PECL(Positive Emitter Coupled Logic)、LVECL(Low Voltage Emitter Coupled Logic)、CML(Current Mode Logic)和LVDS(Low Voltage Differential Signaling),并深入分析它们的电路构造和应用特性。 #### 1. ECL电路基础 ECL电路是早期为应对高速数据传输需求而研发的一种逻辑电路,其运行速度极快,最高可达到10Gbps。通过维持晶体管工作于线性和截止区域,ECL电路有效规避了饱和区的影响,从而获得了迅速的开关响应。接下来将具体解析ECL电路的构成要素及其运作机制。 #### 1.1 ECL线接收器电路组成 - **差分放大器**:由晶体管Q3、Q4、Q5构成,是整个电路的核心部分。其中,Q5作为恒流源,具备较大的交流等效电阻,能够提供稳定的电流,确保电路的稳定运作。 - **发射极跟随器输出电路**:由Q1、Q2组成,主要用于电平调整和输出驱动,确保输出信号与下一级电路的兼容性。 - **偏置电源**:由Q6、Q7以及二极管D1、D2构成,为差分放大器提供可靠的偏置电压,使其始终工作在线性放大区间。 #### 1.2 ECL电路的显著特性 - **高运行速率**:由于晶体管工作在线性和截止状态,不受...
内容概要:本文深入讲解了发布-订阅模式在嵌入式C语言开发中的应用,旨在解决传统“上帝函数”带来的模块强耦合、维护困难、测试复杂等问题。通过引入事件总线(EventBus)作为中间媒介,实现模块间的解耦:发布者仅负责发出事件,订阅者自主决定是否响应,从而构建星型架构替代原有的蜘蛛网式依赖。文章提供了两种实现方案:基础版采用静态回调数组法,结构简单适合中小型项目;进阶版利用GCC的`__attribute__((section))`和链接脚本,在编译期自动收集订阅关系,实现零RAM开销和真正的模块即插即用。此外,文章还探讨了参数传递的安全性设计、类型校验机制以及在中断处理、递归发布、资源共享等场景下的常见陷阱与应对策略。; 适合人群:具备C语言基础和一定嵌入式开发经验(如1-3年)的工程师,尤其适合面临代码维护困难、模块耦合严重问题的研发人员。; 使用场景及目标:①用于重构大型嵌入式项目中的主循环逻辑,降低模块间依赖,提升代码可维护性和可扩展性;②在资源受限的单片机环境中实现高效、安全的模块间通信;③学习如何利用编译器特性进行静态注册与优化,掌握工业级事件总线的设计与实现方法。; 阅读建议:此资源不仅提供理论讲解,更有完整的可运行代码示例,建议读者结合文中提供的源码进行实践,尝试在自己的项目中逐步引入发布-订阅模式,并重点关注进阶版的Linker Section实现原理与避坑指南中的实战经验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值