It is still a legacy issue of the last oracle migration to mysql. When I checked the data, I found that the data volume of the two databases was inconsistent. Finally, I confirmed my opinion. When I modified the code, I simplified 10 processes into one single thread. So there will be so much less data.
The reason is very simple. At that time, this function was called javasicbarrier. At that time, I didn't understand the specific meaning:
- If (sessionParameter. getSourceThreadNum ()> 1 ){
- System. out. println ("multi-thread running ");
- CyclicBarrier barrier = new CyclicBarrier (sessionParameter
- . GetSourceThreadNum () + 2 );
- For (int I = 0; I <= sessionParameter. getSourceThreadNum (); I ++ ){
- DataSyncThread dataSync = new dataSyncThread (barrier, I,
- SDataSource, tDataSource, sessionParameter );
- DataSync. start ();
- }
- Long start = System. currentTimeMillis ();
- Barrier. await ();
- Barrier. await ();
- Long end = System. currentTimeMillis ();
In practical applications, sometimes multiple threads need to work at the same time to accomplish the same thing, and in the process of completion, they often wait for other threads to finish a certain stage before execution, after All threads reach a certain stage, they are executed in a unified manner. Among them, barrier is equivalent to a blocking, barrier. The most important attribute of javasicbarrier is the number of participants, and the most important method is await (). When await () is called by all threads, it indicates that these threads can continue to run; otherwise, they will wait. Only when the number in CyclicBarrierint number) is reached can the 10 processes in the program be synchronized without mutual interference.