22 Mar 2024

feedDZone Java Zone

Getting Started With NCache Java Edition (Using Docker)

NCache Java Edition with distributed cache technique is a powerful tool that helps Java applications run faster, handle more users, and be more reliable. In today's world, where people expect apps to work quickly and without any problems, knowing how to use NCache Java Edition is very important. It's a key piece of technology for both developers and businesses who want to make sure their apps can give users fast access to data and a smooth experience. This makes NCache Java Edition an important part of making great apps.

This article is made especially for beginners to make the ideas and steps of adding NCache to your Java applications clear and easy to understand. It doesn't matter if you've been developing for years or if you're new to caching, this article will help you get a good start with NCache Java Edition. Let's start with a step-by-step process to set up a development workstation for NCache with the Java setup.

22 Mar 2024 1:00am GMT

21 Mar 2024

feedDZone Java Zone

How to Query XML Files Using APIs in Java

Despite some notable shortcomings in the contemporary technology landscape, XML is still a powerful language offering key advantages in complex data storage scenarios.

Compared with a popular data interchange format like JSON, for example, XML's syntax places a greater emphasis on machine readability over human readability, making its error-checking process more efficient. Most importantly, XML is great at storing unique data types with multiple variables, whereas JSON is optimized for relatively simple and concise object storage. XML's advantages and disadvantages both stem from the fact that it's not a dedicated data interchange format like JSON at all; rather, it's a complex markup language (more similar to HTML) with powerful data interchange capabilities.

21 Mar 2024 12:00pm GMT

20 Mar 2024

feedDZone Java Zone

Debugging Streams With Peek

I blogged about Java stream debugging in the past, but I skipped an important method that's worthy of a post of its own: peek. This blog post delves into the practicalities of using peek() to debug Java streams, complete with code samples and common pitfalls.
Magnifying glass over code

Understanding Java Streams

Java Streams represent a significant shift in how Java developers work with collections and data processing, introducing a functional approach to handling sequences of elements. Streams facilitate declarative processing of collections, enabling operations such as filter, map, reduce, and more in a fluent style. This not only makes the code more readable but also more concise compared to traditional iterative approaches.

20 Mar 2024 10:00pm GMT

The Data Streaming Landscape 2024

The research company Forrester defines data streaming platforms as a new software category in a new Forrester Wave. Apache Kafka is the de facto standard used by over 100,000 organizations. Plenty of vendors offer Kafka platforms and cloud services. Many complementary open-source stream processing frameworks like Apache Flink and related cloud offerings emerged. Competitive technologies like Pulsar, Redpanda, or WarpStream try to get market share by leveraging the Kafka protocol. This blog post explores the data streaming landscape of 2024 to summarize existing solutions and market trends. The end of the article gives an outlook on potential new entrants in 2025.

Join the data streaming community and stay informed about new blog posts by subscribing to my newsletter.

20 Mar 2024 8:00pm GMT

JUnit, 4, 5, Jupiter, Vintage

After JUnit 5 was released, a lot of developers just added this awesome new library to their projects, because unlike other versions, in this new version, it is not necessary to migrate from JUnit 4 to 5, you just need to include the new library in your project, and with all the engine of JUnit 5 you can do your new tests using JUnit 5, and the older one with JUnit 4 or 3, will keep running without problem.

But what can happen in a big project, a project that was built 10 years ago with two versions of JUnit running in parallel?

20 Mar 2024 1:00am GMT

19 Mar 2024

feedDZone Java Zone

Building a Performant Application Using Netty Framework in Java

Netty is a powerful, asynchronous, event-driven networking framework for building high-performance, scalable applications. It simplifies the development of network applications by providing an easy-to-use API and robust abstractions for handling various networking protocols and data formats.

Key features and benefits of Netty include:

19 Mar 2024 9:00pm GMT

14 Mar 2024

feedDZone Java Zone

Optimizing Robotics Application’s Performance

In this post, we would like to share our real-world experience in optimizing a Java application that was controlling the robots in a warehouse. This application would give instructions to the robots in the warehouse on what actions to perform. Based on those instructions, robots carry out their job in the warehouse. Occasionally, this application was slowing down and not giving instructions to the robots. If robots didn't receive instructions from the application, they would start to make autonomous decisions causing degenerated behavior in them, which in turn was affecting the delivery and shipments in the warehouse.

Long Garbage Collection Pause

The best way to start troubleshooting the Java application's performance is to study its Garbage Collection performance. This is even more true when the application suffers from a slowdown. We took this application's Garbage Collection log file and uploaded it to the GCeasy tool. (Note: Garbage Collection log contains vital statistics that are not reported by most monitoring tools, and they add almost no overhead to your application. Thus, it's a best practice to enable the Garbage Collection log on all your production instances). The tool analyzed the Garbage Collection log and instantly generated this insightful GC log analysis report.

14 Mar 2024 8:00pm GMT

Test Parameterization With JUnit 5.7: A Deep Dive Into @EnumSource

Parameterized tests allow developers to efficiently test their code with a range of input values. In the realm of JUnit testing, seasoned users have long grappled with the complexities of implementing these tests. But with the release of JUnit 5.7, a new era of test parameterization enters, offering developers first-class support and enhanced capabilities. Let's delve into the exciting possibilities that JUnit 5.7 brings to the table for parameterized testing!

Parameterization Samples From JUnit 5.7 Docs

Let's see some examples from the docs:

14 Mar 2024 4:00am GMT

12 Mar 2024

feedDZone Java Zone

CRUDing NoSQL Data With Quarkus, Part Two: Elasticsearch

In Part 1 of this series, we looked at MongoDB, one of the most reliable and robust document-oriented NoSQL databases. Here in Part 2, we'll examine another quite unavoidable NoSQL database: Elasticsearch.

More than just a popular and powerful open-source distributed NoSQL database, Elasticsearch is first of all a search and analytics engine. It is built on the top of Apache Lucene, the most famous search engine Java library, and is able to perform real-time search and analysis operations on structured and unstructured data. It is designed to handle efficiently large amounts of data.

12 Mar 2024 10:00pm GMT

Mastering Exception Handling in Java Lambda Expressions

Effective exception management is pivotal for maintaining the integrity and stability of software applications. Java's lambda expressions offer a concise means of expressing anonymous functions, yet handling exceptions within these constructs presents unique challenges. In this article, we'll delve into the nuances of managing exceptions within Java lambda expressions, exploring potential hurdles and providing practical strategies to overcome them.

Understanding Lambda Expressions in Java

Java 8 introduced lambda expressions, revolutionizing the way we encapsulate functionality as method arguments or create anonymous classes. Lambda expressions comprise parameters, an arrow (->), and a body, facilitating a more succinct representation of code blocks. Typically, lambda expressions are utilized with functional interfaces, which define a single abstract method (SAM).

12 Mar 2024 4:00am GMT

11 Mar 2024

feedDZone Java Zone

Feature Flags and Canary Releases in Microservices

Feature flags are commonly used constructs and have been there for a while. But in the last few years, things have evolved and feature flags are playing a major role in delivering continuous risk-free releases. In general, when a new feature is not fully developed and we still want to branch off a release from the mainstream, we can hide our new feature and toggle it off in production. Another use-case is when we want to release our feature to only a small percentage of users, we set the feature 'on' for a segment/geography and set it 'off' for the rest of the world. The capability to toggle a feature on and off without doing a source code change gives the developer an extra edge to experiment with conflicting features with live traffic. Let us deep dive into more details about feature flags and an example implementation in Springboot.

Things To Consider When We Are Introducing a New Feature Flag

  1. Establish a consistent naming convention across applications, to make the purpose of the feature flags easily understandable by other developers and product teams.
  2. Where to maintain feature flags?
    1. In the application property file: Toggle features based on environment. Useful for experimenting in development while keeping features off in production.
    2. In configuration server or vault: Let's imagine you are tired after a late-night release, and your ops team calls you at 4 am, to inform you the new feature is creating red alerts everywhere in monitoring tools, here comes the Feature toggle to your rescue. First, turn the feature 'off' in the config server and restart compute pods alone,
    3. In database or cache: Reading configs or flag values from a database or an external cache system like Redis, you don't have to redeploy or restart your compute, as the values can be dynamically read from the source at regular intervals, pods get updated value without any restart.

You can also explore open-source or third-party SDKs built for feature flags, a handful of them are already in the market. They also come with additional advantages that help in the lifecycle management of feature flags.

11 Mar 2024 5:00pm GMT

COBOL to JOBOL? A Poor Choice for Modernization

The enduring prevalence of COBOL (Common Business-Oriented Language) in mission-critical applications poses a challenge for modernization efforts, particularly in the transition to Java. This paper explores the intricacies of converting COBOL to Java, emphasizing the avoidance of JOBOL-a term coined for Java code that retains procedural characteristics without embracing object-oriented principles. The discussion includes strategies for data-oriented conversion, dead code elimination, and the adoption of event-driven approaches to ensure a successful transition that leverages the full potential of Java.

Introduction

COBOL, an acronym for Common Business-Oriented Language, has been a stalwart in the programming world, particularly for business applications, since its inception in the late 1950s. Despite its age, COBOL remains a critical component in many organizations, with millions of lines of code still in use for core mission-critical applications. However, as technology advances, there is an increasing push towards modernization, with Java being a popular target language due to its object-oriented nature, robust ecosystem, and wide adoption in contemporary software development.

11 Mar 2024 1:00pm GMT

10 Mar 2024

feedDZone Java Zone

Streaming Real-Time Data From Kafka 3.7.0 to Flink 1.18.1 for Processing

Over the past few years, Apache Kafka has emerged as the leading standard for streaming data. Fast-forward to the present day: Kafka has achieved ubiquity, being adopted by at least 80% of the Fortune 100. This widespread adoption is attributed to Kafka's architecture, which goes far beyond basic messaging. Kafka's architecture versatility makes it exceptionally suitable for streaming data at a vast "internet" scale, ensuring fault tolerance and data consistency crucial for supporting mission-critical applications.

Flink is a high-throughput, unified batch and stream processing engine, renowned for its capability to handle continuous data streams at scale. It seamlessly integrates with Kafka and offers robust support for exactly-once semantics, ensuring each event is processed precisely once, even amidst system failures. Flink emerges as a natural choice as a stream processor for Kafka. While Apache Flink enjoys significant success and popularity as a tool for real-time data processing, accessing sufficient resources and current examples for learning Flink can be challenging.

10 Mar 2024 11:00am GMT

08 Mar 2024

feedDZone Java Zone

Debugging Using JMX Revisited

Debugging effectively requires a nuanced approach, similar to using tongs that tightly grip the problem from both sides. While low-level tools have their place in system-level service debugging, today's focus shifts towards a more sophisticated segment of the development stack: advanced management tools. Understanding these tools is crucial for developers, as it bridges the gap between code creation and operational deployment, enhancing both efficiency and effectiveness in managing applications across extensive infrastructures.
Debugging Using JMX Revisited graphic

The Need for Advanced Management Tools in Development

Development and DevOps teams utilize an array of tools, often perceived as complex or alien by developers. These tools, designed for scalability, enable the management of thousands of servers simultaneously. Such capabilities, although not always necessary for smaller scales, offer significant advantages in application management. Advanced management tools facilitate the navigation and control over multiple machines, making them indispensable for developers seeking to optimize application performance and reliability.

08 Mar 2024 1:00am GMT

07 Mar 2024

feedDZone Java Zone

Harnessing the Power of SIMD With Java Vector API

In the world of high-performance computing, utilizing SIMD (Single Instruction, Multiple Data) instructions can significantly boost the performance of certain types of computations. SIMD enables processors to perform the same operation on multiple data points simultaneously, making it ideal for tasks like numerical computations, image processing, and multimedia operations. With Java 17, developers now have access to the Vector API, a feature that allows them to harness the power of SIMD directly within their Java applications.

In this article, we'll explore what the Vector API is, how it works, and provide examples demonstrating its usage.

07 Mar 2024 7:00pm GMT

Java Thread Dump Analysis

Thread dump analysis is a traditional approach followed to analyze the performance bottlenecks in Java-based applications. In the modern era, we have APM tools that provide various metrics and screens to drill down and identify performance issues, even at the code level. But for some of the performance issues or occasions, thread dump analysis still stands as the best way to identify the bottlenecks.

When To Use a Thread Dump

To analyze any performance issue, it is good to take a series of thread dumps with a 1 to 2-second time gap. Taking 10-15 thread dumps each with 1-2 second intervals helps to analyze the threads that got stuck or execute the same code across thread dumps.

07 Mar 2024 5:00pm GMT