Home » Java

Java

Google Cloud Structured Logging for Java Applications

java-interview-questions-answers

 One advice for logging that I have seen when targeting applications to cloud platforms is to simply write to Standard Out and platform takes care of sending it to the appropriate log sinks. This mostly works except when it doesn’t – it especially doesn’t when analyzing failure scenarios. Typically for Java applications this means looking through a stack trace and ...

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 »

Complete Guide To Spring Testing

java-interview-questions-answers

Software testing is a non-negotiable aspect of the software development life cycle. Setting up and moving on with software testing might be a tedious task. You or your team may feel stuck devising a testing strategy or picking up a testing framework. However, the major roadblocks are either related to methodology or framework.This article revolves around how to perform testing of ...

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 »