Mastering Java 11 - Develop Modular and Secure Java Applications Using Concurrency and Advanced JDK Libraries

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Key Features: - Explore the latest features in Java 9, Java 10, and Java 11 - Enhance your Java application development and migration approaches - Full coverage of modular Java applications, G1 Garbage Collector, JMH ----- Book Description: Java 11 is a long-term release and its new features add to the richness of the language. It emphasizes variable-type inference, performance improvements, along with simplified multithreading. The Java platform has a special emphasis on modularity, making this the programming platform of choice for millions of developers. The modern Java platform can be used to build robust software applications, including enterprise-level and mobile applications. Fully updated for Java 11, this book stands to help any Java developer enjoy the richness of the Java programming language. Mastering Java 11 is your one-stop guide to fully understanding recent Java platform updates. It contains detailed explanations of the recent features introduced in Java 9, Java 10, and Java 11 along with obtaining practical guidance on how to apply the new features. As you make your way through the chapters, you'll discover further information on the developments of the Java platform and learn about the changes introduced by the variable handles and Project Coin, along with several enhancements in relation to import statements processing. In the concluding chapters, you'll learn to improve your development productivity, making your applications more efficient. You'll also be able to get to grips with the command-line flags with respect to various utilities and the command-line utility changes featured in the current Java platform. By the end of the book, you'll have obtained an advanced level understanding of the Java platform and its recent changes. -------- What you will learn: * Write modular Java applications * Migrate existing Java applications to modular ones * Understand how the default G1 garbage collector works * Leverage the possibilities provided by the newly introduced Java Shell * Performance test your application effectively with the JVM harness * Learn how Java supports the HTTP 2.0 standard * Find out how to use the new Process API * Explore the additional enhancements and features of Java 9, 10, and 11 -------- Who this book is for: Mastering Java 11 is for experienced Java developers with a solid understanding of the Java language and want to progress to an advanced level. ---------- About the Author: Dr. Edward Lavieri is a veteran developer with a strong academic background. He has earned a doctorate in computer science from Colorado Technical University, an MS in management information systems (Bowie State University), an MS in education (Capella University), and an MS in operations management (University of Arkansas). He has been creating and teaching computer science courses since 2002. Edward retired from the US Navy as a Command Master Chief after 25 years of active service. As the founder and creative director of three19, a software design and development studio. Edward is constantly designing and developing software.

Author(s): Edward Lavieri
Edition: 2nd
Publisher: Packt
Year: 2018

Language: English
Commentary: true pdf
Pages: 451
Tags: Java

Cover......Page 1
Title Page......Page 2
Copyright and Credits......Page 3
Dedication......Page 4
Packt Upsell......Page 5
Contributors......Page 6
Table of Contents......Page 8
Preface......Page 21
Technical requirements......Page 27
Time-based releases......Page 28
Understanding the significance of Java 9......Page 29
Breaking the monolith......Page 30
Taking control of external processes......Page 31
Measuring performance with JMH......Page 32
Benefiting from changes introduced with Java 10......Page 33
Garbage collection interface......Page 34
Heap allocation on alternative memory devices......Page 35
Dynamic class-file constants......Page 36
Summary......Page 37
Further reading......Page 38
Chapter 2: Discovering Java 11......Page 39
Technical requirements......Page 40
Improved contended locking......Page 41
Segmented code cache......Page 42
Smart Java compilation......Page 43
Resolving lint and doclint warnings ......Page 44
Tiered attribution for Javac ......Page 45
Annotations pipeline 2.0 ......Page 46
New version-string scheme ......Page 47
Generating runtime compiler tests automatically ......Page 48
Testing class-file attributes generated by Javac ......Page 49
Storing interned strings in class-data sharing archives ......Page 50
The Java 10 improvement......Page 51
Using the AppCDS archive......Page 52
JavaFX overview......Page 53
Implications for Java 9, 10, and 11......Page 54
Merging selected Xerces 2.11.0 updates into JAXP ......Page 56
Updating JavaFX/Media to the newer version of GStreamer ......Page 57
HiDPI graphics on Windows and Linux......Page 58
Marlin graphics renderer ......Page 59
Updated classes in Java 9......Page 60
The pre-Java 9 situation......Page 61
New in Java 9......Page 62
Additional tests for humongous objects in G1 ......Page 63
Java process information......Page 65
HotSpot C++ unit-test framework ......Page 66
Enabling GTK3 on Linux ......Page 67
New HotSpot build system ......Page 68
Summary......Page 69
Further reading......Page 70
Chapter 3: Java 11 Fundamentals......Page 71
Working with variable handlers......Page 72
Working with the AtoMiC ToolKit......Page 74
Using the sun.misc.Unsafe class......Page 75
Import statement depreciation warnings......Page 76
Using the @SafeVarargs annotation......Page 77
The try-with-resource statement......Page 78
Using the diamond operator......Page 79
Discontinuing use of the underscore......Page 80
Making use of private interface methods......Page 81
Import statement processing......Page 83
Inferring local variables ......Page 84
Local variable syntax for Lambda parameters......Page 85
Root certificates......Page 86
Dynamic class-file constants......Page 87
Summary......Page 88
Further reading......Page 89
Chapter 4: Building Modular Applications with Java 11......Page 90
A modular primer......Page 91
The modular JDK......Page 93
Modular source code......Page 96
JDK source code organization before modularization......Page 97
Internationalization......Page 98
Troubleshooting......Page 99
Source code......Page 100
Libraries......Page 101
C header files......Page 102
Modular runtime images......Page 103
Runtime image restructure......Page 104
Module system......Page 106
Module paths......Page 107
Runtime......Page 108
Modular Java application packaging......Page 110
Java Packager options......Page 111
The Java Linker......Page 115
Summary......Page 117
Further reading......Page 118
Chapter 5: Migrating Applications to Java 11......Page 119
A quick review of Project Jigsaw......Page 120
The monolithic nature of the JDK......Page 121
How modules fit into the Java landscape......Page 122
Base module......Page 123
Reliable configuration......Page 125
Strong encapsulation......Page 126
Testing a simple Java application......Page 127
The JRE......Page 130
Accessing internal APIs......Page 131
JAR URL depreciation......Page 132
Extension mechanism......Page 133
The JDK's modularization......Page 134
Advice from Oracle......Page 135
Running your program before recompiling......Page 136
Compiling your application......Page 137
Pre-Java 9 -source and -target options......Page 139
Running jdeps on your code......Page 140
The --add-exports option......Page 144
Java version schema......Page 145
JDK and JRE's layout......Page 146
What has been removed?......Page 149
Updated garbage collection......Page 150
Serialized applets......Page 151
FX XML extension......Page 152
JNLP file syntax......Page 154
Java Environment -jEnv......Page 155
Maven......Page 157
Obtaining the M2Eclipse IDE......Page 158
Further reading......Page 161
Technical requirements......Page 162
Understanding JShell......Page 163
Getting started with JShell......Page 164
Practical uses of JShell......Page 170
Feedback modes......Page 171
Creating a custom feedback mode......Page 175
Listing your assets......Page 177
Modifying text......Page 178
Working with scripts......Page 179
Loading scripts......Page 180
Advanced scripting with JShell......Page 181
Questions......Page 183
Further reading......Page 184
Chapter 7: Leveraging the Default G1 Garbage Collector......Page 185
Object life cycle......Page 186
Object mid-life......Page 187
Mark and sweep......Page 188
Serial garbage collection......Page 189
Garbage collection options......Page 190
The System.gc() method......Page 194
The finalize() method......Page 195
The pre-Java 9 garbage collection schema......Page 197
Visualizing garbage collection......Page 198
Case study – games written with Java......Page 199
Collecting garbage with the new Java platform......Page 200
Default garbage collection ......Page 201
Depreciated garbage collection combinations......Page 202
Tags......Page 204
Decorations......Page 205
Unified GC logging......Page 206
Garbage collection logging options......Page 207
Macros......Page 208
Garbage collection interface......Page 209
Persistent issues......Page 210
Making objects eligible for garbage collection......Page 211
Summary......Page 213
Further reading......Page 214
Technical requirements......Page 215
Microbenchmarking overview......Page 216
Installing Java and Eclipse ......Page 217
Hands-on experiment......Page 218
Microbenchmarking with Maven......Page 220
Benchmarking options......Page 227
Time units......Page 228
OS schedulers......Page 229
Eliminating dead-code and constant folding......Page 230
Cache capacity......Page 231
Further reading......Page 232
Chapter 9: Making Use of the Process API......Page 233
Introducing processes......Page 234
Working with the ProcessHandle interface......Page 235
Getting information about processes......Page 236
Listing processes......Page 238
Listing descendants......Page 239
Listing all processes......Page 241
Terminating processes......Page 242
Main class......Page 245
Parameters class......Page 246
ParamsAndHandle......Page 247
ControlDaemon......Page 248
Questions......Page 251
Further reading......Page 252
Chapter 10: Fine-Grained Stack Tracing......Page 253
Overview of the Java Stack......Page 254
The importance of stack information......Page 255
Example – restricting callers......Page 256
Example – getting loggers for callers......Page 259
Getting an instance of StackWalker......Page 260
SHOW_HIDDEN_FRAMES......Page 261
Walking methods......Page 265
StackFrame......Page 267
Performance......Page 268
Questions......Page 269
Chapter 11: New Tools and Tool Enhancements......Page 270
The pre-Java 9 HTTP client......Page 271
The Java 11 HTTP client......Page 273
Limitations of the HTTP client API......Page 274
The pre-Java 9 Doclet API......Page 276
API interfaces......Page 278
Compiler tree API......Page 279
Language model API......Page 282
The SourceVersion enum......Page 283
The UnknownEntityException exception......Page 285
Using the HTML5 Javadoc......Page 286
Javadoc search......Page 291
Changes to the Multiple JRE feature......Page 292
Nashorn......Page 293
Using Nashorn as a command-line tool......Page 294
Using Nashorn as an embedded interpreter......Page 297
ECMAScript......Page 298
Parser API......Page 299
Multiple-release JAR files......Page 301
Identifying multi-release JAR files......Page 302
Related JDK changes......Page 303
Java-level JVM Compiler Interface......Page 304
JavaBean......Page 305
SwingContainer......Page 306
TIFF support......Page 307
The java.util.logging package......Page 310
Logging in the modern Java platform......Page 312
XML Catalogs......Page 313
Earlier XML Catalogs......Page 314
Collections......Page 315
Using collections prior to the modern Java platform......Page 316
Using new collection literals......Page 318
Platform-specific desktop features......Page 319
The reason for the enhancement......Page 320
Argument handling......Page 321
Additional combinations......Page 322
Enhanced depreciation......Page 323
Summary......Page 324
Further reading......Page 325
Technical requirements......Page 326
Reactive programming......Page 327
Reactive programming standardization......Page 328
The Flow.Subscriber interface......Page 330
The Flow.Processor interface......Page 331
Sample implementation......Page 332
Concurrency explained......Page 333
System configurations......Page 334
Java threads......Page 335
Concurrency improvements......Page 338
CompletableFuture API enhancements......Page 339
Class details......Page 340
Enhancements......Page 344
Spin-wait hints......Page 345
Further reading......Page 346
Technical requirements......Page 347
Datagram Transport Layer Security......Page 348
DTLS protocol version 1.0......Page 349
DTLS protocol version 1.2......Page 350
DTLS support in Java......Page 353
Keystore primer......Page 354
Java Keystore (JKS)......Page 355
The CallbackHandlerProtection class......Page 356
The SecretKeyEntry class......Page 357
The TrustedCertificateEntry class......Page 358
Improving security application performance......Page 359
Security policy enforcement......Page 360
The java.Security.CodeSource package......Page 361
Package checking algorithm......Page 362
TLS ALPN extension......Page 363
The javax.net.ssl package......Page 364
The java.net.ssl package extension......Page 365
Hashing......Page 367
OCSP stapling for TLS......Page 369
OCSP stapling primer......Page 370
Recent changes to the Java platform......Page 371
DRBG-based SecureRandom implementations......Page 372
Summary......Page 373
Further reading......Page 374
Technical requirements......Page 375
Unified JVM logging......Page 376
Command-line options......Page 377
Decorations......Page 379
Working with Xlog output......Page 380
Compilation modes......Page 381
Tiered compilation......Page 382
Compiler control in Java 11......Page 383
Diagnostic commands......Page 385
Removing your JHAT......Page 386
Command-line flag argument validation......Page 387
Compiling for older platform versions......Page 389
Questions......Page 391
Further reading......Page 392
Technical requirements......Page 393
The ResourceBundle class......Page 394
The nested class......Page 395
Fields and constructors......Page 399
Methods......Page 400
Unicode support......Page 406
The java.text package......Page 407
Additional significance......Page 408
Linux/AArch64 port......Page 409
Multiresolution images......Page 410
Common Locale Data Repository......Page 411
Questions......Page 412
Technical requirements......Page 413
An overview of the JDK Enhancement Proposal......Page 414
JEP 334: JVM Constants API......Page 415
JEP Submitted......Page 416
JEP Drafted......Page 417
Ongoing special projects......Page 418
Caciocavallo......Page 419
HarfBuzz integration......Page 420
Shenandoah......Page 421
Questions......Page 422
Chapter 17: Contributing to the Java Platform......Page 423
The Java Community......Page 424
Java Community Process......Page 425
Writing technical articles ......Page 426
Questions......Page 427
Chapter 2......Page 428
Chapter 4......Page 429
Chapter 5......Page 430
Chapter 6......Page 431
Chapter 7......Page 432
Chapter 8......Page 433
Chapter 10......Page 434
Chapter 11......Page 435
Chapter 12......Page 436
Chapter 13......Page 437
Chapter 15......Page 438
Chapter 16......Page 439
Chapter 17......Page 440
Other Books You May Enjoy......Page 441
Index......Page 444