[jboss-dev-forums] [Design of JCA on JBoss] - Re: JBAS-1808 - MCF MBeans
adrian@jboss.org
do-not-reply at jboss.com
Mon Feb 18 07:08:21 EST 2008
Vicky, for such trivial changes in general you should just do it.
Silence means approval. :-)
However in this case, you've got a thread safety issue.
If the cels really are an ArrayList then not accessing it in a synchronized block
will produce a ConcurrentModificationException when the pool changes.
Exposing an AarrayList isn't very good api anyway.
The method in InternalManagedConnectionPool should look something like this:
| // The method should be package protected and just specify a Set
| Set<ConnectionListener> getConnectionListeners()
| {
| // Avoid concurrency issues with the rest of the pool
| synchronized (cls)
| {
| // "Clone" the internal collections inside the synchronized block to avoid concurrency issues
| Set<ConnectionListener result = new HashSet<ConnectionListener>();
| result.addAll(cls); // The connections in the pool
| result.addAll(checkedOut); // The connections being used by applications
| return result;
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130069#4130069
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130069
More information about the jboss-dev-forums
mailing list