
How to Test Concurrent Code and Find Race Conditions
Test concurrent Java code and find race conditions: stress tests with many threads, latches, repeated runs, jcstress and thread-safety design.
Tag
223 posts

Test concurrent Java code and find race conditions: stress tests with many threads, latches, repeated runs, jcstress and thread-safety design.

Tune G1 by sizing the heap from the container, setting a pause goal and fixing humongous allocations, and leave out the flags that only make it worse.

Make Quarkus calls resilient with SmallRye Fault Tolerance: @Timeout, @Retry, @CircuitBreaker, @Fallback and @Bulkhead, with sensible values and their limits.

Draw bar, line and pie charts in JSF with PrimeFaces: build a ChartModel in a bean, bind p:chart, update it with AJAX, handle click events and size data.

Debug a Spring Boot app from the IDE or attach to a running JVM, break only on matching requests and find out why a bean is missing.

Set HTTP cache headers in Spring: Cache-Control, max-age, no-store, private versus public, Vary, stale-while-revalidate and static resource caching.

Use AtomicInteger, AtomicLong and LongAdder for thread safe counters in Java: compareAndSet, updateAndGet, contention behaviour and which class to choose.

Do contract testing with Spring Cloud Contract: write Groovy or YAML contracts on the producer, generated tests, stubs for consumers and publishing in CI.

Move a Java service to generational ZGC: the flags by JDK version, what changes from G1 and single generation ZGC, heap headroom and how to compare results.

Handle slow processing in Kafka consumers: tune max.poll.records and max.poll.interval.ms, pause and resume partitions and bound the work queue.

Add health checks, Micrometer metrics and OpenTelemetry tracing to a Quarkus service: the extensions, endpoints, custom checks and settings for Kubernetes.

Upload files in JSF with PrimeFaces p:fileUpload: size and type limits, UploadedFile, safe storage outside the web root and common errors.