Subject | How to make the garbage collector collect |
---|---|
Author | Markus Plail |
Post date | 2005-11-24T16:43:37Z |
Hi there!
I am writing webapps, that use Firebird databases. I have on db for
every service and wanted to know if there is any possibility to
get my XSQLVARs garbage collected other than to shutdown my
FBWrappingDataSource und create a new instance.
What I do is basically this:
FBWrappingDataSource fbWrapDs = new FBWrappingDataSource();
fbWrapDs.setDatabase("//" + URL + ":" + PORT + "/" +
database.getAbsolutePath());
fbWrapDs.setUserName("sysdba");
fbWrapDs.setPassword("schaLuppE");
fbWrapDs.setPooling(true);
fbWrapDs.setMinPoolSize(5);
fbWrapDs.setMaxPoolSize(30);
fbWrapDs.setLoginTimeout(10);
db = new Firebird(fbWrapDs.getConnection());
Then I use db using PreparedStatements. I close() them but the
corresponding XSQLVARs don't get garbage collected until I
fbWrapDs.getConnection().close();
fbWrapDs.shutdown();
I guess that's just the way it is and I know that PreparedStatements are
most useful when reused, but I like the possibility to parametrize(?) my
SQL queries, which is not possible with Statements. So is there
something I am overlooking?
Btw. it's not possible to:
FBWrappingDataSource fbWrapDs = new FBWrappingDataSource();
fbWrapDs.setDatabase("//" + URL + ":" + PORT + "/" +
db = new Firebird(fbWrapDs.getConnection());
... do smth ...
fbWrapDs.getConnection().close();
fbWrapDs.shutdown();
fbWrapDs.restart();
db = new Firebird(fbWrapDs.getConnection());
... do smth ...
fbWrapDs.shutdown();
The shutdown at the end fails because of:
Exception in thread "main" java.lang.NullPointerException
at org.firebirdsql.pool.PooledConnectionQueue.shutdown(PooledConnectionQueue.java:224)
at org.firebirdsql.pool.AbstractConnectionPool.shutdown(AbstractConnectionPool.java:169)
at org.firebirdsql.pool.FBWrappingDataSource.shutdown(FBWrappingDataSource.java:205)
at com.umiversal.database.TestFirebird.main(TestFirebird.java:100)
idleRemover is still null after a restart(). Is this supposed to work?
Thanks in advance
regards
Markus
I am writing webapps, that use Firebird databases. I have on db for
every service and wanted to know if there is any possibility to
get my XSQLVARs garbage collected other than to shutdown my
FBWrappingDataSource und create a new instance.
What I do is basically this:
FBWrappingDataSource fbWrapDs = new FBWrappingDataSource();
fbWrapDs.setDatabase("//" + URL + ":" + PORT + "/" +
database.getAbsolutePath());
fbWrapDs.setUserName("sysdba");
fbWrapDs.setPassword("schaLuppE");
fbWrapDs.setPooling(true);
fbWrapDs.setMinPoolSize(5);
fbWrapDs.setMaxPoolSize(30);
fbWrapDs.setLoginTimeout(10);
db = new Firebird(fbWrapDs.getConnection());
Then I use db using PreparedStatements. I close() them but the
corresponding XSQLVARs don't get garbage collected until I
fbWrapDs.getConnection().close();
fbWrapDs.shutdown();
I guess that's just the way it is and I know that PreparedStatements are
most useful when reused, but I like the possibility to parametrize(?) my
SQL queries, which is not possible with Statements. So is there
something I am overlooking?
Btw. it's not possible to:
FBWrappingDataSource fbWrapDs = new FBWrappingDataSource();
fbWrapDs.setDatabase("//" + URL + ":" + PORT + "/" +
db = new Firebird(fbWrapDs.getConnection());
... do smth ...
fbWrapDs.getConnection().close();
fbWrapDs.shutdown();
fbWrapDs.restart();
db = new Firebird(fbWrapDs.getConnection());
... do smth ...
fbWrapDs.shutdown();
The shutdown at the end fails because of:
Exception in thread "main" java.lang.NullPointerException
at org.firebirdsql.pool.PooledConnectionQueue.shutdown(PooledConnectionQueue.java:224)
at org.firebirdsql.pool.AbstractConnectionPool.shutdown(AbstractConnectionPool.java:169)
at org.firebirdsql.pool.FBWrappingDataSource.shutdown(FBWrappingDataSource.java:205)
at com.umiversal.database.TestFirebird.main(TestFirebird.java:100)
idleRemover is still null after a restart(). Is this supposed to work?
Thanks in advance
regards
Markus