Needing to communicate with a remote service? Let's take a look at some features and APIs in Java that help with communicating with remote services!
1/
The HTTP Client added in #JDK11 improves and replaces the HttpUrlConnection, by supporting standards likes HTTP/2 and WebSocket and allowing requests to be sent synchronously and asynchronously
Unix-Domain Socket Channels added in #JDK16 allow for fast and secure communication between Java applications when they are located on the same host. And despite their name, even work on windows!
Serialization is an issue that has long plagued Java and is of particular concern when communicating with remote services. You can help protect your application by configuring serialization filters added in #JDK9
Records added in #JDK16 address many of the issues related to serialization in Java. Deserializing messages into Records from a remote service can be another option.
Improving performance or reducing memory footprint is important to reducing the cost of running Java applications, especially when using public cloud platforms. Here are some ways to accomplish this!
1/7
Often the best choice would be to upgrade to the latest JDK version, which provides significant runtime benefits.
Needing to automate a task? Consider writing it in Java! Recent changes, and some long-existing APIs, have made Java a practical choice for writing small utility apps. Let's take a look!
1/7
Added in JDK 11, the java launcher can now directly launch single-file source-code applications. Making it easier to develop and launch small utility apps.
Local-variable type inference (var) was added in JDK 10. var can make it easier when working with complex types (i.e. when generics are involved) and easier to define variables in applications.
Records πΏ are one of the most exciting changes that have come to Java since Lambdas and Streams in Java 8. Let's review some of the key benefits and library integrations for Records.
1/6
Sometimes during data transform a data type is only needed with context of a single method. Local Records allow a data type to be defined as a single line within a method.
2/6
Serialization is one of the scariest areas in Java, with a lot of easy to overlook traps that could leave your application vulnerable. Records address a lot of common serialization vulnerabilities.
String is one of the most often utilized JDK classes by Java developers. Let's take a look at how String has been improved in recent Java releases, as well as some over looked features from older releases.
1/7
Text Blocks were added in Java 15, and introduce the concept of a 2-dimensional String. Text Blocks greatly improve the experience of working with markup languages like; XML, JSON, HTML, as Strings.
2/7
The String classes has seen a lot of work done to it since JDK 8, with many new helper methods being added. Check out this Sip of Java were I cover some of the key new additions.