本文整理汇总了Java中com.sun.jmx.remote.util.EnvHelp.mapToHashtable方法的典型用法代码示例。如果您正苦于以下问题:Java EnvHelp.mapToHashtable方法的具体用法?Java EnvHelp.mapToHashtable怎么用?Java EnvHelp.mapToHashtable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jmx.remote.util.EnvHelp
的用法示例。
在下文中一共展示了EnvHelp.mapToHashtable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findRMIServerJNDI
import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的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);
}
示例2: mapToHashtableTests
import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的package包/类
private int mapToHashtableTests() {
int errorCount = 0;
echo("");
echo(dashedMessage("Run MapToHashtable Tests"));
for (int i = 0; i < maps.length; i++) {
echo("\n>>> MapToHashtable Test [" + i + "]");
try {
echo("\tMap = " + maps[i]);
Hashtable t = EnvHelp.mapToHashtable(maps[i]);
echo("\tHashtable = " + t);
checkContents(maps[i], t);
echo("\tTest [" + i + "] PASSED!");
} catch (Exception e) {
errorCount++;
echo("\tTest [" + i + "] FAILED!");
e.printStackTrace(System.out);
}
}
if (errorCount == 0) {
echo("");
echo(dashedMessage("MapToHashtable Tests PASSED!"));
} else {
echo("");
echo(dashedMessage("MapToHashtable Tests FAILED!"));
}
return errorCount;
}
示例3: findRMIServerJNDI
import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的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);
}