as mentioned, I am a distributed project. Now we need to do a card grabbing function. Want to modify a method with synchronized and lock it, but the result is not optimistic
I call the receiveVipCard () method of another service from one service, and at first I will determine whether I can get it or not.
my test method is: change the number of cards that can be picked up to 1, and then grab the two phones together, and get both (after the grab, I will take the number of cards that can get-1), but the number of cards that can be received is 0, that is, it is reduced only once, why? Can"t distributed locks be like this?