Home » Java » Enterprise Java

Enterprise Java

Add ZipKin to your Spring application

java-interview-questions-answers

If your application contains multiple services interacting with each other the need for distributed tracing is increasing. You have a call towards one application that also calls another application, in certain cases the application to be accessed next might be a different one. You need to trace the request end to end and identify what happened to the call.Zipkin is ...

Read More »

Use Redis GeoHash with Spring boot

java-interview-questions-answers

One very handy Data Structure when it comes to Redis is the GeoHash Data structure. Essentially it is a sorted set that generates a score based on the longitude and latitude. We will spin up a Redis database using Compose services: redis: image: redis ports: - 6379:6379 Can be run like this docker compose up You can find more on ...

Read More »

Use JMH for your Java applications with Gradle

java-interview-questions-answers

If you want to benchmark you code, the Java Microbenchmark Harness is the tool of choice.In our example we shall use the refill-rate-limiter project Since refill-rate-limiter uses Gradle we will use the following plugin for gradle plugins { ... id "me.champeau.gradle.jmh" version "0.5.3" ... } We shall place the Benchmark at the jmh/java/io/github/resilience4j/ratelimiter folder. Our Benchmark should look like this. ...

Read More »

Troubleshooting deadlock in an Apache opensource library

java-interview-questions-answers

Apache PDFBox is a popular open-source library that facilitates java applications to work with PDF documents. Recently we encountered a Deadlock that surfaced in this library. In this post we have shared how we troubleshooted and identified the root cause of the problem. What is Deadlock? First let’s try to understand what ‘Deadlock’ means. Several technical definitions aren’t clear. ‘Deadlock’ ...

Read More »

Skaffold for Local Java App Development

java-interview-questions-answers

Skaffold is a tool which handles the workflow of building, pushing and deploying container images and has the added benefit of facilitating an excellent local dev loop.  In this post I will be exploring using Skaffold for local development of a Java based application Installing Skaffold Installing Skaffold locally is straightforward, and explained well here. It works great with minikube as a local ...

Read More »

Google Cloud Function Gradle Plugin

java-interview-questions-answers

 It is easy to develop a Google Cloud Function using Java with Gradle as the build tool. It is however not so simple to test it locally. The current recommended approach to testing especially with gradle is very complicated. It requires pulling in Invoker libraries and adding a custom task to run the invoker function. I have now authored a ...

Read More »

Google Cloud Functions (2nd Gen) Java Sample

java-interview-questions-answers

Cloud Functions (2nd Gen) is Google’s Serverless Functions as a Service Platform. 2nd Generation is now built on top of the excellent Google Cloud Run as a base. Think of Google Cloud Run as a Serverless environment for running containers which respond to events(http being the most basic, all sorts of other events via eventarc). The blue area above shows ...

Read More »

Logging Performance Comparison

java-interview-questions-answers

In a previous blog post, I explained the pros and cons of using logging. In this post, we’ll explore and compare the performance of different logging solutions that approximate the role of an audit log. To recap, the premise is that in enterprise applications, logging should only be used mainly for the purposes of: Recording unexpected errors & unrecoverable situationsCompletion ...

Read More »

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 »