本文整理汇总了Java中javax.naming.InitialContext.close方法的典型用法代码示例。如果您正苦于以下问题:Java InitialContext.close方法的具体用法?Java InitialContext.close怎么用?Java InitialContext.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.naming.InitialContext
的用法示例。
在下文中一共展示了InitialContext.close方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.naming.InitialContext; //导入方法依赖的package包/类
public static void main(String[] args) throws NamingException {
checkArgs(args);
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, WildFlyInitialContextFactory.class.getName());
p.put(Context.PROVIDER_URL, "http-remoting://localhost:9080");
p.put(Context.SECURITY_PRINCIPAL, "delegateUser");
p.put(Context.SECURITY_CREDENTIALS, "delegateUser");
InitialContext ic = new InitialContext(p);
Delegate proxy = (Delegate) ic.lookup("ejb:EAP71-PLAYGROUND-MainServer-icApp/ejb/DelegateBean!" + Delegate.class.getName());
proxy.checkApplicationUser4DedicatedConnection("delegateUser", "delegateUserR");
ic.close();
}
示例2: cleanUp
import javax.naming.InitialContext; //导入方法依赖的package包/类
private void cleanUp(InitialContext initialContext) {
try {
initialContext.close();
}
catch ( NamingException e ) {
LOG.unableToCloseInitialContext(e.toString());
}
}
示例3: bind
import javax.naming.InitialContext; //导入方法依赖的package包/类
/**
* Bind a stub to a registry.
* @param jndiUrl URL of the stub in the registry, extracted
* from the <code>JMXServiceURL</code>.
* @param attributes A Hashtable containing environment parameters,
* built from the Map specified at this object creation.
* @param rmiServer The object to bind in the registry
* @param rebind true if the object must be rebound.
**/
void bind(String jndiUrl, Hashtable<?, ?> attributes,
RMIServer rmiServer, boolean rebind)
throws NamingException, MalformedURLException {
// if jndiURL is not null, we nust bind the stub to a
// directory.
InitialContext ctx =
new InitialContext(attributes);
if (rebind)
ctx.rebind(jndiUrl, rmiServer);
else
ctx.bind(jndiUrl, rmiServer);
ctx.close();
}
示例4: findRMIServerJNDI
import javax.naming.InitialContext; //导入方法依赖的package包/类
/**
* Lookup the RMIServer stub in a directory.
* @param jndiURL A JNDI URL indicating the location of the Stub
* (see {@link javax.management.remote.rmi}), e.g.:
* <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
* <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
* <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
* </ul>
* @param env the environment Map passed to the connector.
* @param isIiop true if the stub is expected to be an IIOP stub.
* @return The retrieved RMIServer stub.
* @exception NamingException if the stub couldn't be found.
**/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
boolean isIiop)
throws NamingException {
InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));
Object objref = ctx.lookup(jndiURL);
ctx.close();
if (isIiop)
return narrowIIOPServer(objref);
else
return narrowJRMPServer(objref);
}
示例5: findRMIServerJNDI
import javax.naming.InitialContext; //导入方法依赖的package包/类
/**
* Lookup the RMIServer stub in a directory.
* @param jndiURL A JNDI URL indicating the location of the Stub
* (see {@link javax.management.remote.rmi}), e.g.:
* <ul><li>{@code rmi://registry-host:port/rmi-stub-name}</li>
* <li>or {@code ldap://ldap-host:port/java-container-dn}</li>
* </ul>
* @param env the environment Map passed to the connector.
* @return The retrieved RMIServer stub.
* @exception NamingException if the stub couldn't be found.
**/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env)
throws NamingException {
InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));
Object objref = ctx.lookup(jndiURL);
ctx.close();
return narrowJRMPServer(objref);
}