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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...