java.util.ServiceLoader.Provider#com.sun.jmx.remote.util.EnvHelp源码实例Demo

下面列出了java.util.ServiceLoader.Provider#com.sun.jmx.remote.util.EnvHelp 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public ClientNotifForwarder(ClassLoader defaultClassLoader, Map<String, ?> env) {
    maxNotifications = EnvHelp.getMaxFetchNotifNumber(env);
    timeout = EnvHelp.getFetchTimeout(env);

    /* You can supply an Executor in which the remote call to
       fetchNotifications will be made.  The Executor's execute
       method reschedules another task, so you must not use
       an Executor that executes tasks in the caller's thread.  */
    Executor ex = (Executor)
        env.get("jmx.remote.x.fetch.notifications.executor");
    if (ex == null)
        ex = new LinearExecutor();
    else if (logger.traceOn())
        logger.trace("ClientNotifForwarder", "executor is " + ex);

    this.defaultClassLoader = defaultClassLoader;
    this.executor = ex;
    this.acc = AccessController.getContext();
}
 
源代码2 项目: hottub   文件: DefaultMBeanServerInterceptor.java
private NotificationListener getListener(ObjectName listener)
    throws ListenerNotFoundException {
    // ----------------
    // Get listener object
    // ----------------
    DynamicMBean instance;
    try {
        instance = getMBean(listener);
    } catch (InstanceNotFoundException e) {
        throw EnvHelp.initCause(
                      new ListenerNotFoundException(e.getMessage()), e);
    }

    Object resource = getResource(instance);
    if (!(resource instanceof NotificationListener)) {
        final RuntimeException exc =
            new IllegalArgumentException(listener.getCanonicalName());
        final String msg =
            "MBean " + listener.getCanonicalName() + " does not " +
            "implement " + NotificationListener.class.getName();
        throw new RuntimeOperationsException(exc, msg);
    }
    return (NotificationListener) resource;
}
 
源代码3 项目: jdk8u-jdk   文件: ClientNotifForwarder.java
/**
 * Import: should not remove a listener during reconnection, the reconnection
 * needs to change the listener list and that will possibly make removal fail.
 */
private synchronized void beforeRemove() throws IOException {
    while (beingReconnected) {
        if (state == TERMINATED) {
            throw new IOException("Terminated.");
        }

        try {
            wait();
        } catch (InterruptedException ire) {
            IOException ioe = new IOException(ire.toString());
            EnvHelp.initCause(ioe, ire);

            throw ioe;
        }
    }

    if (state == TERMINATED) {
        throw new IOException("Terminated.");
    }
}
 
源代码4 项目: openjdk-8   文件: RMIConnector.java
private RMIServer findRMIServer(JMXServiceURL directoryURL,
        Map<String, Object> environment)
        throws NamingException, IOException {
    final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true);
    if (isIiop) {
        // Make sure java.naming.corba.orb is in the Map.
        environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment));
    }

    String path = directoryURL.getURLPath();
    int end = path.indexOf(';');
    if (end < 0) end = path.length();
    if (path.startsWith("/jndi/"))
        return findRMIServerJNDI(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/stub/"))
        return findRMIServerJRMP(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/ior/")) {
        if (!IIOPHelper.isAvailable())
            throw new IOException("iiop protocol not available");
        return findRMIServerIIOP(path.substring(5,end), environment, isIiop);
    } else {
        final String msg = "URL path must begin with /jndi/ or /stub/ " +
                "or /ior/: " + path;
        throw new MalformedURLException(msg);
    }
}
 
源代码5 项目: jdk8u-dev-jdk   文件: RMIJRMPServerImpl.java
private void export(Remote obj) throws RemoteException {
    final RMIExporter exporter =
        (RMIExporter) env.get(RMIExporter.EXPORTER_ATTRIBUTE);
    final boolean daemon = EnvHelp.isServerDaemon(env);

    if (daemon && exporter != null) {
        throw new IllegalArgumentException("If "+EnvHelp.JMX_SERVER_DAEMON+
                " is specified as true, "+RMIExporter.EXPORTER_ATTRIBUTE+
                " cannot be used to specify an exporter!");
    }

    if (daemon) {
        if (csf == null && ssf == null) {
            new UnicastServerRef(port).exportObject(obj, null, true);
        } else {
            new UnicastServerRef2(port, csf, ssf).exportObject(obj, null, true);
        }
    } else if (exporter != null) {
        exporter.exportObject(obj, port, csf, ssf);
    } else {
        UnicastRemoteObject.exportObject(obj, port, csf, ssf);
    }
}
 
public ObjectInstance createMBean(String className, ObjectName name,
                                  Object[] params, String[] signature)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException  {

    try {
        return createMBean(className, name, null, true,
                           params, signature);
    } catch (InstanceNotFoundException e) {
        /* Can only happen if loaderName doesn't exist, but we just
           passed null, so we shouldn't get this exception.  */
        throw EnvHelp.initCause(
            new IllegalArgumentException("Unexpected exception: " + e), e);
    }
}
 
源代码7 项目: jdk1.8-source-analysis   文件: RMIConnector.java
private RMIServer findRMIServer(JMXServiceURL directoryURL,
        Map<String, Object> environment)
        throws NamingException, IOException {
    final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true);
    if (isIiop) {
        // Make sure java.naming.corba.orb is in the Map.
        environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment));
    }

    String path = directoryURL.getURLPath();
    int end = path.indexOf(';');
    if (end < 0) end = path.length();
    if (path.startsWith("/jndi/"))
        return findRMIServerJNDI(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/stub/"))
        return findRMIServerJRMP(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/ior/")) {
        if (!IIOPHelper.isAvailable())
            throw new IOException("iiop protocol not available");
        return findRMIServerIIOP(path.substring(5,end), environment, isIiop);
    } else {
        final String msg = "URL path must begin with /jndi/ or /stub/ " +
                "or /ior/: " + path;
        throw new MalformedURLException(msg);
    }
}
 
源代码8 项目: jdk8u_jdk   文件: ClientNotifForwarder.java
/**
 * Import: should not remove a listener during reconnection, the reconnection
 * needs to change the listener list and that will possibly make removal fail.
 */
private synchronized void beforeRemove() throws IOException {
    while (beingReconnected) {
        if (state == TERMINATED) {
            throw new IOException("Terminated.");
        }

        try {
            wait();
        } catch (InterruptedException ire) {
            IOException ioe = new IOException(ire.toString());
            EnvHelp.initCause(ioe, ire);

            throw ioe;
        }
    }

    if (state == TERMINATED) {
        throw new IOException("Terminated.");
    }
}
 
源代码9 项目: jdk8u-jdk   文件: RMIConnector.java
private RMIServer findRMIServer(JMXServiceURL directoryURL,
        Map<String, Object> environment)
        throws NamingException, IOException {
    final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true);
    if (isIiop) {
        // Make sure java.naming.corba.orb is in the Map.
        environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment));
    }

    String path = directoryURL.getURLPath();
    int end = path.indexOf(';');
    if (end < 0) end = path.length();
    if (path.startsWith("/jndi/"))
        return findRMIServerJNDI(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/stub/"))
        return findRMIServerJRMP(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/ior/")) {
        if (!IIOPHelper.isAvailable())
            throw new IOException("iiop protocol not available");
        return findRMIServerIIOP(path.substring(5,end), environment, isIiop);
    } else {
        final String msg = "URL path must begin with /jndi/ or /stub/ " +
                "or /ior/: " + path;
        throw new MalformedURLException(msg);
    }
}
 
源代码10 项目: dragonwell8_jdk   文件: ClientNotifForwarder.java
/**
 * Import: should not remove a listener during reconnection, the reconnection
 * needs to change the listener list and that will possibly make removal fail.
 */
private synchronized void beforeRemove() throws IOException {
    while (beingReconnected) {
        if (state == TERMINATED) {
            throw new IOException("Terminated.");
        }

        try {
            wait();
        } catch (InterruptedException ire) {
            IOException ioe = new IOException(ire.toString());
            EnvHelp.initCause(ioe, ire);

            throw ioe;
        }
    }

    if (state == TERMINATED) {
        throw new IOException("Terminated.");
    }
}
 
源代码11 项目: jdk8u-jdk   文件: DefaultMBeanServerInterceptor.java
public ObjectInstance createMBean(String className, ObjectName name,
                                  Object[] params, String[] signature)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException  {

    try {
        return createMBean(className, name, null, true,
                           params, signature);
    } catch (InstanceNotFoundException e) {
        /* Can only happen if loaderName doesn't exist, but we just
           passed null, so we shouldn't get this exception.  */
        throw EnvHelp.initCause(
            new IllegalArgumentException("Unexpected exception: " + e), e);
    }
}
 
源代码12 项目: jdk8u-dev-jdk   文件: RMIConnector.java
private RMIServer findRMIServer(JMXServiceURL directoryURL,
        Map<String, Object> environment)
        throws NamingException, IOException {
    final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true);
    if (isIiop) {
        // Make sure java.naming.corba.orb is in the Map.
        environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment));
    }

    String path = directoryURL.getURLPath();
    int end = path.indexOf(';');
    if (end < 0) end = path.length();
    if (path.startsWith("/jndi/"))
        return findRMIServerJNDI(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/stub/"))
        return findRMIServerJRMP(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/ior/")) {
        if (!IIOPHelper.isAvailable())
            throw new IOException("iiop protocol not available");
        return findRMIServerIIOP(path.substring(5,end), environment, isIiop);
    } else {
        final String msg = "URL path must begin with /jndi/ or /stub/ " +
                "or /ior/: " + path;
        throw new MalformedURLException(msg);
    }
}
 
public ObjectInstance createMBean(String className, ObjectName name,
                                  Object[] params, String[] signature)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException  {

    try {
        return createMBean(className, name, null, true,
                           params, signature);
    } catch (InstanceNotFoundException e) {
        /* Can only happen if loaderName doesn't exist, but we just
           passed null, so we shouldn't get this exception.  */
        throw EnvHelp.initCause(
            new IllegalArgumentException("Unexpected exception: " + e), e);
    }
}
 
源代码14 项目: hottub   文件: JMXPluggableAuthenticator.java
private static void authenticationFailure(String method,
                                          Exception exception)
    throws SecurityException {
    String msg;
    SecurityException se;
    if (exception instanceof SecurityException) {
        msg = exception.getMessage();
        se = (SecurityException) exception;
    } else {
        msg = "Authentication failed! " + exception.getMessage();
        final SecurityException e = new SecurityException(msg);
        EnvHelp.initCause(e, exception);
        se = e;
    }
    logException(method, msg, se);
    throw se;
}
 
源代码15 项目: jdk8u-jdk   文件: ClientNotifForwarder.java
/**
 * Import: should not remove a listener during reconnection, the reconnection
 * needs to change the listener list and that will possibly make removal fail.
 */
private synchronized void beforeRemove() throws IOException {
    while (beingReconnected) {
        if (state == TERMINATED) {
            throw new IOException("Terminated.");
        }

        try {
            wait();
        } catch (InterruptedException ire) {
            IOException ioe = new IOException(ire.toString());
            EnvHelp.initCause(ioe, ire);

            throw ioe;
        }
    }

    if (state == TERMINATED) {
        throw new IOException("Terminated.");
    }
}
 
源代码16 项目: jdk8u-jdk   文件: RMIConnector.java
private RMIServer findRMIServer(JMXServiceURL directoryURL,
        Map<String, Object> environment)
        throws NamingException, IOException {
    final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true);
    if (isIiop) {
        // Make sure java.naming.corba.orb is in the Map.
        environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment));
    }

    String path = directoryURL.getURLPath();
    int end = path.indexOf(';');
    if (end < 0) end = path.length();
    if (path.startsWith("/jndi/"))
        return findRMIServerJNDI(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/stub/"))
        return findRMIServerJRMP(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/ior/")) {
        if (!IIOPHelper.isAvailable())
            throw new IOException("iiop protocol not available");
        return findRMIServerIIOP(path.substring(5,end), environment, isIiop);
    } else {
        final String msg = "URL path must begin with /jndi/ or /stub/ " +
                "or /ior/: " + path;
        throw new MalformedURLException(msg);
    }
}
 
源代码17 项目: jdk8u60   文件: DefaultMBeanServerInterceptor.java
public ObjectInstance createMBean(String className, ObjectName name,
                                  Object[] params, String[] signature)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException  {

    try {
        return createMBean(className, name, null, true,
                           params, signature);
    } catch (InstanceNotFoundException e) {
        /* Can only happen if loaderName doesn't exist, but we just
           passed null, so we shouldn't get this exception.  */
        throw EnvHelp.initCause(
            new IllegalArgumentException("Unexpected exception: " + e), e);
    }
}
 
private NotificationListener getListener(ObjectName listener)
    throws ListenerNotFoundException {
    // ----------------
    // Get listener object
    // ----------------
    DynamicMBean instance;
    try {
        instance = getMBean(listener);
    } catch (InstanceNotFoundException e) {
        throw EnvHelp.initCause(
                      new ListenerNotFoundException(e.getMessage()), e);
    }

    Object resource = getResource(instance);
    if (!(resource instanceof NotificationListener)) {
        final RuntimeException exc =
            new IllegalArgumentException(listener.getCanonicalName());
        final String msg =
            "MBean " + listener.getCanonicalName() + " does not " +
            "implement " + NotificationListener.class.getName();
        throw new RuntimeOperationsException(exc, msg);
    }
    return (NotificationListener) resource;
}
 
源代码19 项目: jdk8u60   文件: RMIConnector.java
private RMIServer findRMIServer(JMXServiceURL directoryURL,
        Map<String, Object> environment)
        throws NamingException, IOException {
    final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true);
    if (isIiop) {
        // Make sure java.naming.corba.orb is in the Map.
        environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment));
    }

    String path = directoryURL.getURLPath();
    int end = path.indexOf(';');
    if (end < 0) end = path.length();
    if (path.startsWith("/jndi/"))
        return findRMIServerJNDI(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/stub/"))
        return findRMIServerJRMP(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/ior/")) {
        if (!IIOPHelper.isAvailable())
            throw new IOException("iiop protocol not available");
        return findRMIServerIIOP(path.substring(5,end), environment, isIiop);
    } else {
        final String msg = "URL path must begin with /jndi/ or /stub/ " +
                "or /ior/: " + path;
        throw new MalformedURLException(msg);
    }
}
 
源代码20 项目: openjdk-jdk8u-backup   文件: RMIConnector.java
private RMIServer findRMIServer(JMXServiceURL directoryURL,
        Map<String, Object> environment)
        throws NamingException, IOException {
    final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true);
    if (isIiop) {
        // Make sure java.naming.corba.orb is in the Map.
        environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment));
    }

    String path = directoryURL.getURLPath();
    int end = path.indexOf(';');
    if (end < 0) end = path.length();
    if (path.startsWith("/jndi/"))
        return findRMIServerJNDI(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/stub/"))
        return findRMIServerJRMP(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/ior/")) {
        if (!IIOPHelper.isAvailable())
            throw new IOException("iiop protocol not available");
        return findRMIServerIIOP(path.substring(5,end), environment, isIiop);
    } else {
        final String msg = "URL path must begin with /jndi/ or /stub/ " +
                "or /ior/: " + path;
        throw new MalformedURLException(msg);
    }
}
 
源代码21 项目: JDKSourceCode1.8   文件: ServerNotifForwarder.java
public ServerNotifForwarder(MBeanServer mbeanServer,
                            Map<String, ?> env,
                            NotificationBuffer notifBuffer,
                            String connectionId) {
    this.mbeanServer = mbeanServer;
    this.notifBuffer = notifBuffer;
    this.connectionId = connectionId;
    connectionTimeout = EnvHelp.getServerConnectionTimeout(env);

    String stringBoolean = (String) env.get("jmx.remote.x.check.notification.emission");
    checkNotificationEmission = EnvHelp.computeBooleanFromString( stringBoolean );
    notificationAccessController =
            EnvHelp.getNotificationAccessController(env);
}
 
源代码22 项目: jdk8u-jdk   文件: MapNullValuesTest.java
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;
}
 
源代码23 项目: openjdk-8-source   文件: ArrayNotificationBuffer.java
private void createListeners() {
    logger.debug("createListeners", "starts");

    synchronized (this) {
        createdDuringQuery = new HashSet<ObjectName>();
    }

    try {
        addNotificationListener(MBeanServerDelegate.DELEGATE_NAME,
                                creationListener, creationFilter, null);
        logger.debug("createListeners", "added creationListener");
    } catch (Exception e) {
        final String msg = "Can't add listener to MBean server delegate: ";
        RuntimeException re = new IllegalArgumentException(msg + e);
        EnvHelp.initCause(re, e);
        logger.fine("createListeners", msg + e);
        logger.debug("createListeners", e);
        throw re;
    }

    /* Spec doesn't say whether Set returned by QueryNames can be modified
       so we clone it. */
    Set<ObjectName> names = queryNames(null, broadcasterQuery);
    names = new HashSet<ObjectName>(names);

    synchronized (this) {
        names.addAll(createdDuringQuery);
        createdDuringQuery = null;
    }

    for (ObjectName name : names)
        addBufferListener(name);
    logger.debug("createListeners", "ends");
}
 
源代码24 项目: jdk8u-dev-jdk   文件: MapNullValuesTest.java
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;
}
 
源代码25 项目: openjdk-8   文件: RMIConnector.java
private RMIConnector(RMIServer rmiServer, JMXServiceURL address,
        Map<String, ?> environment) {
    if (rmiServer == null && address == null) throw new
            IllegalArgumentException("rmiServer and jmxServiceURL both null");
    initTransients();

    this.rmiServer = rmiServer;
    this.jmxServiceURL = address;
    if (environment == null) {
        this.env = Collections.emptyMap();
    } else {
        EnvHelp.checkAttributes(environment);
        this.env = Collections.unmodifiableMap(environment);
    }
}
 
private void createListeners() {
    logger.debug("createListeners", "starts");

    synchronized (this) {
        createdDuringQuery = new HashSet<ObjectName>();
    }

    try {
        addNotificationListener(MBeanServerDelegate.DELEGATE_NAME,
                                creationListener, creationFilter, null);
        logger.debug("createListeners", "added creationListener");
    } catch (Exception e) {
        final String msg = "Can't add listener to MBean server delegate: ";
        RuntimeException re = new IllegalArgumentException(msg + e);
        EnvHelp.initCause(re, e);
        logger.fine("createListeners", msg + e);
        logger.debug("createListeners", e);
        throw re;
    }

    /* Spec doesn't say whether Set returned by QueryNames can be modified
       so we clone it. */
    Set<ObjectName> names = queryNames(null, broadcasterQuery);
    names = new HashSet<ObjectName>(names);

    synchronized (this) {
        names.addAll(createdDuringQuery);
        createdDuringQuery = null;
    }

    for (ObjectName name : names)
        addBufferListener(name);
    logger.debug("createListeners", "ends");
}
 
源代码27 项目: jdk1.8-source-analysis   文件: RMIJRMPServerImpl.java
/**
 * <p>Creates a new {@link RMIServer} object that will be exported
 * on the given port using the given socket factories.</p>
 *
 * @param port the port on which this object and the {@link
 * RMIConnectionImpl} objects it creates will be exported.  Can be
 * zero, to indicate any available port.
 *
 * @param csf the client socket factory for the created RMI
 * objects.  Can be null.
 *
 * @param ssf the server socket factory for the created RMI
 * objects.  Can be null.
 *
 * @param env the environment map.  Can be null.
 *
 * @exception IOException if the {@link RMIServer} object
 * cannot be created.
 *
 * @exception IllegalArgumentException if <code>port</code> is
 * negative.
 */
public RMIJRMPServerImpl(int port,
                         RMIClientSocketFactory csf,
                         RMIServerSocketFactory ssf,
                         Map<String,?> env)
        throws IOException {

    super(env);

    if (port < 0)
        throw new IllegalArgumentException("Negative port: " + port);

    this.port = port;
    this.csf = csf;
    this.ssf = ssf;
    this.env = (env == null) ? Collections.<String, Object>emptyMap() : env;

    String[] credentialsTypes
            = (String[]) this.env.get(EnvHelp.CREDENTIAL_TYPES);
    List<String> types = null;
    if (credentialsTypes != null) {
        types = new ArrayList<>();
        for (String type : credentialsTypes) {
            if (type == null) {
                throw new IllegalArgumentException("A credential type is null.");
            }
            ReflectUtil.checkPackageAccess(type);
            types.add(type);
        }
    }
    exportedWrapper = types != null ?
            new ExportedWrapper(this, types) :
            null;
}
 
源代码28 项目: openjdk-8-source   文件: MapNullValuesTest.java
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;
}
 
源代码29 项目: jdk8u60   文件: ServerNotifForwarder.java
public ServerNotifForwarder(MBeanServer mbeanServer,
                            Map<String, ?> env,
                            NotificationBuffer notifBuffer,
                            String connectionId) {
    this.mbeanServer = mbeanServer;
    this.notifBuffer = notifBuffer;
    this.connectionId = connectionId;
    connectionTimeout = EnvHelp.getServerConnectionTimeout(env);

    String stringBoolean = (String) env.get("jmx.remote.x.check.notification.emission");
    checkNotificationEmission = EnvHelp.computeBooleanFromString( stringBoolean );
    notificationAccessController =
            EnvHelp.getNotificationAccessController(env);
}
 
源代码30 项目: jdk1.8-source-analysis   文件: RMIConnector.java
private RMIConnector(RMIServer rmiServer, JMXServiceURL address,
        Map<String, ?> environment) {
    if (rmiServer == null && address == null) throw new
            IllegalArgumentException("rmiServer and jmxServiceURL both null");
    initTransients();

    this.rmiServer = rmiServer;
    this.jmxServiceURL = address;
    if (environment == null) {
        this.env = Collections.emptyMap();
    } else {
        EnvHelp.checkAttributes(environment);
        this.env = Collections.unmodifiableMap(environment);
    }
}