当前位置: 首页>>代码示例>>Java>>正文


Java InitialContext.close方法代码示例

本文整理汇总了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();
}
 
开发者ID:wfink,项目名称:jboss-eap7.1-playground,代码行数:18,代码来源:DelegateClient.java

示例2: cleanUp

import javax.naming.InitialContext; //导入方法依赖的package包/类
private void cleanUp(InitialContext initialContext) {
	try {
		initialContext.close();
	}
	catch ( NamingException e ) {
		LOG.unableToCloseInitialContext(e.toString());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:JndiServiceImpl.java

示例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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:RMIConnectorServer.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:RMIConnector.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:RMIConnector.java


注:本文中的javax.naming.InitialContext.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。