Possible concurrent issue with deployerMap in DeploymentEngine

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Possible concurrent issue with deployerMap in DeploymentEngine

Kishanthan Thangarajah
Hi Devs,

There is a possible issue which can arise with the deployerMap (HashMap) object in deployment engine. The deplyerMap object is accessed in two places.
1. When adding a new deployer.
2. During the scheduler task run, which in turn calls RepositoryListener.loadOtherDirectories.

If the add deployer method is called while the scheduler task is running, then that can lead to ConcurrentModificationException. This is already reported in https://issues.apache.org/jira/browse/AXIS2-5152. The fix suggested in there is to use ConcurretnHashMap. But still the issue can arise, since there is another second level map (which holds the deployer - extension) within this. This still can cause the same concurrent modification exception.

We can fix this by synchronizing the complete deployerMap object in those places that is is accessed. But the concern I have is, will this cause any impact on performance?

Thoughts?

Thanks,
Kishanthan.