This week's book giveaway is in the Testing forum. We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line! See this thread for details.
I have a situation in which I need distributed access to a pool of shared resources. We have an server application that we have purchased, say, 10 licenses for. That means there are 10 distinct accounts which cannot be used concurrently (can't login more than once at a time). I would like to pre-create those connections and store them in JNDI for possible retrieval by JVMs on disparate machines. They are Serializable, so that isn't a problem. The problem is that we don't want client code to need to know which connection to request. It should just ask for "a connection" and block until one becomes available, perhaps with a timeout. When the work is complete the connection should be "returned" to the pool. I've looked at Semaphore in the concurrent package, but I don't think it works across JVMs... Can anyone make a suggestion or point me in the right direction?