connection pools for database and web sessions

M

marvind

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top