Lazy init SMO backend and increase timeout#7587
Conversation
- initialize SMO backend only when needed - bump request timeout to 15s, since the response time is fairly unpredictable - java 17 renovation: instanceof, records, Stream/Colleciton API
|
I am no osgi expert but this would be a plausible explanation:
so this is mostly harmless, lazy loading SMO is an easy fix and should have no side effects |
matthiasblaesing
left a comment
There was a problem hiding this comment.
Looks sane to me.
The following is my personal opinion and not meant to keep this from being merged:
I'm not a big fan of changing files "just because" though. I think the core change is in NexusRepositoryIndexer everything else is unrelated. And in there I think the change to WagonFetcher is a misuse of record. To me the intention of record is to act as an immutable data carrier, which is not the case here. Of course it can be used as it is, to me this looks like something I would not use.
|
thanks for the review, I will try to split cleanup the rest from now on again. My opinion about misuse of records for final classes with immutable fields: if its a private or package private non-API utility, I would personally go with whatever is most concise or reads best. There absolutely are problems with record overuse, but this is often a problem in API. Interfaces on top and records on the bottom can look convenient, but as soon you need an additional field which can't be passed through the canonical constructor you designed yourself into a corner and have to recompute state in methods again and again. So I do agree that record overuse can cause problems, but I think in situations where you can change back to a final class at any point in future - it is no real problem. You get a good
|
So I noticed since #7569 this exception when NB is started and closed before the maven indexer is initialized:
I am not completely sure why this happens. The gson wrapper can be found just fine when
NexusRepositoryIndexerImplis initialized normally, but when it is loaded from for the first timenetbeans/java/maven.indexer/src/org/netbeans/modules/maven/indexer/OnStop.java
Lines 48 to 52 in 1b31400
it causes the exception. Lazy loading SMO fixes it.