05 Nov 2024

feedDZone Java Zone

Jakarta WebSocket Essentials: A Guide to Full-Duplex Communication in Java

Have you ever wondered what happens when you send a message to friends or family over the Internet? It's not just magic - there's a fascinating technology at work behind the scenes called WebSocket. This powerful protocol enables real-time communication, allowing messages to flow seamlessly between users.

Join us as we dive deeper into the world of WebSocket! We'll explore how this technology operates and even create a simple application together to see it in action. Get ready to unlock the potential of real-time communication!

05 Nov 2024 10:00pm GMT

How to Read JSON Files in Java Using the Google Gson Library

JSON files are commonly used these days for sending data to applications. Be it a web application, an API, or a mobile application, JSON is used by almost every team as it is lightweight and self-describing.

Due to its high popularity and wide usage, it is important to understand and know what JSON is, its features, its different data types, file formats, etc. In this blog, we will be learning about JSON, its features, data types, and file formats. We will then continue to learn to read JSON files in Java using the Google Gson library.

05 Nov 2024 4:00pm GMT

Effective Methods to Diagnose and Troubleshoot CPU Spikes in Java Applications

CPU spikes are one of the most common performance challenges faced by Java applications. While traditional APM (Application Performance Management) tools provide high-level insights into overall CPU usage, they often fall short of identifying the root cause of the spike. APM tools usually can't pinpoint the exact code paths causing the issue. This is where non-intrusive, thread-level analysis proves to be much more effective. In this post, I'll share a few practical methods to help you diagnose and resolve CPU spikes without making changes in your production environment.

Intrusive vs Non-Intrusive Approach: What Is the Difference?

Intrusive Approach

Intrusive approaches involve making changes to the application's code or configuration, such as enabling detailed profiling, adding extra logging, or attaching performance monitoring agents. These methods can provide in-depth data, but they come with the risk of affecting the application's performance and may not be suitable for production environments due to the added overhead.

05 Nov 2024 2:00pm GMT

04 Nov 2024

feedDZone Java Zone

High-Performance Reactive REST API and Reactive DB Connection Using Java Spring Boot WebFlux R2DBC Example

Reactive Programming

Reactive programming is a programming paradigm that manages asynchronous data streams and automatically propagates changes, enabling systems to react to events in real time. It's useful for creating responsive APIs and event-driven applications, often applied in UI updates, data streams, and real-time systems.

WebFlux

WebFlux is designed for applications with high concurrency needs. It leverages Project Reactor and Reactive Streams, enabling it to handle a large number of requests concurrently with minimal resource usage.

04 Nov 2024 12:00pm GMT

31 Oct 2024

feedDZone Java Zone

Faster Startup With Spring Boot 3.2 and CRaC, Part 2

This is the second part of the blog series "Faster Startup With Spring Boot 3.2 and CRaC," where we will learn how to warm up a Spring Boot application before the checkpoint is taken and how to provide configuration at runtime when the application is restarted from the checkpoint.

Overview

In the previous blog post, we learned how to use CRaC to start Spring Boot applications ten times faster using automatic checkpoints provided by Spring Boot 3.2. It, however, came with two significant drawbacks:

31 Oct 2024 12:00pm GMT

30 Oct 2024

feedDZone Java Zone

Java Is Greener on Arm

Even those not particularly interested in computer technology have heard of microprocessor architectures. This is especially true with the recent news that Qualcomm is rumored to be examining the possibility of acquiring various parts of Intel and Uber is partnering with Ampere Computing.

Hardware and software are evolving in parallel, and combining the best of modern software development with the latest Arm hardware can yield impressive performance, cost, and efficiency results.

30 Oct 2024 9:00pm GMT

How to Get Plain Text From Common Documents in Java

In this article, we'll learn how to extract plain text strings from a few of the most common file types (PDF, DOCX, XSLX, PPTX) we can expect to deal with on a day-to-day basis as programmers in an enterprise environment.

We'll briefly review when to use plain text extraction methods over Optical Character Recognition (OCR) text extraction methods, and we'll discuss some use cases for retrieving plain text in a real-world scenario. Ultimately, we'll cover a few open-source APIs that are perfect for handling plain text extraction on a one-off basis, at the end we'll demonstrate a proprietary API that saves time by automatically detecting each different file type before extracting plain text content.

30 Oct 2024 7:00pm GMT

Hot Class Reload in Java: A Webpack HMR-Like Experience for Java Developers

In the world of software development, time is everything. Every developer knows the frustration of waiting for a full application restart just to see a small change take effect. Java developers, in particular, have long dealt with this issue. But what if you didn't have to stop and restart every time you updated a class? Enter Hot Class Reload (HCR) in Java - a technique that can keep you in the flow, reloading classes on the fly, much like Hot Module Reload (HMR) does in JavaScript.

In this guide, we'll walk through how to implement HCR and integrate it into your Java development workflow. By the end, you'll have a powerful new tool to reduce those long, unproductive restart times.

30 Oct 2024 2:00pm GMT

29 Oct 2024

feedDZone Java Zone

Enhance User Experience With a Formatted Credit Card Input Field

In this article, I will guide you on how to create a credit card input by extending existing ZK components. Moreover, I'll apply a customized ZK JavaScript widget to format the card numbers in groups of four digits, improving readability and user experience. Additionally, we'll integrate a custom JavaScript widget to ensure that only numeric input is accepted.

This guide is ideal for web developers needing a dedicated input field for credit card information. Using the ZK UI Framework as an example, I'll walk you through creating a well-structured, readable credit card input box.

29 Oct 2024 5:00pm GMT

Top Takeaways From Devoxx Belgium 2024

In October 2024, I visited Devoxx Belgium and again it was an awesome event! I learned a lot and received quite some information which I do not want to withhold from you. In this blog, you can find my takeaways from Devoxx Belgium 2024!

Introduction

Devoxx Belgium is the largest Java conference in Europe. This year, it was already the 21st edition. As always, Devoxx is being held in the fantastic theatres of Kinepolis Antwerp. Each year, there is a rush on the tickets. Tickets are released in several batches, so if you did not have a ticket during the first batch, you will get another chance.

29 Oct 2024 2:00pm GMT

28 Oct 2024

feedDZone Java Zone

Filtering Java Collections via Annotation-Driven Introspection

Since Java 8, the programming workload of iterating over collections and selecting a subcollection (filtering) based on defined constraints (predicates) has been considerably simplified using the new Stream API. Despite this new feature, some scenarios can still overwhelm developers by requiring them to implement a significant amount of very specific code to meet the filtering conditions. A common example in enterprise systems is the need to filter:

". . . a collection where each object is an element of a large graph and the attributes to be considered in the filters belong to distinct objects."

28 Oct 2024 9:00pm GMT

24 Oct 2024

feedDZone Java Zone

Summary of the AJAX Frameworks Comparison

In previous weeks, I've analyzed several libraries and frameworks that augment the client with AJAX capabilities.

In this post, I'll compare them across several axes.

24 Oct 2024 6:00pm GMT

High-Speed Real-Time Streaming Data Processing

From data ingestion to reporting, the primary goal is to convert data into actionable information. Online data is growing at a much faster rate than data processing speeds. For businesses to stay competitive, data must be readily available for making informed decisions as early as possible. Live data streaming software is becoming a vital part of data infrastructures to get data to processing systems as early as possible. While different streaming software are available, it is crucial to understand the domain context and available infrastructure.

Each business use case is unique and should be treated with white-glove treatment. The critical thing to remember is that cheap, fast, and good will never make a feasible combination. The affordable solution may be quick but not good; a fast solution may be good but not cheap, and so on. An ideal example of this concept would be real-time streaming data processing.

24 Oct 2024 4:00pm GMT

22 Oct 2024

feedDZone Java Zone

Implement Hibernate Second-Level Cache With NCache

In this tutorial, we'll explore implementing a second-level cache in Hibernate using NCache.

We'll set up a Java application with Hibernate. Then we'll configure NCache as the second-level cache. Finally, we'll test the implementation to see how caching reduces the database load and improves performance.

22 Oct 2024 7:00pm GMT

21 Oct 2024

feedDZone Java Zone

How to Implement Client-Side Load Balancing With Spring Cloud

It is common for microservice systems to run more than one instance of each service. This is needed to enforce resiliency. It is therefore important to distribute the load between those instances. The component that does this is the load balancer. Spring provides a Spring Cloud Load Balancer library. In this article, you will learn how to use it to implement client-side load balancing in a Spring Boot project.

Client and Server Side Load Balancing

We talk about client-side load balancing when one microservice calls another service deployed with multiple instances and distributes the load on those instances without relying on external servers to do the job. Conversely, in the server-side mode, the balancing feature is delegated to a separate server, that dispatches the incoming requests. In this article, we will discuss an example based on the client-side scenario.

21 Oct 2024 6:00pm GMT

Dust: Open-Source Actors for Java

Virtual Threads

Java 21 saw the supported introduction of virtual threads. Unlike regular Java threads (which usually correspond to OS threads), virtual threads are incredibly lightweight, indeed an application can create and use 100,000 or more virtual threads simultaneously.

This magic is achieved by two major changes to the JVM:

21 Oct 2024 12:00pm GMT