What a Year! Java 10 and 10 Big Java Milestones

Similar documents
Using the Oracle Business Intelligence Publisher Memory Guard Features. August 2013

Creating Custom Project Administrator Role to Review Project Performance and Analyze KPI Categories

Oracle CIoud Infrastructure Load Balancing Connectivity with Ravello O R A C L E W H I T E P A P E R M A R C H

Generate Invoice and Revenue for Labor Transactions Based on Rates Defined for Project and Task

An Oracle White Paper November Primavera Unifier Integration Overview: A Web Services Integration Approach

Correction Documents for Poland

Veritas NetBackup and Oracle Cloud Infrastructure Object Storage ORACLE HOW TO GUIDE FEBRUARY 2018

An Oracle White Paper June StorageTek In-Drive Reclaim Accelerator for the StorageTek T10000B Tape Drive and StorageTek Virtual Storage Manager

Leverage the Oracle Data Integration Platform Inside Azure and Amazon Cloud

Configuring Oracle Business Intelligence Enterprise Edition to Support Teradata Database Query Banding

Load Project Organizations Using HCM Data Loader O R A C L E P P M C L O U D S E R V I C E S S O L U T I O N O V E R V I E W A U G U S T 2018

Protecting Your Investment in Java SE

Loading User Update Requests Using HCM Data Loader

Oracle Data Provider for.net Microsoft.NET Core and Entity Framework Core O R A C L E S T A T E M E N T O F D I R E C T I O N F E B R U A R Y

Oracle DIVArchive Storage Plan Manager

Oracle WebLogic Portal O R A C L E S T A T EM EN T O F D I R E C T IO N F E B R U A R Y 2016

Migration Best Practices for Oracle Access Manager 10gR3 deployments O R A C L E W H I T E P A P E R M A R C H 2015

Repairing the Broken State of Data Protection

Handling Memory Ordering in Multithreaded Applications with Oracle Solaris Studio 12 Update 2: Part 2, Memory Barriers and Memory Fences

Installation Instructions: Oracle XML DB XFILES Demonstration. An Oracle White Paper: November 2011

Achieving High Availability with Oracle Cloud Infrastructure Ravello Service O R A C L E W H I T E P A P E R J U N E

VISUAL APPLICATION CREATION AND PUBLISHING FOR ANYONE

Oracle Java SE Advanced for ISVs

October Oracle Application Express Statement of Direction

Sun Fire X4170 M2 Server Frequently Asked Questions

August 6, Oracle APEX Statement of Direction

An Oracle White Paper October The New Oracle Enterprise Manager Database Control 11g Release 2 Now Managing Oracle Clusterware

Tutorial on How to Publish an OCI Image Listing

Oracle Grid Infrastructure 12c Release 2 Cluster Domains O R A C L E W H I T E P A P E R N O V E M B E R

Oracle Secure Backup. Getting Started. with Cloud Storage Devices O R A C L E W H I T E P A P E R F E B R U A R Y

Increasing Network Agility through Intelligent Orchestration

Automatic Receipts Reversal Processing

Oracle Fusion Configurator

Oracle NoSQL Database For Time Series Data O R A C L E W H I T E P A P E R D E C E M B E R

Oracle JD Edwards EnterpriseOne Object Usage Tracking Performance Characterization Using JD Edwards EnterpriseOne Object Usage Tracking

An Oracle Technical Article March Certification with Oracle Linux 4

An Oracle White Paper September Security and the Oracle Database Cloud Service

RAC Database on Oracle Ravello Cloud Service O R A C L E W H I T E P A P E R A U G U S T 2017

Oracle Exadata Statement of Direction NOVEMBER 2017

An Oracle White Paper June Exadata Hybrid Columnar Compression (EHCC)

JD Edwards EnterpriseOne Licensing

Cloud Operations for Oracle Cloud Machine ORACLE WHITE PAPER MARCH 2017

Oracle Developer Studio 12.6

Oracle Cloud Applications. Oracle Transactional Business Intelligence BI Catalog Folder Management. Release 11+

Oracle Enterprise Performance Reporting Cloud. What s New in September 2016 Release (16.09)

Siebel CRM Applications on Oracle Ravello Cloud Service ORACLE WHITE PAPER AUGUST 2017

Oracle Clusterware 18c Technical Overview O R A C L E W H I T E P A P E R F E B R U A R Y

Oracle Database Appliance X6-2S / X6-2M ORACLE ENGINEERED SYSTEMS NOW WITHIN REACH FOR EVERY ORGANIZATION

Oracle Developer Studio Code Analyzer

Handling Memory Ordering in Multithreaded Applications with Oracle Solaris Studio 12 Update 2: Part 1, Compiler Barriers

Oracle WebLogic Server Multitenant:

An Oracle White Paper July Oracle WebCenter Portal: Copying a Runtime-Created Skin to a Portlet Producer

WebCenter Portal Task Flow Customization in 12c O R A C L E W H I T E P A P E R J U N E

An Oracle White Paper September, Oracle Real User Experience Insight Server Requirements

StorageTek ACSLS Manager Software Overview and Frequently Asked Questions

An Oracle White Paper December, 3 rd Oracle Metadata Management v New Features Overview

Oracle Grid Infrastructure Cluster Domains O R A C L E W H I T E P A P E R F E B R U A R Y

Oracle Data Masking and Subsetting

DATA INTEGRATION PLATFORM CLOUD. Experience Powerful Data Integration in the Cloud

Oracle Enterprise Data Quality New Features Overview

Improve Data Integration with Changed Data Capture. An Oracle Data Integrator Technical Brief Updated December 2006

An Oracle White Paper June Enterprise Database Cloud Deployment with Oracle SuperCluster T5-8

Deploying Custom Operating System Images on Oracle Cloud Infrastructure O R A C L E W H I T E P A P E R M A Y

Oracle JD Edwards EnterpriseOne Object Usage Tracking Performance Characterization Using JD Edwards EnterpriseOne Object Usage Tracking

Bastion Hosts. Protected Access for Virtual Cloud Networks O R A C L E W H I T E P A P E R F E B R U A R Y

Working with Time Zones in Oracle Business Intelligence Publisher ORACLE WHITE PAPER JULY 2014

ORACLE SERVICES FOR APPLICATION MIGRATIONS TO ORACLE HARDWARE INFRASTRUCTURES

Technical Upgrade Guidance SEA->SIA migration

Overview. Implementing Fibre Channel SAN Boot with the Oracle ZFS Storage Appliance. January 2014 By Tom Hanvey; update by Peter Brouwer Version: 2.

An Oracle White Paper April How to Use Tape Tiering Accelerator (Automatically Linked Partition)

Oracle Database 12c: JMS Sharded Queues

Oracle Learn Cloud. Taleo Release 16B.1. Release Content Document

SecureFiles Migration O R A C L E W H I T E P A P E R F E B R U A R Y

Oracle Database Vault

New Oracle NoSQL Database APIs that Speed Insertion and Retrieval

Oracle Developer Studio Performance Analyzer

An Oracle White Paper December Oracle Exadata Database Machine Warehouse Architectural Comparisons

Migrating VMs from VMware vsphere to Oracle Private Cloud Appliance O R A C L E W H I T E P A P E R O C T O B E R

Oracle Service Cloud Agent Browser UI. November What s New

Extreme Performance Platform for Real-Time Streaming Analytics

Hard Partitioning with Oracle VM Server for SPARC O R A C L E W H I T E P A P E R J U L Y

Differentiate Your Business with Oracle PartnerNetwork. Specialized. Recognized by Oracle. Preferred by Customers.

April Understanding Federated Single Sign-On (SSO) Process

Oracle Big Data SQL. Release 3.2. Rich SQL Processing on All Data

DevOps for Oracle Forms Using Developer Cloud Service

An Oracle White Paper October Oracle Social Cloud Platform Text Analytics

Application Container Cloud

Benefits of an Exclusive Multimaster Deployment of Oracle Directory Server Enterprise Edition

Oracle Mobile Application Framework

An Oracle Technical Article November Certification with Oracle Linux 7

Oracle Spatial and Graph: Benchmarking a Trillion Edges RDF Graph ORACLE WHITE PAPER NOVEMBER 2016

Partitioning in Oracle Database 10g Release 2. An Oracle White Paper May 2005

Differentiate Your Business with Oracle PartnerNetwork. Specialized. Recognized by Oracle. Preferred by Customers.

Oracle Social Network

An Oracle White Paper October Minimizing Planned Downtime of SAP Systems with the Virtualization Technologies in Oracle Solaris 10

Deploy VPN IPSec Tunnels on Oracle Cloud Infrastructure. White Paper September 2017 Version 1.0

Frequently Asked Questions Oracle Content Management Integration. An Oracle White Paper June 2007

Automatic Data Optimization with Oracle Database 12c O R A C L E W H I T E P A P E R S E P T E M B E R

An Oracle White Paper October Deploying and Developing Oracle Application Express with Oracle Database 12c

Transitioning from Oracle Directory Server Enterprise Edition to Oracle Unified Directory

Transcription:

What a Year! Java 10 and 10 Big Java Milestones Java has made tremendous strides in the past 12 months, with exciting new features and capabilities for developers of all kinds.

Table of Contents INTRODUCTION Twelve Months of Java Excitement 3 JAVA 10 AND 10 BIG JAVA MILESTONES 01: Java 10 Debuts a New Six-Month Feature Release Model 4 02: Application Class-Data Sharing Speeds Startup, Saves Memory 4 03: Link-Time Utility Optimizes Application Bytecode for Deployment 5 04: Experimental Java-Based JIT Compiler 6 05: The Parallel Full Garbage Collector Dumps the Trash Efficiently 6 06: Java Platform Module System Shrinks Java Deployments 7 07: Convenience Factory Methods Make Small Collections a Snap 7 08: Optional Class Enhancements Handles Null 8 09: Stream API Enhancements Help Solve Coding Challenges 9 10: JShell Gives Developers Immediate Feedback When Learning Java 9 The #1 Platform for Development in the Cloud 10 What a Year! Java 10 and 10 Big Java Milestones 2

Introduction: Twelve Months of Java Excitement Since its first release in 1995, the Java language and Java platform have grown and evolved and today, Java remains the cornerstone platform for desktop, server, embedded systems, and now cloud development. Never content to rest on their well-earned laurels, Oracle and the Java community are taking the Java platform to new heights and that includes both the open source OpenJDK and the commercially licensed Oracle Java SE products. Take a tour of 10 new changes released with Java 9 and Java 10 over the past 12 months a period that saw two releases of the Java platform. What a Year! Java 10 and 10 Big Java Milestones 3

01: JAVA 10 DEBUTS A NEW SIX-MONTH FEATURE RELEASE MODEL Twelve busy months. Two releases, Java 9 and Java 10. What s going on? Easy: Starting with Java 10, released in March 2018, Java has moved to a faster release cadence, with relatively smaller feature releases every six months. This is a significant change from Java s previous model of one large release every two to three years. This accelerated schedule allows for rapid iterations of the Java platform, and the ability, for Java developers, to leverage new APIs and features faster than ever. Before JDK 10, Java s improvements on APIs, the language, and JVM were only delivered when big features were ready that is, every three years, more or less. That s too slow to keep up with today s ever-accelerating pace of innovation. For Java to remain competitive, the Java community determined that the platform must not just continue to move forward it must move forward faster than ever before, with a smoother delivery of new features. Shipping a Java release every six months is rapid enough to ensure that small features can be delivered quickly, while allowing enough time to properly integrate larger features when they are ready. As you can see with the features added with Java 10, just six months after the release of Java 9, this new cadence ensures that Oracle can deliver value on each release and maintain the high quality expected by the Java community. Java remains the cornerstone platform for desktop, server, embedded systems, and now cloud development. This accelerated schedule allows for rapid iterations of the Java platform, and the ability, for Java developers, to leverage new APIs and features faster than ever. 02: APPLICATION CLASS-DATA SHARING SPEEDS STARTUP, SAVES MEMORY The Application Class-Data Sharing functionality, now available to everyone in Java 10, allows application classes to be placed in a shared archive. The benefit can be significantly faster startup times, as well as reduced memory footprint. In previous releases of Java, each process had its own copy of all application classes. The JVM loaded a fresh copy of those classes each time it created a new process. With cloud applications having potentially tens of thousands of classes and continually creating and killing processes this is not only wasteful of memory and resources, but also time-consuming. With Application Class-Data Sharing, the classes are loaded into a shared memory space as needed. When a process is created and needs an already loaded class, the JVM points to shared-class metadata instead of loading new instances of the classes for each process. Code Sample #1: Application Class-Data Sharing Using the AppCDS archive Once the AppCDS archive is created, you can use it when starting the application. Do this by specifying the -Xshare:on -XX:+UseAppCDS command-line options, with the -XX:SharedArchiveFile option to indicate the name of the archive file. For example: $ java -Xshare:on -XX:+UseAppCDS -XX:SharedArchiveFile=hello.jsa \ -cp hello.jar HelloWorld What a Year! Java 10 and 10 Big Java Milestones 4

With jlink, there is now a single tool that can analyze the entire application, and perform optimizations to ensure that the distribution only contains what is required. This functionality extends the previous, more limited Class-Data Sharing functionality, which allowed the application s bootstrap class loader to share class data prior to beginning execution. Beginning with Java 10, the JVM can also load and share application class data while the application is running. This new feature is also ideally suited to microservices and serverless architecture. 03: LINK-TIME UTILITY OPTIMIZES APPLICATION BYTECODE FOR DEPLOYMENT An application is designed. Written. Tested. Ready to deploy to the targeted server or other device containing a JVM. However, sometimes there are opportunities to optimize the size of the application beyond what s normally done by the Java compiler and JVM runtime environment. That s where jlink comes in. jlink, a new utility added with Java 9, introduces further improvements at link time, which is an optional phase between compile time (when the developer s source code is translated into JVM-readable bytecode) and runtime (when the bytecode is loaded into and executed on the target device s JVM). Link time provides a unique opportunity to perform what s known as whole-world optimization on the complete application. Large programs can now be written and compiled in discrete, manageable pieces, called modules. A finished program might include many modules created by the development team, as well as modules reused from other projects or from open source communities. However, not every application will need the same set of modules. In the past, it was time-consuming to minimize the runtime needed for an application, and the level of granularity available was not as good as what can now be achieved. With jlink, there is now a single tool that can analyze the entire application, and perform optimizations to ensure that the distribution only contains what is required the necessary modules and their dependencies. What a Year! Java 10 and 10 Big Java Milestones 5

The output from running jlink is a custom runtime image, which is reduced in size, compared to the complete JDK image, and easier to distribute and deploy. Not only that, but since the jlink-optimized custom runtime image contains only what s necessary for the application, the image can be loaded and executed more efficiently by the JVM. 04: EXPERIMENTAL JAVA-BASED JIT COMPILER A just-in-time (JIT) compiler translates programming code into fast, efficient machineoptimized computer code only a few moments before it s needed by the application. Thanks to the rapid iterations of software driven by the Java release cadence, developers can get their hands on Graal, an experimental JIT now included with OpenJDK in Java 10. Graal is the basis of the experimental Java ahead-of-time (AOT) compiler, which was first introduced in JDK 9. Enabling it to be used as an experimental JIT compiler in Java 10 is one of the initiatives of Project Metropolis, and is the next step in investigating the feasibility of a Java-based JIT for the JDK. Graal has the potential to improve application performance by aggressively optimizing code for specific microprocessor architectures. The Graal JIT is strictly experimental at this stage, and can only compile code for Linux running on the x86 platform. The goal is for developers to get hands-on experience using Graal as a JIT, and for contributors to the Java platform to run a battery of standardized tests on Graal in their own software development and deployment environments. The benefits: Java developers gain access to technologies quickly, thanks to the faster release cadence and work can proceed more quickly on the Graal JIT. Thanks to the rapid iterations of software driven by the Java release cadence, developers can get their hands on Graal, an experimental JIT now included with OpenJDK in Java 10. New for Java 10, the full GC mode functionality of the G1 garbage collector has been rewritten as faster parallel code. 05: THE PARALLEL FULL GARBAGE COLLECTOR DUMPS THE TRASH EFFICIENTLY In Java, garbage collection (GC) is the process of looking at memory, identifying which objects are in use and which are not, and deleting the unused objects. GC frees up memory for use by other objects in the program and without GC, many programs would eventually run out of memory. The JVM runs GC automatically based on various criteria, such as a large number of unreferenced, no-longer-used objects that are still consuming memory. The highly efficient garbage collector in Java is named G1. Most of the time, the JVM runs G1 in conjunction with application threads so that programs keep running without interruption. Sometimes, however, the JVM needs to run a full garbage collection when there are excessive unreferenced objects in memory. In those cases, the JVM pauses application execution for a few moments and runs G1 in full GC mode, dedicating all available processor resources to run GC as fast as possible. New for Java 10, the full GC mode functionality of the G1 garbage collector has been rewritten as faster parallel code. Previously, full GC functionality ran in only a single thread. The benefit: The full GC executes faster, thereby pausing application execution for a shorter period of time. What a Year! Java 10 and 10 Big Java Milestones 6

With cloud-based servers that can run hundreds or thousands of Java applications, the Java community saw the need to break Java SE and Java applications into modules that contained essential functionality. 06: JAVA PLATFORM MODULE SYSTEM SHRINKS JAVA DEPLOYMENTS The Java Platform Module System (JPMS), introduced with Java 9 in September 2017, optimizes the process of configuring and deploying large Java programs. Previously, with only a few exceptions, it was difficult to break the Java platform, and large programs, into smaller pieces that can be used on small devices or to eliminate parts of the Java platform that aren t needed to save memory or storage space. This often resulted in wasted resources. With cloud-based servers that can run hundreds or thousands of Java applications, and with Java applications themselves becoming larger and more complex, the Java community saw the need to break Java SE and Java applications into modules that contained essential functionality. The JPMS, a central component of Project Jigsaw, allows the Java SE platform to be decomposed into a set of components, which can be assembled by developers into custom configurations that contain only the functionality actually required by the developer s application. These custom configurations can be optimized to run faster in some cases, and also be more secure by removing unneeded functions and APIs. 07: CONVENIENCE FACTORY METHODS MAKE SMALL COLLECTIONS A SNAP In Java, a collection is a set of objects. The collection might be as simple as a list of numbers, or may be as complex as a queue, tree, or hash. Developers frequently use collections throughout applications perhaps hundreds of collections may be used. Sometimes those collections are large or complicated, and the objects within the collection are changed while the program is running. Often, however, developers require collection that is small, simple, and unchanging like a list of the numbers from 1 to 10. What a Year! Java 10 and 10 Big Java Milestones 7

Traditionally, Java requires several lines of code to create such small, unmodifiable collections, with separate lines of code to declare and initialize an empty collection, then one line of code to add each individual element, and a final instruction to declare the resulting collection immutable. The convenience factory methods for collections, introduced in Java 9, are used for creating collections with small numbers of elements. The code can be written in a single expression. The benefit: Collections are easier to create and the code is easier to understand. The convenience factory methods for collections, introduced in Java 9, are used for creating collections with small numbers of elements. 08: OPTIONAL CLASS ENHANCEMENTS HANDLES NULL The Optional class, introduced with Java 8, is used to extend objects to indicate that the value of the object may be null literally no value, which is not the same as zero or an empty string. Normally, a program throws an error when it unexpectedly tries to manipulate an object with a null value. However, in some situations, null may be a valid state for an object, and thus the need to create the Optional class. The Java community decided to extend the Optional class with enhancements, which appeared in Java 9. One enhancement is the Stream method, which facilitated converting a stream of Optional objects into a stream of values. Without the Stream method, the programmer would have to write code to filter out null values before converting the objects into values, or otherwise process those objects. Code Sample #2: Optional Class Enhancement Stream of Optional // Convert List<CustomerID> to List<Customer>, ignoring unknowns // Java 8 List<Customer> list = custidlist.stream().map(customer::findbyid).filter(optional::ispresent) 1.map(Optional::get) 2.collect(Collectors.toList()); // Java 9 adds Optional.stream(), allowing filter/map to be fused into a flatmap: List<Customer> list = custidlist.stream().map(customer::findbyid).flatmap(optional::stream) 3.collect(Collectors.toList()); Assume findbyid() returns Optional<Customer> 1 Let only present Optionals through 2 Extract values from them 3 Optional.stream() allows filter() and map() to be fused into flatmap() What a Year! Java 10 and 10 Big Java Milestones 8

The value of the Optional class enhancement is it s easier to work with Optional objects, which not only simplifies the developer s work, but also makes it easier to create robust code that will hand the presence of null values, a common source of runtime errors. 09: STREAM API ENHANCEMENTS HELP SOLVE CODING CHALLENGES Streams are a sequence of elements that can be worked on either sequentially or in parallel. To process a stream, the group of source elements is placed in a pipeline; operations are applied to the pipeline; and then a terminal operation determines what to do with the results. If only some elements in the stream need to be processed, the programmer specifies a filter, which is applied to the pipeline. Streams provide an efficient way to process data, in part because streams are lazy and don t waste processor resources: Computation on the source data is only performed when the terminal operation is initiated, and source elements are consumed only as needed. Streams are becoming increasingly important, especially for developers using functional methodologies, or who are moving to cloud-based serverless computing. JShell, introduced with Java 9, is a tool designed specifically to help developers with that trial-and-error process. Java 8 saw the first implementation of streams in the Java platform. The Java community enhanced the Streams API in Java 9 to add more methods. The iterate method, for example, offers a simple way to create loops that are bounded by a maximum value or condition, reducing the possibility of infinite loops. Code Sample #3: Stream API Enhancements Here s a simple example that takes the new static iterate, and the new takewhile : IntStream.iterate(1, n -> n + 1).takeWhile(n -> n < 10).forEach(System.out::println); Overall, the Stream API enhancements in Java 9 offer important improvements to developers using streams, making code easier to write and understand. 10: JSHELL GIVES DEVELOPERS IMMEDIATE FEEDBACK WHEN LEARNING JAVA The Java libraries contain thousands of packages, classes, and interfaces with their respective methods and fields. It can be a challenge for developers to figure out exactly which library can help solve a particular programming problem most elegantly or most effectively. Another challenge: Learning how to program these libraries often takes some trial and error before one masters it. JShell, introduced with Java 9, is a tool designed specifically to help developers with that trial-and-error process, which is set up as what s called a Read-Eval-Print Loop (REPL). In other words, load the data, test the code, and see the results immediately. What a Year! Java 10 and 10 Big Java Milestones 9

JShell is a command-line tool that facilitates the developer to interactively evaluate declarations, statements, and expressions of the Java programming language. Most importantly: Statements and expressions need not occur within a method, and variables and method need not occur within a class. That eliminates a lot of the overhead needed to set up the tests so that developers can focus on the REPL scenario itself. Java is the #1 platform for development in the cloud, and with more than 12 million developers worldwide running Java, the platform has never been so popular. The benefit: Developers can experiment with the Java language and libraries quickly, interactively test how a class or method will work in their specific application context, get immediate feedback, and then quickly leverage what they have learned in their programs. THE #1 PLATFORM FOR DEVELOPMENT IN THE CLOUD Java is the #1 platform for development in the cloud, and with more than 12 million developers worldwide running Java, the platform has never been so popular. The past 12 months have seen two new releases of Java and with releases on a six-month schedule, the best will only get better. Visit website to see how Java 10 powers our digital world and can power yours, too. What a Year! Java 10 and 10 Big Java Milestones 10

ORACLE CORPORATION Worldwide Headquarters 500 Oracle Parkway, Redwood Shores, CA 94065, USA Worldwide Inquiries TELE + 1.650.506.7000 + 1.800.ORACLE1 FAX + 1.650.506.7200 oracle.com CONNECT WITH US facebook.com/oracle youtube.com/oracle linkedin.com/company/oracle twitter.com/oracle Copyright 2018, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only, and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 180xxxx xxxxxx