I GOT IT!!! I GOT IT!!! And you're not going to believe this! My PoolManager
test was using the MySQL ConnectionPoolDataSource:
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
Well, turns out they actually coded it backwards! See they use the same method to send an error event as a closed event, but the only way they distinguish is by an int which is either 1 or 2. Well, 2 means an error occurred and they mis-coded the close() method to send 2 instead of 1. So THAT is why I couldn't close the stupid thing and it kept throwing that problem! (So I recompiled their code, added it to the jar file and it works! Man what a BIG mistake in released code! how come no one ever noticed that?)
Now it DID make me see a problem with my code - I was not synchronizing the removal in my error-handling code. So now I have a question:
Let's say an error is thrown when I try to close it, it will call my event listener which, if in a synchronized call, I assume will wait for the first which is waiting for that - deadlock. So what's the solution? (The listener is the same class/object as the one that is trying to close everything)