?? jndiutil.java
字號:
package junitbook.ejb.util;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class JNDIUtil
{
private static InitialContext jndiContext;
private static InitialContext getInitialContext()
{
if (jndiContext == null)
{
try
{
jndiContext = new InitialContext();
}
catch (NamingException e)
{
throw new RuntimeException(
"Failed to create InitialContext ["
+ e.getMessage() + "]");
}
}
return jndiContext;
}
public static Object lookup(String name)
{
Object object = null;
try
{
object = getInitialContext().lookup(name);
}
catch (NamingException e)
{
throw new RuntimeException("JNDI lookup failure for ["
+ name + "]. Reason [" + e.getMessage() + "]");
}
return object;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -