Usage of Collections.synchronizedMap might cause performance degradation or java deadlock in DbSqlSessionFactory

Description

The following maps are used to cache statements for persistent classes:

org.activiti.engine.impl.db.DbSqlSessionFactory.insertStatements
org.activiti.engine.impl.db.DbSqlSessionFactory.updateStatements
org.activiti.engine.impl.db.DbSqlSessionFactory.deleteStatements
org.activiti.engine.impl.db.DbSqlSessionFactory.selectStatements

The usage of Collections.synchronizedMap degrades performance and might even lead to Java deadlock in the engine.

To avoid these issues ConcurrentHashMap should be used instead.

Synchronized Map vs ConcurrentHashMap

http://www.javamex.com/tutorials/concurrenthashmap_scalability.shtml
http://unserializableone.blogspot.com/2007/04/performance-comparision-between.html
http://gregluck.com/blog/archives/2009/06/performance-problems-in-concurrenthashmap-vs-synchronized-hashmap/
http://www.informit.com/guides/content.aspx?g=java&seqNum=246

Assignee

Bernd Ruecker (camunda)

Reporter

Peter Horvath

Labels

None

Fix versions

Priority

Major
Configure