Conversational marketing. How to guide shoppers through a marketing path.14 August 2020
Google indicators – Core Web Vitals28 August 2020
The latest versions of Java adequately came in September 2019 (Java 13) and six months later in March (Java 14). We will describe them one by one to see the changes which have occurred over time.
Apart from more than 2,300 bug fixes and minor enhancements, the new Java version includes 5 major enhancements which are also called JEPs. Java 13 arrives with improvements in range of memory removal, data sharing of application class, and text blocks.
Introduction of text blocks
The main new function of Java 13 for developers is the introduction of text blocks. Again, the architects accountable for Java’s evolutions chose to be careful because text blocks are only available as an experimental function in Java 13.
Text blocks are just a new type of chain literal which allows you to write strings over several lines. To simplify their use, it has been decided that the text block will start with a new specified separator and end of line. This allows you to use simple quotation marks in a text block without escaping them.
Text blocks retain user-defined indentations when declared in the source code. Only the indentation made before the first letter is removed as it is considered random.
Improvements in the Garbage Collector
Garbage Collector is an essential part of Java Virtual Machines. With the development of the JDK, to be up to the new needs of Java applications, new implementations were proposed by Oracle and Red Hat.
In this way, a low-latency garbage collector called ZGC appeared in Java 11. This Garbage Collector was offered on an experimental basis and not available for all backgrounds.
In Java 13, the ZGC has been improved to allow unused stack of memory to be returned to the underlying operating system. Currently, ZGC does not do this and this behavior has clearly not been optimal for all types of applications and target environments. This was even more problematic in cases where the memory footprint is a serious problem. For example:
- Container environments.
- Environments where an application may be disabled for long periods and may compete with other applications for resources.
- An application whose disk space requirements can change during runtime.
Other garbage collectors, such as Red Hat’s G1 or Shenandoah, provide this capability today. It was therefore necessary to add this possibility to the ZGC in Java 13 to facilitate its future adoption.
A reimplementation of the legacy Sockets API which replaces the base implementation used by the Socket APIs with a more modern implementation which is easy to debug and maintain. The new implementation will be accomodated to work with user-mode threads, also known as fibers. The older APIs mentioned above are from JDK 1.0 and are a mix of older C and Java code described as difficult to debug and maintain. The older implementation also has other issues like the native data structure to handle asynchronous shutdown, causing reliability and portability issues, and concurrency issues which must be reviewed.
Dynamic CDS Archives
A lot has happened in the Java Virtual Machine (JVM) and the class library. Class Data Sharing (CDS) was introduced in Java 5. The aim of CDS is to reduce Java application startup time by storing some class information in Class Data Sharing archives. This data can then be loaded at runtime and used by several JVMs.
However, up to Java 10, shared archives were only available to the module loader of Bootstrap’s class. Starting in Java 10, CDS has been extended to Application Class Data Sharing (AppCDS). AppCDS allows the embedded system and platform class loader, as well as user-defined class loaders, to access CDS archives. Class lists are required to create CDS archives to identify the classes to load.
Previously, these class lists had to be determined by test runs of the application to determine which classes were actually loaded during execution. As of Java 12, default CDS archives ship with the JDK, which are based on the JDK’s class list. The aim is to save additional test runs of the application. After the application is executed, only the newly loaded application classes and libraries are archived, which are not yet in the CDS of the default layer, Dynamic archiving is activated via command line.
This is an update which introduced new switch expressions in JDK 12 as a language preview function. It has been added a new, simplified form of a switch block with labels. After the new syntax was introduced in JDK 12, a request for feedback was sent to the mailing list. The collected opinions resulted in a study which introduces only one change. In the new version of switch expressions, this will be replaced with a new yield statement. The new Switch expressions are still only available in preview mode. Java 13 doesn’t have many JEPs. For most Java users, only text blocks and Switch expressions will be interesting. However, these are only preview language functions which are not available by default.
Java 14 adds new functions to improve developer productivity, including Java support for Switch expressions, new APIs for continuous monitoring of JDK Flight Recorder data, and enhanced low-latency the Z Garbage Collector availability for macOS and Windows.
JDK 14 brings many new functions to the Java programming language. Some of them are more interesting than others and some are more like cleaning. Here is a summary of the new functions:
Pattern matching for the instanceof
This is a preview function in JDK 14. Pattern matching allows a more brief and safer representation of common program logic, mainly conditional extraction of components from objects. The code can be short and types-safe.
Memory allocation including NUMA for G1
NUMA memory allocation for the Garbage Collector G1 module is aimed at improving G1 performance on large machines.
JFR event streaming
JFR Event Streaming provides an API for continuous use of JFR data from both in-process and out-of-process applications. JFR is a tool for collecting profile and diagnostic data about running Java applications and Java virtual machine. Event Streaming Proposal logs the same set of events as in no streaming, with an overhead of less than one percent whether possible. Event streaming must coexist with non-streaming recordings, both on disk and memory.
MappedByteBuffer with the ability to extend access to non-volatile memory (NVM). This memory is used for permanent data storage. This Java enhancements proposal introduces a new module and class to the JDK API.
The NullPointerExceptions improvement apply to the usability of exceptions generated by the Java Virtual Machine. This is aimed at providing helpful information to developers about premature program ending and to improve understanding of the program by more clearly associating the dynamic exception with the static program code.
JEP 359 provides records as a preview function for Java. Records are a new type. They represent a restricted form of a declaration class. Records are different from classic classes in that they cannot separate their API from its representation. However, the lost freedom is compensated by increased precision.
In JEP 325, it is proposed to extend the switch statement so as it can be used as a statement or an expression. Both forms should be able to use ‘traditional’ or ‘simplified’ variables and check structures. The aim of this JEP was to simplify daily programming and to pave the way for pattern matching in conjunction with a Switch instruction.
Removal of the Solaris and the SPARC ports
The Solaris operation system is no longer really up to date. In this connection, Oracle’s willingness to mark ports for Solaris / SPARC, Solaris / x64, and Linux / SPARC as obsolete is not surprising. However, it should be noted that old versions of Java (up to JDK 14) should work unchanged on old systems, including the appropriate ports. The aim of the whole thing is to take care of other functions.
Removal of the CMS (Concurrent Mark Sweep) module
Removal of Garbage Collector Concurrent Mark Sweep (CMS) which was previously redundant and intended for removal. There were established the successors to CMS, including ZGC and Shenandoah.
Z Garbage Collector on macOS and Windows
The proposal aims are to provide Z Garbage Collector as an option for macOS and Windows users. There is also collector functionality to free up unused memory for the system.
Withdrawal of the call ParallelScavenge + SerialOld
JEP 366 also applies to garbage collectors, or in this case a combination of two: ParallelScavenge and SerialOld. It is suggested to mark the combination of these two algorithms as obsolete as probably only a few developers use them in this constellation.
Removal of the Pack 200 tool
Pack200 is a JAR file compression scheme. There was removed Pack200 tools and API. They have all been retreated in Java SE 11 with the intention of removing them in the future.
Second preview of text blocks, a multiline string literal which avoids most special sequences and automatically formats the string in a predictable way.
Foreign Memory Access API
There are tons of Java libraries and applications which access foreign memory. However, the Java API itself does not provide a good way to do this, although it can lower cleanup costs and share memory across multiple processes.
Java 14 brings a lot of new stuff. There are some interesting changes in it, but it is worth noting that the changes are not groundbreaking. However, similarly to the previous editions, there is a visible trend of gradual modernization of the language. We keep getting Garbage Collectors improvements, which are crucial for the performance of Java virtual machine applications.