db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: Garbage-collecting Derby classes, was: Can't remove derby from memory
Date Tue, 27 Mar 2012 12:48:20 GMT
Rick Hillegas <rick.hillegas@oracle.com> writes:

> This discussion is taking place on the user list. It is my
> understanding that graceful engine shutdown is supposed to remove
> references to Derby classes, making all of the engine code eligible to
> be garbage-collected. At least, that is what I thought Lily
> implemented for 10.8.

I believe that shutting down the engine only makes the Derby engine
classes eligible for garbage collection if there are no references to
the classloader in which the engine classes lives. So I think the
classes will only be garbage collected if the driver was loaded in a
separate classloader. (There may also be references to connections,
statements, data sources, or other JDBC objects, in the user code that
prevent gc after shutdown.)

Instances of the engine classes (monitor, caches, etc), on the other
hand, should be eligible for garbage collection after engine shutdown,
even if the engine is not in a separate classloader.

> In the discussion below, the user is expecting that garbage-collection
> will happen after shutting down a single database. I wouldn't expect
> that. But it got me to wondering how a user is supposed to shutdown
> the engine gracefully via the Derby DataSources. I know how to do this
> by passing a shutdown URL to DriverManager, but how do you do this via
> a DataSource?

DataSourceConnector.shutEngine() in the test framework (used for
shutting down the engine on CDC/FP) does this using an empty database


Not sure if we have documented this approach.

Knut Anders

View raw message