Re: Cost of creating a factory

43 views
Skip to first unread message

Sergey Epik

unread,
Jun 25, 2012, 11:33:25 PM6/25/12
to jooq...@googlegroups.com

It's cheap to create Factory.
Take a look to new Factory constructor in master branch (jOOQ-2.4.x):
public Factory(DataSource datasource, SQLDialect dialect)
https://github.com/jOOQ/jOOQ/blob/master/jOOQ/src/main/java/org/jooq/impl/Factory.java
You can configure Factory with DataSource instance.
Discussion here:
https://groups.google.com/d/msg/jooq-user/eiwxsnVPWV0/uoL7RyFJ7_wJ


On Sat, Jun 23, 2012 at 8:56 AM, <ryan1...@gmail.com> wrote:
Hi,

I'm a newbie to Jooq. I'm using it in a web application. Going well so far, but I was wondering on the best approach for creating factories. I use a connection pool and am currently creating a new factory per request and giving it a connection from the pool. Is there a better approach?. I imagine it would be good to associate a factory with a connection and pool the factories, but if it is relatively cheap to create a factory is it worth the effort?

Thanks, Ryan


Lukas Eder

unread,
Jun 28, 2012, 4:44:16 AM6/28/12
to jooq...@googlegroups.com
Thanks Sergey,

Ryan, yes, as Sergey stated, by design you should generally be safe to
ignore the overhead of a factory being created.

However, I had recently fixed #1483, resolving a non-negligible
overhead resulting from the inefficient cloning of default factory
settings:
https://sourceforge.net/apps/trac/jooq/ticket/1483

This may have quite some impact on the perceived speed of your
application, when you instanciate many factories using default
settings.

Cheers
Lukas

2012/6/26 Sergey Epik <serge...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages