Add the following properties to the configuration file for your project. The location of this file varies depending on the framework:
SOFABoot project properties file: This file is typically located at
src\main\resources\config\application.properties.Pure Spring project properties file: This file is typically in the
META-INFdirectory of the project.
Optimistic locking
The default row lock policy for distributed transactions in FMT mode is pessimistic locking. If high data consistency is not a requirement, you can enable optimistic locking.
To enable optimistic locking in SOFABoot, add the following property to the config/application.properties file:
Enable optimistic locking
com.alipay.dtx.rowlock.optimistic=xxx;Set xxx to true or false. The default value is false.
Spinlock
Spin locking attempts to acquire a row lock multiple times if the initial attempt fails. By default, the system retries 3 times and waits 3 ms between each retry. You can customize the retry policy using the following properties:
Enable spin locking
com.alipay.dtx.rowlock.spin=xxx;Set
xxxto true or false. The default value is true.Spin lock wait time
com.alipay.dtx.rowlock.spin.delay=xxx;Set
xxxto the wait time in milliseconds (ms). The default is 3 ms.Spinlock Spin Count
com.alipay.dtx.rowlock.spin.times=xxx;Set
xxxto the number of retries. The default is 3.