connection pools for database and web sessions

Discussion in 'Java' started by marvind, Feb 1, 2006.

  1. marvind

    marvind Guest

    Hello,

    I have to implement two sets of connection pools - one for JDBC
    connections and the other for connections to HP service desk.

    I guess I could use an abstract factory but I found out that I have to
    duplicate a lot of code, mainly:

    1. Making a lot of classes singletons
    2. Write essentially the same connection pool class that contains the
    hashtable

    I tried using generics for both 1 (SingletonHolder) and 2 but I ran
    into the following problems in both cases:
    Due to Java's implementation of generics, I cannot declare a static
    field with unknown type or in static methods.

    So, my question is code duplication unavoidable (note all methods are
    static and the application is multithreaded, so you may have to lock on
    the class in some cases) or is there an elegant solution that I am
    missing?

    Thanks,
    mar
    marvind, Feb 1, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darryl L. Pierce

    Tomcat 4.0, MySQL and connection pools...

    Darryl L. Pierce, Aug 18, 2003, in forum: Java
    Replies:
    0
    Views:
    368
    Darryl L. Pierce
    Aug 18, 2003
  2. apue
    Replies:
    1
    Views:
    322
    Dorian
    Jul 23, 2006
  3. Tom
    Replies:
    2
    Views:
    528
  4. Eric Newton
    Replies:
    0
    Views:
    107
    Eric Newton
    Aug 15, 2003
  5. Bookham Measures

    Moving from ASP Sessions to Database Sessions

    Bookham Measures, Jul 23, 2007, in forum: ASP General
    Replies:
    19
    Views:
    555
    Bookham Measures
    Aug 23, 2007
Loading...

Share This Page