how to avoid deadlocks with neo4j

时光毁灭记忆、已成空白 提交于 2019-12-04 12:47:59

You have two strategies:

the first, a pessimistic one, is using the LockManager getWriteLock method to acquire an exclusive lock on the node B before adding the related B1 node and unlock it as soon as the relationship creation finishes;

the second, an optimistic one, is to implement a retry strategy in case of deadlock, you can catch the DeadlockDetectedException exception and retry the operation until it's successful.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!