Message-ID: From: "sehrope (@sehrope)" To: "pgjdbc/pgjdbc" Date: Fri, 19 Apr 2024 15:57:54 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3221: Performance degradation of XML operations under Java 21 with custom parsers/transformers In-Reply-To: References: List-Id: X-GitHub-Author-Login: sehrope X-GitHub-Comment-Id: 2066860609 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3221 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3221#issuecomment-2066860609 Content-Type: text/plain; charset=utf-8 @demonti That's very interesting. I'm not sure about merging in JDK-specific behavior in the core driver, but luckily in this case you can handle it in the connection options without waiting for a new release. There's connection property, `xmlFactoryFactory`, that let's you specify a factory class for instantiating the XML factory. The default is the built-in class, DefaultPGXmlFactoryFactory, that acts as you describe (creating a new instance for each request). You can create or your class that implements `PGXmlFactoryFactory` with the caching behavior across requests. That should solve your jar loading performance issues as it could initialized statically and reused. --- @davecramer I think we (or more accurately me...) forgot to add `xmlFactoryFactory` to the connection property descriptions on the website. It got added when we fixed that CVE to allow opt-in fallback to the old insecure behavior: https://github.com/pgjdbc/pgjdbc/commit/14b62aca4764d496813f55a43d050b017e01eb65 But I guess we never added it to the site itself so one would have to look at the enum or the release notes to know about it. A page that's generated off the driver's actual enum values would be nice as it already has the types and descriptions. That way it's always in sync.