During performance tests on JBoss 4.2.3.GA we've also faced much BLOCKED threads on org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:288)
and org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedConnectionManager.java:318)
The connection pool was not exhausted.
Digging in sources led to this:
http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.jbossas/jboss-as-connector/5.0.0.Beta4/org/jboss/resource/connectionmanager/CachedConnectionManager.java#286
286 if (debug)
287 {
288 synchronized (connectionStackTraces)
289 {
290 connectionStackTraces.put(connection, new Throwable("STACKTRACE"));
291 }
292 }
So the problem is not about slow sql but about debug synchronization.
This can be disabled in deploy/jbossjca-service.xml with <attribute name="Debug">false</attribute>.