JTA implementation of distributed dynamic data source based on spring, Atomikos, mybatis

Original text; http://www.blogjava.net/zuxiong/archive/2015/09/24/427471.html

Information
http://my.oschina.net/u/2273085/blog/666954
http://lizhao6210-126 -com.iteye.com/blog/1958831



For some large-scale applications, a single data source cannot support a large number of users. It is necessary to introduce multiple data sources, and perform sub-database and sub-table at the horizontal level to reduce the load of a single DB. Next, we need to manage the program calls before different data sources in our program to ensure that the function is WORK. In addition, cross-database means that the previous single-DB transaction is invalid, so J2EE proposes JTA, distributed transaction management, which is simply two-phase commit, which is more demanding than single-step commit. In fact, he has two containers to manage, one is the resource manager and the other is the transaction management. Friends can find that this is an interlocking process. To solve a problem, you have to solve these related problems. The following code, I also refer to the ideas of the predecessors, and have been transformed.

Actual operation see the original text

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326977501&siteId=291194637