因此,您可以通过表锁或数据库中的其他同步字段来解决这个问题,以确保不会出现重复项。
So, you can address this with perhaps a table lock, or some other syncing field in the database to ensure duplicates don't appear.
放弃同步,而使用一个static字段。
如果实现Runnable接口的类的setter(更新字段的成员函数)没有同步,则应该写明原因。
When a setter (a member function that updates a field) of a class that implements the Runnable interface is not synchronized, then you should document your reasons why.
应用推荐