1.1 Review of major features of JDK versions

JDK Version 1.0

1996-01-23 Oak

  • The original version, a great milestone, was pure interpreted, used a plug-in JIT, performed poorly and ran slowly.

JDK Version 1.1

1997-02-19

  • JDBC(Java DataBase Connectivity);
  • Support inner classes;
  • RMI(Remote Method Invocation);
  • Reflection;
  • Java Bean;

JDK Version 1.2

  • Set frame;
  • JIT(Just In Time)The compiler;
  • The packagingJavaDocuments are digitally signed;
  • JFC(Java Foundation Classes), includingThe Swing 1.0, and drag and dropJava2DThe class library;
  • Java plug-in;
  • JDBCTo introduce scrollable result sets,BLOB,CLOB, batch updates and user-defined types;
  • AppletTo add sound support.
  • At the same time, Sun releasedJSP/Servlet, the EJB specification, and the separation of Java intoJ2EE,J2SEandJ2ME. This represents the beginning of Java’s transition to enterprise, desktop
  • Application and mobile device application in three areas.

JDK Version 1.3

2000-05-08 Kestrel(Kestrel)

  • Java Sound API;
  • jarFile index;
  • rightJavaA lot of optimizations and enhancements have been made to all aspects of the.

JDK Version 1.4

The 2004-02-06 Merlin (falcon)

  • XML processing;
  • JavaPrint service;
  • Logging API;
  • Java Web Start;
  • The JDBC 3.0 API;
  • Assertion;
  • Preferences API;
  • Chain exception handling;
  • supportIPV6;
  • Support regular expressions;
  • The introduction ofImgae I/O API.

JAVA 5

2004-09-30 Tiger

  • Generics;
  • Enhance loops, which can be used iteratively;
  • Automatic packing and automatic unpacking;
  • Type-safe enumeration;
  • Variable parameter;
  • Static introduction;
  • Metadata (note);
  • Instrumentation;

JAVA 6

Mustang(Mustang)

  • Support for scripting languages;
  • The JDBC 4.0 API;
  • Java Compiler API;
  • Pluggable notes;
  • To increaseNative PKI(Public Key Infrastructure), Java GSS(Generic Security Service),KerberosandLDAP(Lightweight Directory Access Protocol) support;
  • inheritanceWeb Services;

JAVA 7

2011-07-28 Dolphin(Dolphin)

  • switchStatement blocks allow strings as branching conditions;
  • Apply type inference when creating generic objects;
  • Catch multiple exceptions in a block of statements;
  • Support for dynamic languages;
  • supporttry-with-resourcesCatch multiple exceptions in a block of statements
  • The introduction ofJava NIO.2Development kit.
  • Numeric types can be represented as binary strings, and underscores can be added to string representations; Diamond syntax (applying type inference when creating generic objects);
  • nullWorth automatic processing;

JAVA 8

2014-03-18

  • Lambda expressionLambdaAllows a function to be passed as an argument to a method.
  • Method references− Method references provide a very useful syntax for directly referencing methods or constructors of existing Java classes or objects (instances). withlambdaUsed together, method references can make language construction more compact and less redundant code.
  • Default method − Default method is a method that has an implementation in the interface.
  • A new tool− New compilation tools, such as:NashornEngine JJS, class dependent parserjdeps.
  • Stream API− Newly addedStream API(java.util.stream) brings a true functional programming style to Java.
  • Date Time API − Enhances Date and Time processing.
  • Optional classes - Optional– Class has becomeJava 8 Class library for null-pointer exceptions.
  • Nashorn, JavaScript engine− Java 8 provides a new oneNashorn javascriptEngine, which allows us to run specific on the JVMjavascriptApplications.

JAVA 9

2017-09-22

  • Module system: a module is a container for packages,Java 9 One of the biggest changes was the introduction of the modular system (Project Jigsaw).
  • REPL (JShell) : Interactive programming environment.
  • HTTP 2 The client:HTTP/2The standard isHTTPThe latest version of the protocol, new HTTPClient APIsupportWebSocketHTTP2Streams and server push features.
  • The improvedJavadoc:JavadocSearching in API documents is now supported. In addition,Javadoc The output is now compliant with the HTML5 standard.
  • JAR packages compatible with multiple versions: Compatible with multiple versionsJARFunction allows you to create a version of class that you choose to use only when running a library in a particular version of your Java environment.
  • Set factory method:The List of the SetandMapInterface, a new static factory method can create immutable instances of these collections.
  • Private interface methods: Use private private methods in the interface. We can useprivate Access modifiers write private methods in the interface.
  • Process API:Improved API to control and manage operating system processes. The introduction of java.lang.ProcessHandleAnd its nested interface Info to help developers avoid having to use native code to get the PID of a local process.
  • The improvedStream API: improvedStream APISome convenience methods have been added to make flow processing easier, and collectors are used to write complex queries.
  • To improve thetry-with-resources: If you already have a resource that is final or equivalent to a final variable, you can use thetry-with-resourcesThe variable is used in the statement instead of the try-with-resourcesStatement to declare a new variable.
  • Improved deprecated annotations@Deprecated: annotation@Deprecated Java API status can be marked, which can indicate that the marked API will be removed or has been broken.
  • Improved diamond operator(Diamond Operator) Anonymous classes can use the diamond operator(Diamond Operator).To improve theOptional:java.util.Optional Many new useful methods have been added,Optional I can go straight to stream.
  • Multiresolution image API: Define a multi-resolution graphics API that allows developers to easily manipulate and display images in different resolutions.The improvedCompletableFuture API :CompletableFutureClass asynchrony is available in theProcessHandle.onExit The operation is performed when the method exits.
  • lightweight JSON API: Has a lightweight built inJSON API
  • Reactive Streams API: A new Reactive Streams API has been introduced to support Reactive programming in Java 9.

JAVA 10

2018-03-21

According to the public information on the official website, there are 12 important features as follows:

  • JEP286.varLocal variable type inference.
  • JEP296, will be usedMercurial Management of manyJDKWarehouse code, consolidated into one warehouse, simplifies the development and administration process
  • JEP304, unified garbage collection interface.
  • JEP307, G1 garbage collector’s parallel full garbage collection implements parallelism to improve worst-case latency.
  • JEP310, application class data (AppCDS) sharing, which reduces memory footprint and startup time by sharing common class metadata across processes.
  • JEP312.ThreadLocal Handshake interaction. Without entering the global JVM security point (Safepoint) to perform a callback on the thread. Optimizations can stop only a single thread, rather than all or none at all.
  • JEP313To removeJDK In the attachedjavahTool. You can usejavac -h Instead.
  • JEP314, extension with additional Unicode language markup.
  • JEP317, which can allocate the heap memory footprint to a user specified spare memory device.
  • JEP317, the use ofGraal A Java-based compiler can advance Java code to native code to improve performance.
  • JEP318In theOpenJDK Provides a default set of root certification Authority certificates in. Open source nowOracleTo provide theJava SERoot certificate, soOpenJDKMore convenient for developers to use.
  • JEP322, a time-based release, which is the release cycle mentioned above. The version number forFEATURE.INTERIM.UPDATE.PATCH, including major release, intermediate release, upgrade pack and patch release.

JAVA 11

2018-09-25

The new features after translation are:

  • 181:Nest-BasedAccess control
  • 309: Dynamic class file constants
  • 315: improveAarch64 intrinsic
  • 318: No operational garbage collector
  • 320: Eliminates Java EE and CORBA modules
  • 321:HTTP client (standard)
  • 323: Syntax λ parameter for local variables
  • 324:Curve25519andCurve448Key agreement
  • 327:Unicode 10
  • 328: Flight recorder
  • 329:ChaCha20andPoly1305The encryption algorithm
  • 330: launch a column of source code procedures
  • 331: Low-overhead heap analysis
  • 332: Transport layer security(Transport Layer Security, TLS) 1.3
  • 333: Action: A scalable low-latency garbage collector (experiment)
  • 335:Nashorn JavaScriptengine
  • 336:Pack200The tools and apis

JAVA 12

2018-09-25

The new features after translation are:

  • 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental): Add a new name named ShenandoahGarbage collector, which evacuates Java threads while they are running (evacuation) Work to reduce downtime.
  • 230: Microbenchmark Suite: A new set of microbenchmarks to enable developers to build on existing benchmarksJava MicrobenchmarkThe Harness (JMH) is used to easily test JDK performance and create new benchmarks.
  • 325: Switch Expressions (Preview) : Extends the Switch statement so that it can be used as a statement or expression, simplifying everyday code.
  • 334: JVM Constants API : Introduces an API for critical class files (key class-file) and the nominal description of the runtime artifact (nominal descriptions), especially constants that can be loaded from a constant pool.
  • 340: One AArch64 Port, Not Two: Removes all source code related to arm64 ports, retaining 32-bit ARM ports and 64-bitaarch64 Transplantation.
  • 341: Default CDS Archives: Class data sharing (CDS) Archives are generated by Default.
  • 344: Abortable Mixed Collections for G1: The garbage collection process can be aborted when the G1 garbage collector’s collection exceeds the pause target.
  • 346:Promptly Return Unused Committed Memory from G1: Improved the G1 garbage collector so that when idle, it automaticallyJavaHeap memory is returned to the operating system.

1.2 JDK versions support cycles

In order to iterate faster, Java updates moved from a traditional feature-driven release cycle to a time-driven (6-month) release model with a major release every six months and an intermediate feature release every quarter, with a promise not to break. This way, the development team can incorporate key features into the JDK as early as possible to get quick developer feedback. Officially, the new release cycle will be strictly timed and will be released in March and September each year. So the Java 11 version number is 18.9(LTS, Long Term Support). Oracle will provide technical support for Java 11 until September 2023, and extended support for patches and security warnings will continue until 2026. New long term support versions are released every three years, and the next long term support version of Java 17 will be released in 2021, according to the release schedule.

1.3 Current status of JDK versions in enterprises

In the JDK version world, Oracle always releases a new version and we stick with our old version. I used JDK 7 three years ago, and finally upgraded to JDK 8. Shortly after the upgrade, the JDK began a biannual release cycle, with releases 9, 10, 11, 12, until (September 17, 2019) JDK13.

What products do developers use for their applications in production? We can see the dominance of the Oracle JDK and OpenJDK over everyone else. A 2018 JVM Ecosystem Survey published in December 2018 by Snyk and The Java Magazine found that 70% of users use The Oracle JDK and 21% use The OpenJDK.

The JDK in Java 9 made significant structural changes that many predicted would affect migration and adoption. As we can see from the results (note that the survey was conducted between Java 10 and Java 11 releases), Java 8 remains the most dominant version of Java — eight out of 10 respondents said their main application uses Java 8 in production. Equally important, less than half of non-Java 8 respondents were using newer versions. Report on the 2018 JVM Ecological Survey [SnyK. IO /blog/ JVM-EC… Java 8 accounts for 79% of them.

1.4 JDK 13 Overview

OpenJDK 13, the latest version of the Java programming Language environment, has been released by the OpenJDK community on September 17, 2019. ZGC enhancements, updated Socket implementation, Switch expressions, text block updates and other changes, enhancements.

1.5 JDK 13 New features updated list

PROPERTIES

Website: http://openjdk.java.net/projects/jdk/13/

1.6 Starting the IDEA creation module Integrates JDK 13

  • Download JDK 13 from the official website
  • Download address: www.oracle.com/java/techno…
  • Start IDEA to create a module that integrates JDK 13

New features in JDK 13

2.1 JEP 354 Switch Expressions (Preview)

The introduction of

Extend switch branch selection statement writing. Switch expressions can continue to be used in JDK 13 after being previewed in JDK 12.

designed

The Java switch statement is a syntax that varies a lot (perhaps because the Java switch statement has not been strong enough, those familiar with Swift or JS language can compare with the Swift switch statement, you will find that the Java switch statement is relatively weak), This is because many versions of Java are constantly improving switch statements: JDK 12 extends switch statements to be used as statements or expressions, and both traditional and extended simplified versions of Switch can be used. 【 White prostitute information 】

JDK 12 enhancements to Switch focus on simplifying writing and improving functionality points.

Here’s a quick review of switch evolution:

  • As of Java 5+, Enumerations are now available for Java switch statements.
  • As of Java 7+, Java switch statements support the use of String variables and expressions.
  • Starting with Java 11+, Java’s switch statement automatically warns against an overpass caused by omitting break.
  • But from JDK12 onwards, Java’s Switch statements have been greatly enhanced.
  • The JEP in JDK 13 evolved from JEP 325].

Previous Switch program

The code is as follows:

public class Demo01{
    public static void main(String[] args){
        // Declare the variable score and assign it the value 'C'
        var score = 'C';
        // Execute the switch branch statement
        switch (score) {
            case 'A':
                System.out.println("Good");
                break;
            case 'B':
                System.out.println("Good");
                break;
            case 'C':
                System.out.println("In");
                break;
            case 'D':
                System.out.println("Pass");
                break;
            case 'E':
                System.out.println("Fail");
                break;
            default:
                System.out.println("Data illegal!"); }}}Copy the code

This is classic pre-Java 11 switch writing, but don’t forget to write break, otherwise the switch will run through and cause an error (JDK 11 will warn you).

JDK 13 doesn’t need breaks anymore

Prior to JDK 12, if the switch forgot to write break, it would cause penetration, which was improved in JDK 12. If you change the colon (:) at the end of case to an arrow, you will not run through the case without writing break, so the above program can be rewritten as follows:

public class Demo02{
    public static void main(String[] args){
        // Declare the variable score and assign it the value 'C'
        var score = 'C';
        // Execute the switch branch statement
        switch (score){
            case 'A' -> System.out.println("Good");
            case 'B' -> System.out.println("Good");
            case 'C' -> System.out.println("In");
            case 'D' -> System.out.println("Pass");
            case 'E' -> System.out.println("Fail");
            default -> System.out.println("Grade data is illegal!"); }}}Copy the code

That’s a lot cleaner code.

Switch expressions in JDK 13

Switch after JDK 12 is even available as an expression — no longer as a separate statement. For example, the following procedure.

public class Demo03 {
    public static void main(String[] args) {
		// Declare the variable score and assign it the value 'C'
        var score = 'C';
		// Execute the switch branch statement
        String s = switch (score)
                {
                    case 'A' -> "Good";
                    case 'B' -> "Good";
                    case 'C' -> "In";
                    case 'D' -> "Pass";
                    case 'F' -> "Fail";
                    default -> "Score input error"; }; System.out.println(s); }}Copy the code

The above program directly assigns the value of the switch expression to the S variable, so that switch is no longer a statement, but an expression.

Multi-value matching for switch in JDK 13

When you change the colon after the case in the switch to the arrow, the switch will not run through, but in some cases, the program will want to run through. For example, I want two cases to share one body! Cases in Switch after JDK 12 also support multi-value matching, which makes the program much more concise. For example, the following procedure.

public class Demo04 {
    public static void main(String[] args) {
// Declare the variable score and assign it the value 'C'
        var score = 'B';
// Execute the switch branch statement
        String s = switch (score)
                {
                    case 'A'.'B' -> "Fine";
                    case 'C' -> "Medium";
                    case 'D'.'E' -> "Lower";
                    default -> "Score data input is illegal!"; }; System.out.println(s); }}Copy the code

JDK 13: Yielding a value

When using arrow tags, the right side of the arrow tag can be an expression, a throw, or a code block. If it is a block of code, use the yield statement to return the value. To the right of the default statement in the print method in the following code is a code block. Use yield in code blocks to return values. JDK 13 introduced a new yield statement to produce a value that becomes the value of a closed switch expression.

public void print(int days) {
  // Declare the variable score and assign it the value 'C'
  var score = 'B';
  String result = switch (score) {
      case 'A'.'B' -> "Fine";
      case 'C' -> "Medium";
      case 'D'.'E' -> "Lower";
      default- > {if (score > 100) {
            yield "The data cannot exceed 100.";
          } else {
            yield score + "This score is less than zero."; }}}; System.out.println(result); }Copy the code

You cannot use break in switch expressions. Each label of the switch expression must either produce a value or throw an exception. The switch expression must exhaust all possible values. This means that a default statement is usually required. One exception is enumerated types. If all possible values for an enumerated type are exhausted, default is not required. 【 White prostitute information 】

In this case, the compiler automatically generates a default statement. This is because enumeration values in enumeration types can change. For example, the enumeration type Color originally had only three values: RED, GREEN, and BLUE. Switch expressions using this enumerated type exhaust all three cases and complete compilation. A new value YELLOW was added to Color, and when the previous code was called with this new value, the compiler-generated default was called to inform us that the enumeration type had changed because it did not match the existing value

summary

From the above cases, we can see that JDK 12 to JDK 13 have made great improvements to the function of Switch, and the code is also very simplified. At present, Switch still does not support interval matching. Whether it can be supported in the future remains to be seen.

2.2 JEP 355 Text Block Upgrade (Preview)

The introduction of

In Java, embed AN HTML, XML, SQL, or JSON fragment “…” in a string literal. It usually takes a lot of editing to escape and concatenate before the code that contains the section can be compiled. This piece of code is often difficult to read and maintain, so having a linguistic mechanism that represents strings more intuitively than multiple lines of text, and can span multiple lines without the visual clutter of escaping, would improve the readability and writability of a wide range of Java class programs. From JDK 13 to JDK 13, the new feature of text block is proposed, which improves the readability and convenience of Java programs to write large strings of text.

HTML sample

Use the “one-dimensional” string literal *

String html = "<html>\n" +
              " \n" +
              " 

Hello, world

\n"
+ " \n" + "</html>\n"; Copy the code

Use “two-dimensional” text blocks

String html = """   

Hello, world

"
""; System.out.println(""" Hello, itheima text blocks! """); Copy the code

Text blocks are a new syntax of the Java language that can be used to represent any string, with higher expressiveness and less complexity. The opening delimiter of a text block is the content of the string beginning with three double quotation marks “”” from a new line. The new line here is not a string, it’s just the beginning of something, it’s part of the syntax. End with “”. “”” can follow the content of the string, or it can start on another line. On another line, the string content ends with a new line.

"""
line 1
line 2
line 3
"""
Copy the code

Equivalent to a string literal:

"line 1\nline 2\nline 3\n"
Copy the code

Or concatenation of string characters:

`"line 1\n" +
"line 2\n" +
"line 3\n"
Copy the code

If a line terminator is not required at the end of the string, you can place the end delimiter on the last line of the content. For example, a text block:

"""
line 1
line 2
line 3"""`
Copy the code

Equivalent to a string literal:

"line 1\nline 2\nline 3"
Copy the code

A text block can represent an empty string, although this is not recommended because it requires two lines of source code:

String empty = """""";
Copy the code

Here are some examples of misformed text blocks:

String a = """""";   // no line terminator after opening delimiter
String b = """""";  // no line terminator after opening delimiter
String c = """";        // no closing delimiter (text block continues to EOF)
String d = """ abc \ def """;      // unescaped backslash (see below for escape processing)
Copy the code

HTML

Using raw string syntax:

String html = "<html>\n" +
              " \n" +
              " 

Hello, world

\n"
+ " \n" + "</html>\n"; Copy the code

Using text block text block syntax:

String html = """   

Hello, world

"
""; Copy the code

SQL

Using the original string syntax:


`String query = "SELECT `EMP_ID`, `LAST_NAME` FROM `EMPLOYEE_TB`\n" +
               "WHERE `CITY` = 'INDIANAPOLIS'\n" +
               "ORDER BY `EMP_ID`, `LAST_NAME`; \n";
Copy the code

Using text block syntax:

String query = """ SELECT `EMP_ID`, `LAST_NAME` FROM `EMPLOYEE_TB` WHERE `CITY` = 'INDIANAPOLIS' ORDER BY `EMP_ID`, `LAST_NAME`; """;
Copy the code

Multilanguage examples

Using the original string syntax:

ScriptEngine engine = new ScriptEngineManager().getEngineByName("js");
Object obj = engine.eval("function hello() {\n" +
                         " print('\"Hello, world\"'); \n" +
                         "}\n" +
                         "\n" +
                         "hello(); \n");
Copy the code

Using text block syntax:

ScriptEngine engine = new ScriptEngineManager().getEngineByName("js");
Object obj = engine.eval(""" function hello() { print('"Hello, world"'); } hello(); """);
Copy the code

The indentation

The Java compiler automatically removes unwanted indentation:

  • Spaces at the end of each line are removed
  • The common Spaces at the beginning of each line are automatically deleted
  • Keep only the relative indentation.
System.out.println(""" Hello, itheima text blocks! """);
/ / the result
// > Hello,
// > itheima
// > text blocks!
// >

System.out.println(""" Hello, itheima text blocks! """);
/ / the result
// > Hello,
// > itheima
// > text blocks!
// >
Copy the code
  • At the end of a new line, adjust the “”” to the left to precede all lines with a corresponding number of Spaces. Adjusting “”” to the right has no effect.
System.out.println(""" Hello, multiline text blocks! """);
/ / the result
// > Hello,
// > multiline
// > text blocks!
Copy the code

2.3 JEP 350 Dynamic Data Sharing Archive

What it does: Allows you to dynamically archive classes at the end of Java application execution. The archived classes will include all loaded application classes and library classes that do not exist in the default grass-roots CDS archive.

CDS, a feature of Java 12, allows different Java processes to share a copy of class metadata, reducing memory footprint and speeding up application startup. This feature in JDK13 supports dynamic archiving after Java Application execution. The archive class will include all loaded application and library classes that do not exist in the default base layer CDS archive. That said, when AppCDS is used again in Java 13, it doesn’t need to be so complicated. The proposal is in the goal phase to improve the usability of AppCDS and eliminate the need for users to run a trial run to create a list of classes for each application.

The target

JDK13 is the main purpose of this CDS enhancement

  • To improve theAppCDSReduces the need for users to create a list of classes each time
  • By turning it on,-Xshare:dumpOption to turn on static archiving, using class lists still works. Contains built-in class loading information and user-defined class loading information

meaning

Enhancements in JDK13 allow you to do this by simply enabling command-line options, dynamically evaluating which classes need to be archived at runtime, and supporting both built-in class loaders and user-defined class loaders. 【 White prostitute information 】

Classes are automatically archived after the first application execution, and there is no need to specify which archives to use when starting a project, making the process more transparent.

2.4 JEP 351 ZGC enhancement: ZGC frees unused memory

The target

What it does: Returns unused heap memory to the system (that is, uncommitted memory space)

Break down

ZGC is the most notable garbage collection feature introduced in Java 11. It is a scalable, low-latency garbage collector, but it was introduced experimentally in Java 11 to improve GC pause times and support heaps of hundreds of Megabytes to several terabytes. The application throughput will be reduced by no more than 15%, and the new garbage collector is currently only supported on Linux/ X 64-bit platforms.

In practice, the ZGC collector does not have the ability to actively release unused memory to the operating system, as the G1 and Shenandoah garbage collectors in Hotspot do. CPU and memory are limited and scarce resources for most applications, especially in today’s cloud or virtualized environments. 【 White prostitute information 】

If the application memory is idle for a long time, and still can’t release to the operating system, which can lead to other memory memory assigned to the need of application of this application with the memory allocated is still in the idle state, in the “too busy too busy, idle idle” state of the fair, and also easy to cause the environment based on virtualization, Overpayment for resources that are not actually used. Thus, freeing unused memory to system main memory is a very useful and much needed feature.

The major improvements to ZGC in Java 13 are as follows:

  • Release unused memory to the operating system
  • The maximum heap size is 16TB

In Java 13, ZGC memory freeing is enabled by default, but can be turned off explicitly with the -xx: -zuncommit parameter.

2.5 JEP 353 re-implements the old Socket API

The introduction of

The existing java.net.Socket and java.net.ServerSocket, as well as their implementation classes, date back to JDK 1.0. The original socket was a pain to maintain and debug. The implementation class also uses the thread stack as a buffer for I/O, resulting in the need to increase the thread stack size in some cases. There are also several concurrency issues with this implementation that need to be addressed completely. In the networked world of the future, to respond quickly and not block local method threads, the current implementation is not suitable for use.

Break down

New implementation class

Prior to Java 13, SocketImpl was implemented by using PlainSocketImpl as a concrete implementation.

A new underlying implementation in Java 13, introducing an implementation of NioSocketImpl to replace the PlainSocketImpl implementation of SocketImpl, which shares the same internal infrastructure as the NIO (new I/O) implementation, And is integrated with existing buffer caching mechanisms, so there is no need to use thread stacks. In addition to these changes, there are other more convenient changes such as using the java.lang.ref.cleaner mechanism to close sockets (if the SocketImpl implementation has been garbage collected on sockets that are not closed) and handling timeout operations when polling sockets are in non-blocking mode.

A new implementation of NioSocketImpl to replace JDK1.0’s PlainSocketImpl.

  • It is easy to maintain and debug, withNewI/O (NIO)Use the same JDK internal structure, so there is no need to use system native code.
  • It is integrated with the existing buffer caching mechanism, eliminating the need to use thread stacks for I/O.
  • It USESjava.util.concurrentLock, notsynchronized Synchronous method, enhanced concurrency.
  • The new implementation is the default implementation in Java 13, but the old implementation has not been removed and can be set by setting system properties

Jdk.net.usePlainSocketImpl to switch to the old version.

Code instructions

Running a class that instantiates Socket and ServerSocket will display this debugging output. This is the default (new).

Module java.base
Package java.net
Class SocketImpl
public abstract class SocketImpl implements SocketOptions {
  private static final boolean USE_PLAINSOCKETIMPL = usePlainSocketImpl();
  private static boolean usePlainSocketImpl(a) {
    PrivilegedAction<String> pa = () ->
NetProperties.get("jdk.net.usePlainSocketImpl");
    String s = AccessController.doPrivileged(pa);
    return(s ! = null) && ! s.equalsIgnoreCase("false");
 }
  /** Creates an instance of platform's SocketImpl */
  @SuppressWarnings("unchecked")static <S extends SocketImpl & PlatformSocketImpl> S
createPlatformSocketImpl(boolean server) {
    if (USE_PLAINSOCKETIMPL) {
      return (S) new PlainSocketImpl(server);
   } else {
      return (S) newNioSocketImpl(server); }}}Copy the code

SocketImpl USE_PLAINSOCKETIMPL depends on usePlainSocketImpl method, and it will be read from the NetProperties dk.net.usePlainSocketImpl configuration, if not null and not false, The usePlainSocketImpl method returns true; CreatePlatformSocketImpl creates PlainSocketImpl or NioSocketImpl based on USE_PLAINSOCKETIMPL.

With these changes, the Java Socket API will be easier to maintain, and better maintenance will improve the reliability of Socket code. NIO implementations can also be done at the base level, leaving the Socket and ServerSocket class levels unchanged.

2.6 Other Features

In addition to the major features listed above, there are also some API updates and deprecations, mainly see JDK 13 Release Notes, here are a few examples. Jdk.java.net/13/release-…

Add item

Add the FileSystems. NewFileSystem (Path, Map < String,? >) Method The new java.nio.bytebuffer Bulk get/ PUT Methods Transfer Bytes Without Regard to Buffer Position supports Unicode 12.1 Adding -xx :SoftMaxHeapSize Flag, which currently only works for ZGC, increases the maximum HEAP size for ZGC to 16TB

Remove items

Remove the guider. Toolkit System Property RemoveRuntime Trace Methods Remove-xx :+AggressiveOpts Removeer Two Comodo Root CA Certificates, Two Comodo Root CA Certificates DocuSign Root CA Certificates removes internal com.sun.net.ssl packages

Discarded items

Deprecated -xverify: None and -noverify deprecated rmic Tool and ready to remove deprecated javax.security.cert and ready to remove

Known issues

Windows 2019 Core Server no longer supports using ZIP File System (Zipfs) Provider to update ZIP or JAR containing Uncompressed Entries, which may cause File damage

The last

Java is getting better and better at incorporating key features, getting quick developer feedback, and so on after a semi-annual update release cycle. From Java 11 to Java 13, the current update schedule is strictly semi-annual. The release of Java 13 brings with it a number of new features and enhancements, performance improvements, and enhancements.

Of the five features included above, the main ones that will change the coding style of developers are Text Blocks and Switch Expressions, which are still in the preview phase.

Also, JDK13 is not an LTS (long term support) release, so if you are using -Java 8 (LTS) or Java 11 (LTS), you don’t need to upgrade to Java 13 for now.

Finally, I wish you all an early success, get satisfactionoffer, fastA promotion and pay increaseTo the top of your life.

If you can, please give me a three support me?????? 【 White prostitute information 】