> I think it is too heavy, what would be the best practice way to
> create context?
You can implement custom DataSourceFactory and specify its class name
in the Modeler.
> Configuration.bootstrapSharedConfiguration(this.getClass());
This line is not needed in 1.2
Regarding the leaks. How many DataContexts you create in the
application? If it is more than one, you should reuse the DataDomain
you create. Is it possible that when creating a new context, you go
through the code below every time? If so it will definitely leak, as
it creates a new DataSource every time without disposing of the old one.
Andrus
On Feb 9, 2006, at 6:15 AM, noban wrote:
> Hi everybody!
>
> I`ve found a bug in my Eclipse RCP based application. Looks like it
> is connections leak.
> How can I test that?
>
> As well my application is promting for login/password during
> startup and I`m creating context like this:
>
> Thread.currentThread().setContextClassLoader(
> this.
> getClass().
> getClassLoader());
>
> DefaultConfiguration conf = new DefaultConfiguration();
> conf.addClassPath(Messages.getString
> ("LoginModel.CayenneConfigXMLPath"));
> Configuration.initializeSharedConfiguration(conf);
>
> Configuration.bootstrapSharedConfiguration(this.getClass());
> DataSource dataSource;
> try {
> String connectUrl = null;
> connectUrl = Messages.getString
> ("LoginModel.jdbcConnectParam");
> dataSource =
> new PoolManager(Messages.getString("LoginModel.driverClass"),
> connectUrl,
> ResourceLogin.DB_MIN_CONNECTIONS,
> ResourceLogin.DB_MAX_CONNECTIONS,
> login,
> password);
>
>
> Configuration config = Configuration.getSharedConfiguration();
> DataDomain domain = config.getDomain();
> DataNode node = domain.getNode(Messages.getString
> ("LoginModel.Node");
> node.setDataSource(dataSource);
>
> return Configuration.getSharedConfiguration()
> .getDomain()
> .createDataContext();
>
> } catch (SQLException e) {
> e.printStackTrace();
> return null;
> }
>
> I think it is too heavy, what would be the best practice way to
> create context?
>
This archive was generated by hypermail 2.0.0 : Thu Feb 09 2006 - 20:54:29 EST