Today, I was looking at JDK 8
Collections.max function declaration and noticed a weird
& in the type declaration. Most normal Java developers will not remember exact function declaration so I am writing it below.
public static <T extends Object & Comparable<? super T>> T max(Collection<? extends T> coll)
Recently, I read an article on Markov chains. In the post, author showed how we can build autocomplete functionality using them. The article piqued my interest to learn more about Markov chain and I started looking for an example application that I can build using it. I decided to build a web application that will suggest me what Indian prime minister Narendra Modi will say after a word/pair of words/triplet for words.
I am not a supporter of Narendra Modi style of leadership. The reason I chose him is because I could easily find text of all his speeches on the web .
This post is divided into three sections:
- What is Markov chain?
- Create dataset for the application
- Build the application that uses Markov chain
Few months back I had to do performance optimisation of a low latency application. The tool that helped me a lot was Java Flight Recorder. Today, I had to do some similar work and I completely forgot how I was able to launch flight recorder GUI. In this short post, I will show you the process that I followed to create flight recorder recordings.
From the official documentation,
Java Flight Recorder (JFR) is a tool for collecting diagnostic and profiling data about a running Java application. It is integrated into the Java Virtual Machine (JVM) and causes almost no performance overhead, so it can be used even in heavily loaded production environments. When default settings are used, both internal testing and customer feedback indicate that performance impact is less than one percent. For some applications, it can be significantly lower. However, for short-running applications (which are not the kind of applications running in production environments), relative startup and warmup times can be larger, which might impact the performance by more than one percent. JFR collects data about the JVM as well as the Java application running on it.
Over the last few years I have started using Gradle as my primary build tool for JVM based projects. Before using Gradle I was an Apache Maven user. Gradle takes best from both Apache Maven and Apache Ant providing you best of both worlds. Gradle borrows flexibility from Ant and convention over configuration, dependency management and plugins from Maven. Gradle treats task as first class citizen just like Ant.
A Gradle build has three distinct phases – initialization, configuration, and execution. The initialization phase determine which all projects will take part in the build process and create a Project instance for each of the project. During configuration phase, it execute build scripts of all the project that are taking part in build process. Finally, during the execution phase all the tasks configured during the configuration phase are executed.
In this post, I will list down tips that I have learnt over last few years.
This week I decided to play with Apache Dubbo. I follow Github trending repositories daily and for many weeks and months Apache Dubbo is one of their popular Github Java repository. It has more than 20,000 stars. So, I decided to give it a shot. One of the reasons for Dubbo popularity is that it is created by software engineers at Alibaba. Alibaba is a Chinese multinational conglomerate specializing in e-commerce, retail, Internet, AI and technology.
From its website, Apache Dubbo is
A high-performance, light weight, java based RPC framework. Dubbo offers three key functionalities:
- Interface based remote call
Fault tolerance and load balancing
Automatic service registration & discovery
Recently, I discovered a new framework in Java land called Micronaut. Being a Java developer for last fourteen years, I have seen many Java frameworks come and go. Apart from Spring, there are very few frameworks that made a mark. After a long time, I discovered a framework that is challenging the status quo of web development in Java.
Micronaut is an open-source modern JVM framework for building modular, easily testable microservice and serverless applications. It is a truly polyglot framework. You can build applications in Java, Kotlin, and Groovy.
In November 2018, James Gosling (who now works at Amazon), father of Java released Corretto at Devoxx Belgium conference. Amazon Corretto is no-cost, multi platform, production ready distribution of OpenJDK. This comes at a time when Oracle announced that it will no longer provide free binary downloads of JDK after a six-month period; and neither it will patch OpenJDK with fixes after that period. The six-month is the new release cycle for new JDK versions. If you follow Java, then you might be aware that Java has moved to six month release cycle. The latest version of JDK is 12.