114 Technical Articles · Java, Concurrency, Project Panama & Performance

All Posts

Browse all deep dives, JMH benchmark studies, and guides on modern Java (JDK 21–26), Virtual Threads, Structured Concurrency, Project Panama (FFM API), and Linux io_uring. You can also browse by topic categories.

2024

21 Articles
Dec 28 2024 Java Year in Review: Conferences, Project Loom Book & Open-Source Milestones java3 min Dec 15 Java Optional Guide: Creating, Chaining, map(), flatMap() & Best Practices java7 min Dec 13 Java If-Else and Switch Expressions: Modern Pattern Matching & Syntax Guide java7 min Dec 12 Exception Handling in Java: Checked vs. Unchecked Exceptions & Best Practices java4 min Dec 12 Loops in Java Explained: For, Enhanced For-Each, While & Do-While Examples java2 min Dec 11 Java Enums Explained: Fields, Constructors, Methods & Code Examples java6 min Nov 18 Optimizing Project Panama (FFM API) Native Memory & Downcall Performance in Java java7 min Nov 03 Java Arena Types Explained: Confined, Shared, Auto & Global (Project Panama FFM API) java5 min Oct 01 How to Call a C Library Function from Java with Project Panama (FFM API) java5 min Sep 21 How to Do an Upcall from C to Java Using Project Panama (FFM API) java5 min Aug 08 Build a REST API with Java, Jakarta EE and Helidon jakarta5 min Jul 30 How to Enable Java Virtual Threads in Spring Boot virtual threads1 min Jul 30 Mockito thenReturn vs. thenAnswer: Stubbing Method Return Values in Java mockito4 min Jul 30 Mockito Inline Mock Maker: Mocking Final Classes, Static Methods & Constructors mockito5 min Jul 29 Java Microbenchmark Harness (JMH) Tutorial: Write Accurate JVM Benchmarks testing8 min Jul 08 Java Virtual Threads vs. Platform Threads: Benchmarking High-Concurrency API Calls virtual threads6 min Jun 17 Java Virtual Threads vs. Platform Threads: Performance When Blocking Calls Return Fast virtual threads7 min Mar 27 First-Time-Right Software Engineering: Shipping Faster with Fewer Bugs java5 min Feb 14 How to Read a File from src/main/resources in Java (InputStream & ClassLoader) java2 min Feb 12 How to Create a Thread with Runnable in Java (Class & Lambda Examples) multithreading4 min Jan 25 How to Extend the Thread Class in Java (With Code Examples) multithreading2 min

2023

42 Articles
Dec 31 Helidon Quickstart Guide: Creating a Java Microservice in IntelliJ IDEA jakarta3 min Dec 11 Java Scoped Values Tutorial: Faster, Safer Alternative to ThreadLocal virtual threads7 min Oct 28 JUnit 5 & JUnit 4 Lifecycle Annotations Explained (@BeforeAll, @BeforeEach, @AfterEach) java3 min Oct 25 How to Unit Test Jakarta Bean Validation Annotations in Java (@NotNull, @Size) java2 min Oct 11 Spring Boot REST API Request Validation with @Valid and Jakarta Bean Validation java2 min Sep 30 How to Make Sync & Async HTTP Requests in Java with HttpClient java4 min Sep 07 Verify method calls with Mockito java4 min Sep 06 How to Generate an HTML Test Report with JUnit 5 and Maven Surefire java1 min Aug 31 Given When Then structure with JUnit tests java2 min Aug 31 How to Repeat a Test Multiple Times in JUnit 5 with @RepeatedTest junit2 min Aug 28 Conditional Test Execution in JUnit 5 with Annotations (@EnabledOnOs, @EnabledIf) junit4 min Jul 27 Enum with properties using Java java2 min Jul 27 How to Create a Unit Test with Mocks in Java (JUnit 5 & Mockito) java3 min Jul 14 How to Create a Unit Test in Java with JUnit 5 java3 min Jun 15 4 Ways to Create Virtual Threads in Java 21+ multithreading3 min Jun 14 How to Detect Pinned Virtual Threads in Java (-Djdk.tracePinnedThreads & JFR) virtual threads2 min Jun 09 Using ExecutorService, Future & invokeAll with Java Virtual Threads (JDK 21+) virtual threads4 min May 31 Pattern Matching for Switch in Java 21+: Guarded Patterns, Nulls & Sealed Types java3 min May 31 How to Configure IntelliJ IDEA to Build and Run Java Projects with Maven java2 min May 30 Mockito Custom Argument Matchers: Returning Dynamic Values Based on Input Arguments mockito3 min Apr 28 How to Use Mockito Spy (@Spy & Mockito.spy) for Partial Mocking in Java mockito4 min Apr 27 Using @PathParam in Jakarta RESTful Web Services (JAX-RS) with Examples java3 min Apr 27 3 Ways to Name Virtual Threads in Java for Better Debugging virtual threads3 min Apr 24 How to Configure the Java Virtual Thread Scheduler (Parallelism & Pool Size) virtual threads2 min Apr 13 Jakarta EE REST API Tutorial: Handling GET, POST, PUT, and DELETE Requests java4 min Apr 13 Java ThreadGroup Explained: Grouping, Interrupting & Managing Threads java2 min Apr 10 Bootstrap a Jakarta EE REST API in Pure Java SE (No Application Server) java3 min Apr 08 How to Use Mockito with JUnit 5 (@ExtendWith(MockitoExtension.class) Tutorial) testing2 min Apr 08 How to Set Custom Display Names in JUnit 5 (@DisplayName & @DisplayNameGeneration) testing1 min Mar 31 JUnit 5 Parameterized Tests with @CsvSource and @CsvFileSource java3 min Mar 31 Global Exception Handling in Spring Boot with @ControllerAdvice & @ExceptionHandler java2 min Mar 31 Java ReentrantLock Tutorial: Thread-Safe Locking & Virtual Thread Pinning Prevention multithreading3 min Feb 23 Java Virtual Threads Explained: Architecture, Creation & Performance (JDK 21–26) virtual threads6 min Feb 21 How to Read a File in Java: Files.readString(), BufferedReader & Streams java3 min Feb 20 How to Remove All Null Values from a List in Java (removeIf, Streams & removeAll) java2 min Feb 18 How to Split or Partition a List into Batches in Java java2 min Jan 30 How to Mock Constructor Calls in Mockito 5 with mockConstruction() mockito4 min Jan 20 Upgrading to Mockito 5: JDK 11+, Inline Mock Maker by Default & Breaking Changes mockito2 min Jan 20 How to Inject Mocks in Mockito Using @InjectMocks and @Mock mockito2 min Jan 19 How to Mock a Java Record Class with Mockito testing3 min Jan 15 How to Pause Execution in Java with Thread.sleep() and TimeUnit multithreading1 min Jan 15 How to Interrupt a Thread in Java: interrupt(), isInterrupted() & InterruptedException multithreading3 min

2022

33 Articles
Dec 21 SSOT, DRY, and Single Responsibility Principle (SRP) Explained in Java java3 min Nov 29 How to Disable or Ignore Tests in JUnit 5 (@Disabled) and JUnit 4 (@Ignore) junit2 min Nov 24 How to Use Semaphore in Java to Limit Concurrent Access (With Examples) multithreading4 min Nov 08 Java ExecutorService Tutorial: Thread Pools, Callable, Future & Virtual Threads multithreading7 min Nov 04 JUnit 5 Conditional Test Execution: OS, JRE, System Properties & Env Vars junit4 min Nov 03 How to Set Test Timeouts in JUnit 5 (@Timeout, assertTimeout) and JUnit 4 junit3 min Nov 01 How to Mock an Enum and Its Methods in Java with Mockito mockito3 min Nov 01 How to Implement a Custom StructuredTaskScope in Java virtual threads3 min Sep 19 Running Multiple Threads in Java and Getting the First Result (invokeAny vs. ShutdownOnSuccess) virtual threads3 min Sep 12 Java Virtual Threads Production Pitfalls: Thread Pinning, ThreadLocals & Pooling Traps virtual threads4 min Sep 08 How Many Java Virtual Threads Can Run in Parallel? virtual threads3 min Sep 05 12 Steps to Writing Maintainable Java Unit Tests testing8 min Aug 22 JUnit 5 Advanced Assertions: assertAll, assertThrows, assertTimeout & More testing2 min Aug 22 How to Assert & Verify Exceptions in JUnit 5 with assertThrows() testing3 min Aug 18 How to Run JUnit 5 Tests in Parallel to Speed Up Your Build testing4 min Aug 16 How to Control Test Execution Order in JUnit 5 (@TestMethodOrder & @Order) junit3 min Jul 27 How to Use Mockito ArgumentCaptor in Java Unit Tests mockito3 min Jul 22 Complete Guide to Creating Mocks in Java with Mockito mockito4 min Jul 19 How to Mock and Stub Void Methods in Mockito (doNothing, doThrow, doAnswer) mockito3 min Jun 28 Custom Argument Matching in Mockito with argThat() and Java Lambdas mockito2 min Jun 28 Structured Concurrency in Java: StructuredTaskScope, ShutdownOnFailure, ShutdownOnSuccess & Deadlines virtual threads5 min Jun 07 How to Configure Mockito Strictness Levels (LENIENT, WARN, STRICT_STUBS) mockito3 min May 14 How to Create Custom Annotations in Java and Read Them with Reflection java3 min May 13 Building a High-Throughput Web Crawler in Java with Virtual Threads virtual threads3 min Apr 26 Java Stream Collectors.groupingBy() Guide: Count, Sum, Filter & Multi-Field Grouping java4 min Apr 25 How to Implement the Singleton Design Pattern in Java (Thread-Safe & Enum) java6 min Apr 16 Pattern Matching for instanceof in Java (With Code Examples) java2 min Mar 28 Catching Multiple Exceptions in Java: try-catch Rules & Examples java4 min Mar 10 How to Join or Concatenate Two Lists in Java Using Streams java2 min Mar 08 How to Mock Final Classes and Final Methods in Java with Mockito mockito3 min Feb 21 How to Mock Static Methods in Java with Mockito (Mockito.mockStatic) mockito4 min Feb 20 How to Mock Constructors in Mockito (Mockito.mockConstruction Guide) mockito5 min Jan 24 JUnit 5 Dynamic Tests Tutorial: Generating Runtime Tests with @TestFactory junit3 min