JDK 11 jdk.jshell.jmod - JShell Tool

JDK 11 jdk.jshell.jmod is the JMOD file for JDK 11 JShell tool, which can be invoked by the "jshell" command.

JDK 11 JShell tool compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.jshell.jmod.

JDK 11 JShell tool compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.

JDK 11 JShell tool source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.jshell.

You can click and view the content of each source code file in the list below.

✍: FYIcenter

jdk/jshell/execution/FailOverExecutionControlProvider.java

/*
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package jdk.jshell.execution;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import jdk.jshell.spi.ExecutionControl;
import jdk.jshell.spi.ExecutionControlProvider;
import jdk.jshell.spi.ExecutionEnv;

/**
 * Tries other providers in sequence until one works.
 *
 * @since 9
 */
public class FailOverExecutionControlProvider  implements ExecutionControlProvider{

    private Logger logger = null;

    /**
     * Create an instance. The instance can be used to start and return an
     * {@link ExecutionControl} instance by attempting to start a series of
     * {@code ExecutionControl} specs, until one is successful.
     *
     * @see #generate(jdk.jshell.spi.ExecutionEnv, java.util.Map)
     */
    public FailOverExecutionControlProvider() {
    }

    /**
     * The unique name of this {@code ExecutionControlProvider}.
     *
     * @return "failover"
     */
    @Override
    public String name() {
        return "failover";
    }

    /**
     * Create and return the default parameter map for this
     * {@code ExecutionControlProvider}. There are ten parameters, "0" through
     * "9", their values are {@code ExecutionControlProvider} specification
     * strings, or empty string.
     *
     * @return a default parameter map
     */
    @Override
    public Map<String, String> defaultParameters() {
        Map<String, String> dp = new HashMap<>();
        dp.put("0", "jdi");
        for (int i = 1; i <= 9; ++i) {
            dp.put("" + i, "");
        }
        return dp;
    }

    /**
     * Create and return a locally executing {@code ExecutionControl} instance.
     * At least one parameter should have a spec.
     *
     * @param env the execution environment, provided by JShell
     * @param parameters the modified parameter map.
     * @return the execution engine
     * @throws Throwable if all the given providers fail, the exception that
     * occurred on the first attempt to create the execution engine.
     */
    @Override
    public ExecutionControl generate(ExecutionEnv env, Map<String, String> parameters)
            throws Throwable {
        Throwable thrown = null;
        for (int i = 0; i <= 9; ++i) {
            String param = parameters.get("" + i);
            if (param != null && !param.isEmpty()) {
                try {
                    ExecutionControl ec =  ExecutionControl.generate(env, param);
                    logger().finest(
                            String.format("FailOverExecutionControlProvider: Success %s -- %d = %s\n",
                                    name(), i, param));
                    return ec;
                } catch (Throwable ex) {
                    logger().warning(
                            String.format("FailOverExecutionControlProvider: Failure %s -- %d = %s -- %s\n",
                                    name(), i, param, ex.toString()));
                    StringWriter writer = new StringWriter();
                    PrintWriter log = new PrintWriter(writer);
                    log.println("FailOverExecutionControlProvider:");
                    ex.printStackTrace(log);
                    log.flush();
                    logger().fine(writer.toString());
                    // only care about the first, and only if they all fail
                    if (thrown == null) {
                        thrown = ex;
                    }
                }
            }

        }
        logger().severe("FailOverExecutionControlProvider: Terminating, failovers exhausted");
        if (thrown == null) {
            throw new IllegalArgumentException("All least one parameter must be set to a provider.");
        }
        throw thrown;
    }

    private Logger logger() {
        if (logger == null) {
            logger = Logger.getLogger("jdk.jshell.execution");
            if (logger.getLevel() == null) {
                // Logging has not been specifically requested, turn it off
                logger.setLevel(Level.OFF);
            }
        }
        return logger;
    }

}

jdk/jshell/execution/FailOverExecutionControlProvider.java

 

Or download all of them as a single archive file:

File name: jdk.jshell-11.0.1-src.zip
File size: 283093 bytes
Release date: 2018-11-04
Download 

 

JDK 11 jdk.jsobject.jmod - JS Object Module

JDK 11 jdk.jlink.jmod - JLink Tool

Download and Use JDK 11

⇑⇑ FAQ for JDK (Java Development Kit)

2020-06-30, 29295👍, 0💬