Newsletter #40
Enjoy Newsletter #40.
A new way to test multi-threaded and concurrent Java
Testing multithreaded Java code is hard because a single test run exercises only one specific thread interleaving. Running a test repeatedly in hopes of hitting every timing permutation only works for tiny snippets, since every field access can introduce a new interleaving. VMLens tackles this by systematically exploring interleavings at synchronization actions (volatile accesses, synchronized blocks, locks) and checking test runs for data races. The theoretical foundation is straightforward: a program free of data races has simple interleaving semantics, so testing only needs to permute synchronization points.
Under the hood, VMLens runs as a Java agent that instruments bytecode to record field accesses and synchronization events, analyzing traces offline rather than trying to detect bugs mid-execution. For every pair of non-commuting synchronization actions, the tool tests both orderings and combines them to cover the state space. The post walks through examples using volatile fields and ReentrantLock, noting that VMLens treats Java’s standard concurrency primitives as already correct and focuses on verifying whether application code uses them properly. With CPU core counts still climbing (hitting 288 cores in 2025), it offers a missing piece for verifying concurrent code with confidence.
Feature Freeze for JDK 25: What Will the New Edition Bring?
JVM Weekly rounds up what is landing in JDK 25 following its feature freeze on June 5, 2025. As a Long-Term Support (LTS) release scheduled for general availability on September 16, 2025, it will receive at least five years of Oracle Premier Support. Several language and library features are finalized: Scoped Values (JEP 506) for safely sharing immutable context across threads; Module Import Declarations (JEP 511) allowing import module M; to bring an entire module’s exported API into scope; Compact Source Files (JEP 512) enabling concise void main() entry points that cut boilerplate for beginners; Flexible Constructor Bodies (JEP 513) allowing statements before super() or this() calls; and a Key Derivation Function API (JEP 510) for cryptography.
On the runtime and performance side, Compact Object Headers (JEP 519) reduce per-object memory overhead, Generational Shenandoah (JEP 521) graduates to production status, the 32-bit x86 port is removed, and AOT cache ergonomics plus method profiling (JEP 514/515) speed up application warmup. JDK Flight Recorder gains experimental Linux CPU-time profiling (JEP 509) alongside method timing and tracing events (JEP 520). Preview and incubator features include Stable Values, PEM encoding, Structured Concurrency (fifth preview with a redesigned API), primitive types in instanceof and switch patterns, and the Vector API (tenth incubation). As an LTS milestone, JDK 25 shapes up as a compelling upgrade target for enterprise teams.
If Virtual Threads are the solution, what is the problem?
Webtide, the team behind Eclipse Jetty, flips the usual question around: if virtual threads are the answer, what is the actual problem? In their view, virtual threads shine when an application blocks on “scalable resources”—resources that add latency but can handle higher concurrency as load grows, such as remote databases and microservices, slow client network connections, or local filesystems. Because virtual threads are cheap to create, they let a server keep many concurrent operations in flight while platform threads would otherwise sit idle waiting on I/O.
However, virtual threads do not automatically make an application more scalable. When the bottleneck is a finite resource like CPU cores, database connection pools, or locks, spawning more threads is like adding more cars to fix a traffic jam. Waiting threads aren’t free either: a request blocked deep inside application code still holds onto I/O buffers, session objects, a deep call stack, and heap allocations, so waiting carries real memory cost even when the thread itself is virtual. Without concurrency limits, the lack of backpressure can trigger cascading resource exhaustion under peak load. Webtide recommends letting an asynchronous server like Jetty read requests asynchronously and buffer content before handing off to a virtual thread for business logic—keeping straightforward blocking code where it helps without letting in-flight memory balloon. The takeaway: diagnose where your application actually bottlenecks before treating virtual threads as a scaling strategy.
Agentic Coding Recommendations
Armin Ronacher, creator of Flask, shares his practical playbook for working with coding agents. He runs Claude Code with Sonnet, disables interactive permission prompts, and contains risk by isolating the environment inside Docker; he uses MCP sparingly, favoring simple shell scripts instead. For backend work, he recommends Go: its explicit context plumbing makes data flow obvious, incremental tests run fast, structural interfaces don’t trip up language models, and the stable ecosystem means agents rarely hallucinate outdated APIs. Python, by contrast, trips agents up with “magic” like pytest fixtures, async subtleties, and slow interpreter startup.
For developer tooling, his top priorities are speed, clear error messages, guardrails against misuse, and strong observability; he puts core workflows in a Makefile with safety checks that prevent duplicate background services and log everything to files the agent can inspect. On code style, he advises writing “the simplest thing that could possibly work”: prefer plain functions with descriptive names over class hierarchies, avoid inheritance and elaborate design patterns, write raw SQL so the agent can correlate queries with database logs, and keep permission checks close to business logic rather than hidden in configuration files. Agents can also run in parallel across multiple sessions using the filesystem as shared state and containers for isolation. His conclusion: succeeding with agentic coding comes down to simplicity, stability, observability, and timely refactoring.
AI Changes Everything
In this reflective essay, Armin Ronacher argues that AI is an irreversible shift on the scale of the printing press or the steam engine, and urges engineers to meet it with curiosity, responsibility, and optimism. Personally, he now uses Claude Code for most of his development work instead of writing code by hand in Cursor. His raw coding speed hasn’t necessarily increased, but he reclaims roughly 30% of his day because the AI handles execution while his own role shifts toward managing, reviewing, and delegating.
Ronacher notes that AI adoption is moving far faster than previous technology waves, including smartphones: baristas, hairdressers, and parents are already using these tools daily. Unlike the cloud era—where most countries simply consumed US-built infrastructure—AI carries the strategic inevitability of the steam engine, meaning every nation will want sovereign models and domestic control. He places AI in the category of civilization-reshaping technologies rather than just another platform wave like search engines or social media. His closing message is to view AI as a tool that expands what humans can accomplish rather than a threat, in a decade that may resemble the historical moments when new technology fundamentally rewired society.
How I program with Agents
David Crawshaw defines a coding agent concisely: “essentially a for-loop around an LLM call.” The model runs a command, observes the output, and keeps going without human intervention between turns, making it far more capable than one-shot code generation on a “virtual whiteboard.” Agents use standard developer tools—bash commands, file patching, web browsing, and automated code review—to navigate a codebase, compile, run tests, and iterate until the task is done. Environmental feedback makes the model noticeably sharper: documentation lookups improve API accuracy, compiler errors eliminate syntax hallucinations, test suites raise code quality, and targeted file reads let it work in repositories far larger than its context window.
For Crawshaw, the biggest win is maintaining momentum through tedious integration plumbing so he can save his energy for hard design problems. Still, agents consume real time and compute: a single prompt can burn tens of thousands of intermediate tokens and take several minutes per loop, costs remain nontrivial even as inference gets cheaper, and agents still struggle with subtle architectural judgment and thorny dependency upgrades. Looking ahead, Crawshaw expects agents to run inside containers for safety and parallelism, IDEs to evolve around editable diffs, SSH workspaces, and code-review-style feedback loops, and team review practices to be redesigned from the ground up.
Performance Best Practise No. 1: Optimize Database Operations
This Foojay article kicks off a Java performance series with the single highest-impact area: optimizing database operations. Because establishing a database connection is expensive, connection pooling is foundational. Using GlassFish as an example, pools can be configured via the admin console, CLI, XML datasource definitions, or annotations, centering on three key parameters: a maximum pool size aligned with the database’s capacity, an idle timeout shorter than the database’s own timeout to avoid stale connections, and statement cache size.
Statement caching stores frequently executed SQL statements (Statement, PreparedStatement, CallableStatement) for reuse so the database doesn’t repeatedly parse and plan them; GlassFish can provide this caching even when the underlying JDBC driver doesn’t. JDBC batching groups multiple writes via addBatch() and sends them in a single network round-trip with executeBatch(). At the JPA layer, EclipseLink supports batch writing through the eclipselink.jdbc.batch-writing property (jdbc or buffered) alongside a configurable batch size, and allows disabling batching on individual queries via query hints when needed. Finally, the author advises monitoring connection pool metrics and query latencies closely, and load-testing configuration changes under realistic traffic before shipping to production.
Agent Rules - A collection of rules and knowledge for AI coding assistants
Peter Steinberger, founder of PSPDFKit, curates a repository of rules and reference docs for AI coding assistants aimed at creating a unified, reusable format across tools. Rules are authored as .mdc files (Markdown with frontmatter metadata) for Cursor, while the plain Markdown body can be imported directly into Claude Code via CLAUDE.md. The repository is organized into three buckets: project rules covering development workflows, code quality checks, problem-solving habits, documentation, and automation; reference docs, such as a Swift 6 migration guide and best practices for building MCP servers; and global rules containing reusable helper scripts across projects.
Adoption is straightforward: for Cursor, copy the .mdc files into .cursor/rules/; for Claude Code, reference the Markdown files from CLAUDE.md. Each rule is written to be concise, actionable, and portable across repositories. Because both tools share the same underlying Markdown instructions, the community can iterate on and share battle-tested agent workflows in one place instead of maintaining separate rule sets per editor.
This post was rewritten by Claude Code with Opus 5.5 on 27/09/2026; reviewed and edited by Codex with GPT 6.1 Sol on 09/11/2026, and re-verified by Claude Code with Sonnet 5.5 on 16/11/2026.
Comments