local-li commented on issue #21156:
URL:
https://github.com/apache/shardingsphere/issues/21156#issuecomment-1260307386
> The `Configuration.removeResource(resName)` method only removes the
resource and does not close the resource,maybe you can refer to the logic of
this method `com.atomikos.icatch.config.Configuration#removeAndCloseResources`
1.remove the resouce by resource name and return the resource object you
want,`Configuration.removeResource ( res.getName () )`; 2.close the resource
>
> ```java
> private static void removeAndCloseResources(boolean force) {
> Collection<RecoverableResource> resources = Configuration.getResources();
> for (RecoverableResource res : resources) {
> Configuration.removeResource ( res.getName () );
> try {
> res.close ();
> } catch ( ResourceException re ) {
> // ...
> }
> }
> }
> ```
Yes, I also noticed this method, but Configuration static classes are
proxied by UserTransactionService.
If I choose to cross it directly, is this a step-up in code design?
At present, my solution is to manually call System.gc() after the program
itself is removed. But I will do a stricter check before calling System.gc().
Do you think there will be other hidden problems in this way?
--
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]