Mastering Java 11
Dr. Edward Lavieri更新时间:2021-08-13 15:44:44
最新章节:Leave a review - let other readers know what you think封面
Title Page
Copyright and Credits
Mastering Java 11 Second Edition
Dedication
Packt Upsell
Why subscribe?
Packt.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
The Java 11 Landscape
Technical requirements
Understanding the Java platform's new versioning model
Feature-driven releases
Time-based releases
Understanding the significance of Java 9
Breaking the monolith
Using the Java Shell
Taking control of external processes
Boosting performance with G1
Measuring performance with JMH
Getting ready for HTTP 2.0
Encompassing reactive programming
Benefiting from changes introduced with Java 10
Local variable type inference
Consolidation of the JDK forest into a single repository
Garbage collection interface
Parallel full garbage collector for G1
Application class-data sharing
Thread-local handshakes
Removal of the native-header generation tool (javah)
Additional Unicode language-tag extensions
Heap allocation on alternative memory devices
Experimental Java-based JIT compiler
Root certificates
Benefiting from changes introduced with Java 11
Dynamic class-file constants
Epsilon – an arbitrarily low-overhead garbage collector
Removal of the Java EE and CORBA modules
Local variable syntax for Lambda parameters
Summary
Questions
Further reading
Discovering Java 11
Technical requirements
Improved contended locking
Improvement goals
Segmented code cache
Memory allocation
Smart Java compilation
Resolving lint and doclint warnings
Tiered attribution for Javac
Annotations pipeline 2.0
New version-string scheme
Generating runtime compiler tests automatically
Testing class-file attributes generated by Javac
Storing interned strings in class-data sharing archives
The problem
The Java 9 solution
The Java 10 improvement
Class determination
AppCDS archive creation
Using the AppCDS archive
Preparing JavaFX UI controls and Cascading Style Sheet APIs for modularization
JavaFX overview
Implications for Java 9 10 and 11
Compact strings
Merging selected Xerces 2.11.0 updates into JAXP
Updating JavaFX/Media to the newer version of GStreamer
HarfBuzz font-layout engine
HiDPI graphics on Windows and Linux
Marlin graphics renderer
Unicode 8.0.0
New in Unicode 8.0.0
Updated classes in Java 9
Reserved stack areas for critical sections
The pre-Java 9 situation
New in Java 9
Dynamic linking of language-defined object models
Proof of concept
Additional tests for humongous objects in G1
Improving test-failure troubleshooting
Environmental information
Java process information
Optimizing string concatenation
HotSpot C++ unit-test framework
Enabling GTK3 on Linux
New HotSpot build system
Consolidating the JDF forest into a single repository
Summary
Questions
Further reading
Java 11 Fundamentals
Technical requirements
Working with variable handlers
Working with the AtoMiC ToolKit
Using the sun.misc.Unsafe class
Import statement depreciation warnings
Milling Project Coin
Using the @SafeVarargs annotation
The try-with-resource statement
Using the diamond operator
Discontinuing use of the underscore
Making use of private interface methods
Import statement processing
Inferring local variables
Inferring declarations with the var identifier
Local variable syntax for Lambda parameters
Thread-local handshakes
Heap allocation on alternative memory devices
Root certificates
Dynamic class-file constants
Removal of the Java EE and CORBA modules
Summary
Questions
Further reading
Building Modular Applications with Java 11
Technical requirements
A modular primer
The modular JDK
Modular source code
JDK source code organization before modularization
Development tools
Deployment
Internationalization
Monitoring
RMI
Security
Troubleshooting
Web services
JavaFX tools
Java runtime environment
Source code
Libraries
C header files
Database
JDK source code reorganization
Modular runtime images
Adopting a runtime format
Runtime image restructure
Supporting common operations
Deprivileging JDK classes
Preserving existing behaviors
Module system
Module paths
Access-control boundary violations
Runtime
Modular Java application packaging
An advanced look at the Java Linker
Java Packager options
The Java Linker
Encapsulating most internal APIs
Summary
Questions
Further reading
Migrating Applications to Java 11
Technical requirements
A quick review of Project Jigsaw
Classpath
The monolithic nature of the JDK
How modules fit into the Java landscape
Base module
Reliable configuration
Strong encapsulation
Migration planning
Testing a simple Java application
Potential migration issues
The JRE
Accessing internal APIs
Accessing internal JARs
JAR URL depreciation
Extension mechanism
The JDK's modularization
Advice from Oracle
Preparatory steps
Getting the JDK early access build
Running your program before recompiling
Updating third-party libraries and tools
Compiling your application
Pre-Java 9 -source and -target options
Java 10 and 11 -source and -target options
Running jdeps on your code
Breaking encapsulation
The --add-opens option
The --add-exports option
The --permit-illegal-access option
Runtime image changes
Java version schema
JDK and JRE's layout
What has been removed?
Updated garbage collection
Deploying your applications
Selecting your JRE version
Serialized applets
JNLP update
Nested resources
FX XML extension
JNLP file syntax
Numeric version comparison
Useful tools
Java Environment -jEnv
Maven
Obtaining the M2Eclipse IDE
Summary
Questions
Further reading
Experimenting with the Java Shell
Technical requirements
Understanding JShell
Getting started with JShell
Practical uses of JShell
Feedback modes
Creating a custom feedback mode
Listing your assets
Editing in JShell
Modifying text
Basic navigation
Historical navigation
Advanced editing commands
Working with scripts
Startup scripts
Loading scripts
Saving scripts
Advanced scripting with JShell
Summary
Questions
Further reading
Leveraging the Default G1 Garbage Collector
Technical requirements
Overview of garbage collection
Object life cycle
Object creation
Object mid-life
Object destruction
Garbage collection algorithms
Mark and sweep
Concurrent Mark Sweep (CMS) garbage collection
Serial garbage collection
Parallel garbage collection
G1 garbage collection
Garbage collection options
Java methods relevant to garbage collection
The System.gc() method
The finalize() method
The pre-Java 9 garbage collection schema
Visualizing garbage collection
Garbage collection upgrades in Java 8
Case study – games written with Java
Collecting garbage with the new Java platform
Default garbage collection
Depreciated garbage collection combinations
Unified garbage collection logging
Unified JVM logging
Tags
Levels
Decorations
Output
Command-line options
Unified GC logging
Garbage collection logging options
The gc tag
Macros
Additional considerations
Garbage collection interface
Parallel full garbage collection for G1
Epsilon – an arbitrarily low-overhead GC
Persistent issues
Making objects eligible for garbage collection
Summary
Questions
Further reading
Microbenchmarking Applications with JMH
Technical requirements
Microbenchmarking overview
Approach to using JMH
Installing Java and Eclipse
Hands-on experiment
Microbenchmarking with Maven
Benchmarking options
Modes
Time units
Techniques for avoiding microbenchmarking pitfalls
Power management
OS schedulers
Timesharing
Eliminating dead-code and constant folding
Run-to-run variance
Cache capacity
Summary
Questions
Further reading
Making Use of the Process API
Technical requirements
Introducing processes
Working with the ProcessHandle interface
Getting the PID of the current process
Getting information about processes
Listing processes
Listing children
Listing descendants
Listing all processes
Waiting for processes
Terminating processes
Reviewing a sample process controller app
Main class
Parameters class
ParamsAndHandle
ControlDaemon
Summary
Questions
Further reading
Fine-Grained Stack Tracing
Technical requirements
Overview of the Java Stack
The importance of stack information
Example – restricting callers
Example – getting loggers for callers
Working with StackWalker
Getting an instance of StackWalker
Enum options
RETAIN_CLASS_REFERNCE
SHOW_REFLECT_FRAMES
SHOW_HIDDEN_FRAMES
Final thoughts on enum constants
Accessing classes
Walking methods
StackFrame
Performance
Summary
Questions
New Tools and Tool Enhancements
Technical requirements
Working with the HTTP client
The pre-Java 9 HTTP client
The Java 11 HTTP client
Limitations of the HTTP client API
Understanding Javadoc and the Doclet API
The pre-Java 9 Doclet API
API enums
API classes
API interfaces
Problems with the pre-existing Doclet API
Java 9's Doclet API
Compiler tree API
Language model API
The AnnotatedConstruct interface
The SourceVersion enum
The UnknownEntityException exception
Using the HTML5 Javadoc
Javadoc search
Introducing Camel Case search
Changes to the Multiple JRE feature
JavaScript Parser
Nashorn
Using Nashorn as a command-line tool
Using Nashorn as an embedded interpreter
ECMAScript
Parser API
Multiple-release JAR files
Identifying multi-release JAR files
Related JDK changes
Java-level JVM Compiler Interface
BeanInfo annotations
JavaBean
BeanProperty
SwingContainer
BeanInfo classes
TIFF support
Platform logging
The java.util.logging package
Logging in the modern Java platform
XML Catalogs
The OASIS XML Catalog standard
JAXP processors
Earlier XML Catalogs
Current XML Catalogs
Collections
Using collections prior to the modern Java platform
Using new collection literals
Platform-specific desktop features
Enhanced method handling
The reason for the enhancement
Lookup functions
Argument handling
Additional combinations
Enhanced depreciation
What the @Deprecated annotation really means
The native header generation tool (javah)
Summary
Questions
Further reading
Concurrency Enhancements
Technical requirements
Reactive programming
Reactive programming standardization
The Flow API
The Flow.Publisher interface
The Flow.Subscriber interface
The Flow.Subscription interface
The Flow.Processor interface
Sample implementation
Additional concurrency updates
Java concurrency
Concurrency explained
System configurations
Java threads
Concurrency improvements
CompletableFuture API enhancements
Class details
Enhancements
Spin-wait hints
Summary
Questions
Further reading
Security Enhancements
Technical requirements
Datagram Transport Layer Security
DTLS protocol version 1.0
DTLS protocol version 1.2
DTLS support in Java
Creating PKCS12 keystores
Keystore primer
Java Keystore (JKS)
Understanding the KeyStore.Builder
The CallbackHandlerProtection class
The PasswordProtection class
The PrivateKeyEntry class
The SecretKeyEntry class
The TrustedCertificateEntry class
PKCS12 default in Java 9 10 and 11
Improving security application performance
Security policy enforcement
Permission evaluation
The java.Security.CodeSource package
Package checking algorithm
The TLS application-layer protocol negotiation extension
TLS ALPN extension
The javax.net.ssl package
The java.net.ssl package extension
Leveraging CPU instructions for GHASH and RSA
Hashing
OCSP stapling for TLS
OCSP stapling primer
Recent changes to the Java platform
DRBG-based SecureRandom implementations
Summary
Questions
Further reading
Command-Line Flags
Technical requirements
Unified JVM logging
Command-line options
Decorations
Levels
Working with Xlog output
Tags
Compiler control
Compilation modes
The C1 compilation mode
The C2 compilation mode
Tiered compilation
Compiler control in Java 11
Diagnostic commands
The heap profiling agent
Removing your JHAT
Command-line flag argument validation
Compiling for older platform versions
The experimental Java-based JIT compiler
Summary
Questions
Further reading
Additional Enhancements to the Java Platform
Technical requirements
Support for UTF-8
The ResourceBundle class
The nested class
Fields and constructors
Methods
Changes in the modern Java platform
Unicode support
The java.lang package
The java.text package
Additional significance
Linux/AArch64 port
Multiresolution images
Common Locale Data Repository
Summary
Questions
Future Directions
Technical requirements
An overview of the JDK Enhancement Proposal
JEP Candidates
JEP 326: Raw String Literals
JEP 334: JVM Constants API
JEP 337: RDMA Network Sockets
JEP 338: Vector API
JEP 339: Edwards-Curve Digital Signature Algorithm
JEP Submitted
JEP Drafted
Ongoing special projects
Annotations Pipeline 2.0
Audio Synthesis Engine
Caciocavallo
Common VM Interface
Compiler Grammar
Device I/O
Graal
HarfBuzz integration
Kona
OpenJFX
Panama
Shenandoah
Summary
Questions
Contributing to the Java Platform
Technical requirements
The Java Community
Participating in a Java User Group
Java Community Process
Oracle Technology Network
Writing technical articles
Summary
Questions
Assessment
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Chapter 17
Other Books You May Enjoy
Leave a review - let other readers know what you think
更新时间:2021-08-13 15:44:44