Posts in 'Java'

Multiple Condition Queues For Better Concurrency

I had been revisiting concurrent libraries that I had worked upon earlier and just wanted to highlight the importance of using separate wait sets and condition queues for your library implementations. The performance of these has been benchmarked using JMH.

Let me just list down the advantages of using separate …

Java WatchService

In this post, I will cover a tutorial that involves different moving pieces. It covers the following:

  • Java WatchService
  • Spring Boot
  • Initialization-on-demand holder idiom
  • Managing concurrency
  • RXJava
  • Lombok (because why type more?)

The example will expose a Spring Boot REST service that exposes csv file records from a directory. In …

Reactively Streaming CSV using RXJava

RXJava is an extremely useful streaming framework (here is an example application using it for parallel processing of restful calls to both uber and lyft (RT_UBER_NYC_TAXI)). However, In this post, I will cover how you can reactively stream and process a CSV file.

Firstly, you can create a Flowable of …

Java8: Decorating with Functional Programming and Generics

The Idea

Java 8 introduced functional programming support, this is a powerful feature which was missing from earlier versions. One of the benefits of functional programming is that it can be used to implement decorator pattern without the use of inheritance. One common requirement is to implement some kind of …

Automatically Detect Content Encoding

You might be aware that there are different content encoding formats for encoding the text. Generally, it is safe to use UTF encoding, but at least you would expect that the websites would specify the encoding format in the response. Alas, you might find certain sites , which just send the …