[ 
https://issues.apache.org/jira/browse/DERBY-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977437#action_12977437
 ] 

Rick Hillegas commented on DERBY-2905:
--------------------------------------

Hi Lily,

It has been a long time since I thought about this issue and I no longer 
remember what the issues are. It is not clear to me what will happen if the 
driver is unregistered when the engine is shut down. Quite likely, that will 
break driver autoloading since the JRE autoloads drivers only once. The JRE 
autoloads the drivers on the very first attempt to resolve a connection URL via 
DriverManager.getConnection(). Subsequent calls to 
DriverManager.getConnection() do not trigger autoloading. I can understand that 
some users want to garbage collect the Derby classes after the engine shuts 
down. It is likely that other users want autoloading behavior to continue after 
engine shutdown. It may be possible to satisfy both types of users--and it may 
not be. An ideal solution would do the following:

1) Unload all (or almost all) of the Derby classes after engine shutdown.

2) Preserve the autoloading idiom that resolves a connection url provided that 
some jarball on the classpath provides an appropriate driver.

What happens if you explicitly deregister the Derby driver after engine 
shutdown? What happens if you reregister the Derby driver later on?

> Shutting down embedded Derby does not remove all code, the AutoloadDriver is 
> left registered in the DriverManager.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2905
>                 URL: https://issues.apache.org/jira/browse/DERBY-2905
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.2.2.0, 10.3.1.4, 10.4.1.3
>            Reporter: Daniel John Debrunner
>         Attachments: DERBY-2905v0.diff, DERBY-2905v0.stat, DERBY-2905v1.diff, 
> DERBY-2905v1.stat, DERBY-2905v3.diff, DERBY-2905v3.stat, Main.java, 
> Mainv1.java
>
>
> After a shutdown of the embedded driver the AutoloadDriver is not 
> unregistered from DriverManager. However it does not support any future 
> loading of connections so it has no value in remaining registered. Since the 
> DriverManager class will remain forever, this means the Derby code will 
> remain forever in the JVM, even if Derby was loaded by a separate class 
> loader.
> Regression from 10.1 since before the AutoloadedDriver the internal driver 
> did unregister itself from the DriverManager on a shutdown.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to