Home » Java » Core Java

Core Java

Introduction to JVM and JVM languages

Java Virtual Machine (or JVM for short) is a platform-dependent software that allows you to execute programs written in languages like Java. Languages such as Scala and Kotlin utilize JVM for execution and are also often referred to as JVM languages for this reason. Code written in these languages is often identified via their file extensions such as .java and .scala. Compiling source ...

Read More »

Which JVM Version is Fastest?

How is a high-performance, low-latency Java application affected by the JVM version used? Every nanosecond counts for trading and other applications where messages between two different threads are exchanged in about 250 ns! Read this article and find out which JDK variant comes out at the top! Benchmarks This article will use open-source Chronicle Queue to exchange 256-byte messages between ...

Read More »

Java class loading – performance impact!

java.lang.ClassLoader#loadClass() API is used by 3rd party libraries, JDBC Drivers, frameworks, application servers to load a java class into the memory. Application developers don’t use this API frequently. However when they use the APIs such as ‘java.lang.Class.forName()’ or ‘org.springframework.util.ClassUtils.forName()’, they internally call this ‘java.lang.ClassLoader#loadClass()’ API. Frequent usage of this API amongst different threads at runtime can slow down your application performance. ...

Read More »

Java Hashtable, HashMap, ConcurrentHashMap – Performance impact

There are a good number of articles that articulate functional differences between HashMap, HashTable and ConcurrentHashMap. This post compares the performance behavior of these data structures through practical examples. If you don’t have patience to read the entire post, here is bottom line: When you confront with the decision of whether to use HashMap or HashTable or ConcurrentHashMap, you can ...

Read More »

Functional Decomposition

Why Do I Have To Have A Function? function giveBonus(currentYear, price) { if ((currentYear % 4 === 0) && price > SUPER_THRESHOLD) { return SUPER_BONUS; } return price > BASIC_THRESHOLD ? NORMAL_BONUS : 0; } The above is a small function that gives a bonus. So why should I need more sub-functions? Personally, I’d probably hope to make the above ...

Read More »

Calling Google Cloud Services in Java

If you want to call Google Cloud Services using a Java based codebase, then broadly there are two approaches to incorporating the client libraries in your code — the first, let’s call it a “direct” approach is to use the Google Cloud Client libraries available here, the second approach is to use a “wrapper”, Spring Cloud GCP libraries available here. ...

Read More »

React Version Stamping Recipe

My view on version numbering is that we should take the build time and git SHA of our code and pass it through to the build as a version identifier. Then we can easily look at any stamped version of our application and find where it came from. To me, this is more powerful than stamping an arbitrary release number ...

Read More »

Serverless Spring is Quite Bouncy

I’ve written a couple of articles about AWS Lambda I showed how to use Hibernate in AWS Lambdas over on BaeldungI also showed a full alternative to Spring for an enterprise-grade set upThen I’ve discussed how the size of Log4j can make a Lambda start up more slowlyI’ve even complained about Oracle making a huge Java library for MySQL It’s ...

Read More »

The Chimera Function

I’ve written before about a function that essentially does two different versions of the same thing. It’s sort of cute to think that we can pass a boolean into a function to control whether it uses variant A or variant B of the algorithm. There can be milder forms of this too. Perhaps we pass in a boolean to ask the ...

Read More »