有什么方法可以检查哪个线程正在更新/操作 OrientDB 中的 ODocument?

问题描述

我使用过的代码

public void save(AbstractModelStandalone model) {
       int maxRetriesSave = 10;
       odocument data = (odocument) model.getDocument().getRawDocument();
       for (int retry = 0; retry < maxRetriesSave; ++retry) {
              try {
                 /*e.g here record version v1 incNum is 1*/
                 connection.save(data);
                 break;
                 } catch (OConcurrentModificationException e) {
                 /* here odocument is reloaded with latest version but with old values not updated ones*/       
                 /* here record version is v2 with old incNum 0. I need 1 here */
                 data.reload(null,true,true);
                 } catch (ovalidationException e) {
                 throw AbstractOrientDbDao.wrapOrientDbValidationException(e);
                 } catch (OException e) {
                 throw AbstractOrientDbDao.wrapOrientDbException(e);
               }
             }
          }

这里的数据是 odocument,它正在被另一个用户/线程更新。当我试图保存它时,我无法找到谁在更新它。由于使用了 OConcurrentModificationException 和重试机制,所以它会尝试用新版本再次保存它,但保存的数据是旧值,而不是更新的数据。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)