Skip to content

core-java

45 Posts

How to Use ScheduledExecutorService for Periodic Tasks in Java

In financial systems built on Apache Kafka and Flink, background scheduling is everywhere: checking consumer lag every 30 seconds, expiring distributed locks after a payment SLA window, scheduledExecutorService is production-grade answer to all of this.

How to Use Java Enums with Fields and Methods (Java 21)

Build a library loan desk in plain Java 21: an enum with fields, a lookup by code, per-constant behaviour, and a small state machine, all checked by 36 tests.

How to Use Sealed Classes and Interfaces in Java 21

Build a currency-rate feed in Java 21 where the compiler flags every switch you forgot to update. Sealed interfaces, records and sealed classes, step by step.