jamesfredley commented on PR #15800:
URL: https://github.com/apache/grails-core/pull/15800#issuecomment-5170980209
## Reshape after review feedback
Pushed two commits on top of the previous approach:
1. **`Avoid double codec registration at startup and in mockCodec`**
- `CodecsConfiguration`: drop manual `reInitialize()`; rely on
`InitializingBean.afterPropertiesSet()`
- `GrailsWebUnitTest.mockCodec`: either `reInitialize()` after
`addArtefact`, or `configureCodecMethods()` once - not both
2. **`Key codec metaclass registration by Class and lock per factory`**
- Registration keys: target `Class<?>` + method name (not class name
strings)
- Dropped `synchronized(emc)` on shared metaclasses
- Per-factory claim+register lock via Caffeine `weakKeys()` (keeps
same-factory concurrency atomic without locking `String`/`Object` EMCs)
- Kept Caffeine factory-identity cache; no O(N²) stale sweep /
hand-rolled weak refs
- Tests assert via public encode/decode behavior only
### Intentionally not done
- No outer `metaMethodsConfigured` flag on `DefaultGrailsCodecClass` - that
would skip `CodecMetaClassSupport`'s metaclass-replacement recovery path
- No real-app benchmark harness in this PR; impact restated as reduced
redundant EMC writes + opt-in microbenchmark
- No production test instrumentation counters
### Verification
```
./gradlew :grails-encoder:test --tests
org.grails.encoder.CodecMetaClassSupportSpec
```
BUILD SUCCESSFUL (7/7).
Ready for another review pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]