Across Redisson’s 32,245 functions, 1,002 have reached the critical risk band — and the highest-priority cluster sits inside two files: CronExpression.java and CommandBatchService.java. The top-ranked function, getTimeAfter, carries a risk score of 19.8 (CC 37, ND 8, FO 60) and is actively changing right now — a live regression risk, not a backlog item. Three of the top five hotspots share the same file, signaling that the cron scheduling subsystem as a whole warrants immediate structural attention.
The table below ranks functions by activity-weighted risk — a score that multiplies structural complexity by recent commit frequency. A function that is both hard to understand (high cyclomatic complexity) and actively changing is a higher priority than one that is complex but untouched. CC = cyclomatic complexity (independent execution paths); ND = max nesting depth; FO = fan-out (distinct callees).
Top 5 Hotspots
| Function | File | Risk | CC | ND | FO |
|---|---|---|---|---|---|
getTimeAfter | redisson/src/main/java/org/redisson/executor/CronExpression.java | 19.8 | 37 | 8 | 60 |
storeExpressionVals | redisson/src/main/java/org/redisson/executor/CronExpression.java | 19.4 | 45 | 8 | 26 |
executeAsync | redisson/src/main/java/org/redisson/command/CommandBatchService.java | 17.9 | 11 | 8 | 47 |
doConnect | redisson/src/main/java/org/redisson/connection/SentinelConnectionManager.java | 17.8 | 26 | 6 | 69 |
addToSet | redisson/src/main/java/org/redisson/executor/CronExpression.java | 17.4 | 46 | 7 | 6 |
Hotspot Analysis
getTimeAfter — redisson/src/main/java/org/redisson/executor/CronExpression.java
Based on its name and location in the executor’s CronExpression class, getTimeAfter likely computes the next valid trigger time for a cron schedule — a calculation that requires evaluating every field of the expression (seconds, minutes, hours, day-of-month, month, day-of-week) against a reference instant. Its cyclomatic complexity of 37 means there are at least 37 independent execution paths to reason about and test, its max nesting depth of 8 makes those paths extremely difficult to follow, and a fan-out of 60 means it reaches into 60 distinct callees — any one of which can introduce a subtle scheduling regression. With the highest risk score in the dataset (19.8) and sustained recent commit activity, this function is both the most structurally complex and the most actively modified in the entire repository right now.
Recommendation: Add a comprehensive characterization test suite covering edge cases (DST transitions, leap years, month-end boundaries) before making any further changes, then extract the per-field evaluation logic into dedicated, independently testable methods to bring CC below 15.
storeExpressionVals — redisson/src/main/java/org/redisson/executor/CronExpression.java
storeExpressionVals, also in CronExpression.java, likely handles parsing and storing the individual field values of a cron expression string into an internal representation. At CC 45 — the highest cyclomatic complexity in the top five — it has 45 distinct paths driven by character-level parsing rules, compounded by a max nesting depth of 8. Its risk score of 19.4 and sustained recent commit activity confirm this parser is being actively modified, meaning each change navigates a branching structure large enough to make unintended side effects very easy to introduce. The exit-heavy and god_function patterns flag that it handles far too many responsibilities in a single method body.
Recommendation: Apply extract-method refactoring to isolate each cron field’s parsing logic (e.g., parseDayOfWeek, parseMonth) into separate methods; this alone will reduce CC substantially and make the multiple exit paths traceable per field rather than across the entire function.
executeAsync — redisson/src/main/java/org/redisson/command/CommandBatchService.java
executeAsync in CommandBatchService is the likely orchestrator for asynchronously dispatching a batch of Redis commands — a coordination point that must handle connection selection, serialization, error handling, and response aggregation. Its fan-out of 47 is the clearest risk signal here: 47 distinct callees means a change to executeAsync can produce unexpected ripple effects across nearly every layer of the client stack. Although its cyclomatic complexity of 11 is moderate, the max nesting depth of 8 combined with the god_function pattern indicates it is shouldering too many concerns, and a risk score of 17.9 means these concerns are being modified under live development pressure.
Recommendation: Map the 47 fan-out dependencies before touching this function — a call-graph review will reveal which callees are safe to extract into a dedicated BatchDispatcher or ResponseCollector abstraction, reducing both the coupling surface and the nesting depth.
Patterns Found
Antipatterns detected across the top functions in this snapshot:
| Pattern | Occurrences |
|---|---|
complex_branching | 5 |
deeply_nested | 5 |
exit_heavy | 5 |
long_function | 5 |
god_function | 4 |
These labels belong to two tiers — Tier 1 (structural): complex_branching, deeply_nested, exit_heavy, long_function, god_function. Tier 2 (relational/temporal): hub_function, cyclic_hub, middle_man, neighbor_risk, stale_complex, churn_magnet, shotgun_target, volatile_god.
Key Takeaways
- Prioritize CronExpression.java immediately: three of the five highest-risk functions live there, all in the ‘fire’ quadrant with recent commit activity levels above 17 — this is the single file most likely to produce a scheduling regression in the next sprint.
- storeExpressionVals has the highest cyclomatic complexity in the dataset (CC 45) and is actively changing; apply extract-method refactoring field-by-field and require a passing characterization test suite before merging further changes to this function.
- executeAsync in CommandBatchService.java has a fan-out of 47 — before any refactoring, produce a callee map to understand the blast radius; changes here can silently break connection handling, serialization, or retry logic across the entire Redis command pipeline.
Reproduce This Analysis
git clone https://github.com/redisson/redisson
cd redisson
git checkout 012d78aec7ce55a964a1001637f115c26ffe85f4
hotspots analyze . --mode snapshot --explain-patterns --force
To run the same analysis on your own codebase, run hotspots analyze . --mode snapshot in any local git repo — no configuration required.
Hotspots highlights structural and activity risk — not “bad code.” Findings are a prioritization aid, not a bug predictor. Editorial policy →