Re: [Proxool-developer] Spurious connections caused by Prototyper's apparently wrong connectionCount
UNMAINTAINED!
Brought to you by:
billhorsman
From: Bill H. <arc...@gm...> - 2005-09-30 12:57:50
|
Hi Hrvoje, On 9/30/05, Hrvoje Niksic <hn...@xe...> wrote: > > Mitch's patch does make sense. You might want to consider making it > > thread safe. > > I can do that. Is the additional ++connectionCount in the last hunk > of his patch also in your opinion correct? Hmm. That /is/ a bug. And it's still in the latest code :( That variable only comes into effect in turning away requests quickly which is why it hasn't been spotted before. If it's wrong (too low) then it means that the "triage" stage will accept the connection but will refuse it when it discovers isn't aren't any. I think I would increment that count in a slightly different place. ConnectionPool.addProxyConnection to be precise protected void addProxyConnection(ProxyConnectionIF proxyConnection) { try { acquireConnectionStatusWriteLock(); proxyConnections.add(proxyConnection); connectionCountByState[proxyConnection.getStatus()]++; connectionCount++; // Patch } finally { releaseConnectionStatusWriteLock(); } } However, I haven't tested that. The connectionCount isn't displayed in the logs and it's not used when deciding whether to build a new connection so i= t isn't helpful to your solution. (Although, I agree it should be fixed). Back to the problem that you are experiencing. My simple unit test didn't track it down. But I have some ideas that I'll try out over the next few days. Feel free to bug me about that. - Bill - Bill |