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