📄 sessionbeanfactory.java
字号:
package personal_payout_manage.utils;
import javax.naming.Context;
import javax.rmi.PortableRemoteObject;
import personal_payout_manage.ejbs.PayoutSession;
import personal_payout_manage.ejbs.PayoutSessionHome;
public class SessionBeanFactory {
//会话Bean的远程接口
private static PayoutSession payoutSessionBean = null;
//静态方法,获得beanJndiName指定的会话Bean远程接口
public static PayoutSession getPayoutSessionBean(String beanJndiName) {
if (payoutSessionBean != null)
return payoutSessionBean;
try {
Context ctx = BuilderContext.getWeblogicServerInitialContext();
Object ref = ctx.lookup(beanJndiName);
//look up jndi name and cast to Home interface
PayoutSessionHome payoutSessionHome = (PayoutSessionHome)
PortableRemoteObject.
narrow(ref,
PayoutSessionHome.class);
payoutSessionBean = payoutSessionHome.create();
return payoutSessionBean;
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -