I was trying to maintain an old React app built using Webpack 1.13. When starting the app, I couldn’t add breakpoints in Chrome’s developer tools. It turned out it’s a Webpack issue with latest version of Chrome, see this GitHub issue.
When using a thread to run a task, it’s common to have the task wait for certain condition before it can continue. This is usually done by using busy-waiting with a
volatile variable as the flag. This flag is set by another thread to stop the waiting. Before Java 9, we use an empty loop to wait for the condition. The new static method
onSpinWait() of class
Thread in Java 9 can make the waiting more efficient.
Java 9 is about to release soon. Frameworks and tools continue to add support for this new Java 9 release. Spring framework has already provides support for Java 9. In this post, we are going to run Spring projects using Java 9 and Docker.
Java 9 is scheduled to release on September 21. If you want to try Java 9 early-access builds now, you can download them from jdk.java.net and install them locally. However, installing the Java 9 builds makes them the default JDK in your machine, which may affect other applications that depend on the JDK. A better choice is to use Docker. If you don’t have Docker installed, download and install it from docker.com.
The Docker image we are going to use is the official Apache Maven image which supports Java 9. We use the tag
3.5.0-jdk-9 to get the Maven 3.5.0 with JDK 9.
I just want to share some private NodeJS modules for reuse in my other projects. A simple private registry is a good choice. sinopia is what I used.
The installation is very easy.
Now I’m going to add Disqus comments to my AMP site. Disqus already supports this and has an official guide about it. The whole process is smooth with only few exceptions.
Jackson is a popular library to handle JSON in Java. It has built-in serializers and deserializers to handle common data types. If you want to serialize and deserialize custom types, you can add custom serializers and deserializers. The code in this post is tested using Jackson 2.7.2 and should work with Jackson after 1.7.
The class we want to serialize and deserialize is
com.github.zafarkhaja.semver.Version from the jsemver library. We want objects of this class to be serialized as simple strings, e.g.
When talking about the new Java 9 release, many people focus on the Java Platform Module System (JPMS). There are many small changes that can make developer’s life easier in Java 9.