Channels, Pipelines, and database connections
Matt DeLuco
list_usr at spacebox.net
Wed Oct 12 21:26:08 EDT 2011
Hello,
I'm just getting started with my own netty server, though I've read through
a lot of the docs and examples. I have some questions about the basics.
Is a Channel and associated ChannelPipeline created for every connection
made to the server? Is a ChannelPipelineFactory created for each
connection, or just once when I pass an instance to
ServerBootstrap.setPipelineFactory()?
I'll be using netty to serve sql queries over http and using BoneCP to do
RDBMS connection pooling. As it stands I've got a custom
ChannelPipelineFactory to which I pass an ExecutionHandler and a BoneCP
connection pool. Each time getPipeline() is called I add the
ExecutionHandler to the pipeline and I get a connection from the database
connection pool which I intend to pass to a custom ChannelHandler. The
connection is assigned from the pool to a variable in getPipeline(), the
variable then passed to a ChannelHandler.
With my current approach I can't figure out where I would close the database
connection to return it to the pool.
Would it make more sense to subclass Channel or ChannelPipeline to contain a
reference to a database connection? I could then have a ChannelFuture or
some such close the database connection when the Channel closes?
Thanks.
-- Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20111012/8b1e20c1/attachment.html
More information about the netty-users
mailing list