Hey

Aaron Mulder wrote:
> 
>         Well, I spent some time looking through the JMX spec and code.
> Whew!  Dense stuff.

Yeah, but it's important to note that the really hard stuff is for mgmt
tool and adaptor creators. To write MBeans is not very difficult,
trivial even.

>         I guess I should explain what I've got.  It's a JDBC connection
> pool architecture implemented as a JDBC driver.  That is, you initialize
> one or more connection pools (read settings out of a configuration file or
> something - including the JDBC URL that the pool should use to create
> connections form the underlying DB). Then when you want to get a
> connection from the pool, you use the usual DriverManager routine with a
> URL like jdbc:pool:poolname.  If there's a loose connection in the pool,
> you get it.  Otherwise, it uses the preconfigured parameters to open a new
> physical connection and puts it in the pool.  When you call close on the
> connection, it gets marked as free in the pool (it isn't really closed).

Sounds pretty much like what I did, only I used the DataSource/JNDI
mechanism to acquire connections instead of a JDBC driver.

>         So the use of the connections would already fit in the
> orb.jboss.jdbc.DataSourceImpl - you'd just give the pool's URL to the
> DataSourceImpl in an <MLET> entry.  This would unfortunately result in
> double-pooling with the current DataSourceImpl implementation, but that's
> a minor change.

Integrate with it, or replace what is there now. The DataSource or
JDBC-driver interface should just be 2 different ways to access the same
stuff.

>         Yhere are two loose ends here.  The first is how to initialize the
> pool.  We could create a JMX helper class so you include an MLET tag in
> the config file with the pool parameters, and the helper class will just
> initialize the pool.  

Correct. Look at the MBeans in jBoss for hints. Subclassing
org.jboss.util.ServiceMBeanSupport is key (it helps you with stuff and
introduces start/stop functionality).

> The other problem is how to shut down the pool - but
> I guess this could be done the same way.

Implement the ServiceMBean interface (contains init/start/stop/destroy
methods) by subclassing ServiceMBeanSupport. Put your code in the
respective methods and your MBean will be easily configured through the
above methods.

>         Does that sound like the right track?  Will you be willing to drop
> the pooling in the DataSourceImpl to work with this, or should I implement
> a different data source or something?

Drop/integrate with the current DataSourceImpl.

>         Finally, how should I get code to you?  Post it here?  There are
> ~10 classes (including JDBC wrappers to update "last used" times, etc.).

For now, just send me the code and I'll look through it. You gotta use
the jBoss code templates (in /etc) though, so please look at them as
soon as possible.

Ask me if you have any more questions.

(more info in reply to Marc)

/Rickard

-- 
Rickard �berg

@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com

Reply via email to