my younger brother has been changing the back-end project recently, but I can"t solve it with a bug. I think my back-end knowledge is too lacking, so I"ve come here to ask for advice.
the process is like this: the front end has uploaded information, and after the interface receives the message, it uses some of the received information to request information from the third-party interface, and stores the two parts together. Part of the message received by
is the user ID (never repeated). I use this ID + to md5, the moment the message is received (accurate to seconds) to generate a unique sequence number as the primary key.
but sometimes the upload fails, and the log is recorded in this way
Could not execute JDBC batch update. Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (SIT_QDYY.SYS_C0010324) violated
I looked at the log and found that there are two identical pieces of information, according to the method I mentioned above to generate the serial number, which is bound to be repeated. I confirmed with the front end that it would not be uploaded twice a second, so I wondered if the network request after I received the message was time-consuming (I can"t think of any other reason).
moreover, each uploaded message is not processed sequentially. For example, the interface receives the A message, and then parses and prints the log. Before it is saved, the log of the B message is recorded, and then the An information is used to request the third party interface, storage, etc.
my guess:
the server is multithreaded and processes requests all the time, but it is time-consuming to use the data requested by A to request a third-party interface, so when the request B arrives, it will process B and send another thread to the third-party interface to get A-related data (it"s all speculation here, and it"s not clear what it has to do with my bug).
project is deployed on Weblogic using Struts2 + Hibernate + Oracle,.