Home » Java » Page 5

Java

How the Java Language Could Better Support Composition and Delegation

This article outlines a way of improving the Java language to better support composition and delegation. Engage in the discussion and contribute to evolving the Java Language. The Java language lacks explicit semantic support for composition and delegation. This makes delegating classes hard to write, error-prone, hard to read and maintain. For example, delegating a JDBC ResultSet interface entails writing ...

Read More »

Java: How Object Reuse Can Reduce Latency and Improve Performance

Become familiar with the art of object reuse by reading this article and learn the pros and cons of different reuse strategies in a multi-threaded Java application. This allows you to write more performant code with less latency. While the use of objects in object-oriented languages such as Java provides an excellent way of abstracting away complexity, frequent object creation ...

Read More »

So you want to expose your JAX-RS services over HTTP/2

spring-interview-questions-answers

Nonetheless HTTP/2 is about six years old (already!), and HTTP/3 is around the corner, it looks like the majority of the web applications and systems are stuck in time, operating over HTTP/1.x protocol. And we are not even talking about legacy systems, it is not difficult to stumble upon greenfield web applications that ignore the existence of the HTTP/2 in ...

Read More »

Kernel – Message Formatting and Template Expansions

java-interview-questions-answers

Kernel – Message Formatting and Template Expansions    The module kivakit-kernel supports a simple variable substitution syntax. This syntax can be used when formatting messages, or when substituting variables into templates. Formatting a Message Basic message formatting is achieved with the Message.format() method: var formatted = Message.format("Hello my name is $", name); The symbol $ is an expansion marker, and ...

Read More »

Java: Why a Set Can Contain Duplicate Elements

In low-latency applications, the creation of unnecessary objects is often avoided by reusing mutable objects to reduce memory pressure and thus the load on the garbage collector. This makes the application run much more deterministically and with much less jitter. However, care must be taken as to how these reused objects are used or else unexpected results might manifest themselves, ...

Read More »

Java: Creating Terabyte Sized Queues with Low-Latency

Queues are often fundamental components in software design patterns. But, what if there are millions of messages received every second and multi-process consumers need to be able to read the complete ledger of all messages? Java can only hold so much information before the heap becomes a limiting factor with high-impacting garbage collections as a result, potentially preventing us from ...

Read More »

Log4j RCE 0-day vulnerability (CVE-2021-44228) mitigation actions

I had an update from my very good friend and excellent consultant Stella Varvarigou in which she explained me that setting com.sun.jndi.rmi.object.trustURLCodebase and com.sun.jndi.cosnaming.object.trustURLCodebase to false does not fully mitigate the threat as it is possible to send the exploit code with the request.[2] Introduction Apache Log4j, the most popular logging system, has announced a zero-day exploit CVE-2021-44228 on December 9, 2021 that results ...

Read More »

KivaKit and AWS Lambda

java-interview-questions-answers

KivaKit 1.2 adds seamless support for AWS Lambda. Lambdas for REST and GRPC can be added to a KivaKit Microservice without alteration (which will make this a short article). Creating a Lambda We have already seen a KivaKit request handler for REST in the Microservices article. We will simply reuse this code as our Lambda request handler. As a reminder ...

Read More »

KivaKit Clustering

java-interview-questions-answers

KivaKit Clustering   KivaKit provides built-in support for clustering of microservices using Apache Zookeeper. It supplies a cluster model that is updated as members join and leave the cluster, and an implementation of the SettingsStore interface that stores settings in Zookeeper. Joining and Leaving a KivaKit Microservice Cluster To use KivaKit in a cluster, Apache Zookeeper must be running according ...

Read More »