You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Roberto Cortez (JIRA)" <ji...@apache.org> on 2016/06/02 20:02:59 UTC
[jira] [Commented] (TOMEE-1827) Possible
java.util.ConcurrentModificationException with
ValidatingGenericConnectionManager
[ https://issues.apache.org/jira/browse/TOMEE-1827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15312957#comment-15312957 ]
Roberto Cortez commented on TOMEE-1827:
---------------------------------------
Added a proposed patch.
> Possible java.util.ConcurrentModificationException with ValidatingGenericConnectionManager
> ------------------------------------------------------------------------------------------
>
> Key: TOMEE-1827
> URL: https://issues.apache.org/jira/browse/TOMEE-1827
> Project: TomEE
> Issue Type: Bug
> Components: TomEE Core Server
> Affects Versions: 7.0.0
> Reporter: Roberto Cortez
> Fix For: 7.0.1
>
> Attachments: TOMEE-1827.patch
>
>
> When validating Resource Adapters connections with ValidatingGenericConnectionManager, there is a case that just hands over the pool object directly to the validate method, which may cause multiple Timer threads to change the connections Set.
> For instance, the validate method might be iterating the connections set, while at the same time the FillTask Timer thread is filling the min pool. Both in the same object.
> Here is the code:
> {code:java}
> else if (stack instanceof SinglePoolMatchAllConnectionInterceptor) {
> connections = (Map<ManagedConnection, ManagedConnectionInfo>) pool;
> }
> ...
> final Set<ManagedConnection> invalids = ValidatingManagedConnectionFactory.class.cast(getManagedConnectionFactory())
> .getInvalidConnections(connections.keySet());
> {code}
> This can happen depending on the logic implemented by the Resource Adapter in the getInvalidConnections method.
> A workaround is to extend the Resource Adapter, override the getInvalidConnections and just place the original Set elements into a new Set and call the super method.
> Reproduced here:
> https://github.com/radcortez/tomee-resource-adapter
> mvn test -Dtest=com.radcortez.tomee.ra.SampleResourceAdapterValidationTest
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)