Reactive Streams In Java 9

Reactive programming is becoming ubiquitous when it comes to building any real-time system in recent times. Software designs are shifting from the conventional servers and containers to be event-driven, responsive, scalable and handle failures gracefully. The problem with the traditional approach of creating multithreaded, synchronized and shared applications was that the end products were tightly … Read more

Variable Handle In Java 9

Variable Handle In Java 9

What Is A Variable Handle? A Variable Handle or VarHandle is nothing but a typed reference to a variable created in order to provide read and write access to the variable under different access modes. The variables can be array elements, instance or static fields in a class. VarHandle objects cannot be modified once they … Read more

Multi-Release JARs in Java 9

While developing Java-based solutions, one would have to often include third party libraries to code better. These third-party libraries usually release different releases according to the support matrix they have. This would result in having different library versions targeted for different Java versions. As a result, it would be difficult to ensure that everything works … Read more

Convenience Factory Methods For Collections In Java 9

In order to create an immutable collection before Java 9, a Java developer had to write code which involves creating a collection, adding elements to it and passing the collection to Collections.unmodifablexxx() method where xxx can be any collection like a set or a list. As a result, the program becomes too verbose. A Java … Read more

Stack-Walking API – Java 9

A stack trace is a list of method calls arranged in such a way that the method at which an exception was thrown will be at the top followed by the caller to that method and so on till the main method of the program. We can print a stack trace to the console by … Read more

Multi-Resolution Images API – Java 9

Java 9 introduced a new interface called MultiResolutionImage (JEP 251) to encapsulate a set of images with different resolutions into a single multi-resolution image. The APIs related to multi-resolution images are available under java.awt.image package and helps us to programmatically: Get all variants of a particular image. Get an image specific to the resolution required based … Read more

Process API enhancements in Java 9

The java.lang.Process class provides methods to get input or output from a process, wait for process to complete, check exit status or kill the process. From Java 7 onwards, the process streams could be redirected to files. In Java 9, certain enhancements(JEP 102) were done to the Process API and a new interface called ProcessHandle … Read more

Tiered Attribution for javac – Java 9

In Java 8, the implementation of type-checking at compiler level was based on Speculative Attribution. In Speculative Attribution, the same tree can be type-checked against multiple targets at runtime. This is particularly used in target typing for lambda expressions, resolving diamond expressions for generics, etc. To understand more about target typing in lambda expressions, we … Read more

HTTP/2 Client In Java 9

HTTP/1.1 is one of the most successful protocols widely used on the web today. For the past 15 years, HTTP/1.1 had been beneficial for growth of the internet but there were subtle problems with the protocol which have started to show up of late. For example, a web application which is resource intensive has a … Read more