@@ -0,0 +1,2354 @@
+package com.orientechnologies.orient.core.db;%0A%0Aimport com.orientechnologies.common.types.OModifiableInteger;%0Aimport com.orientechnologies.orient.core.db.record.OIdentifiable;%0Aimport com.orientechnologies.orient.core.id.ORID;%0Aimport com.orientechnologies.orient.core.record.OElement;%0Aimport com.orientechnologies.orient.core.record.ORecord;%0Aimport com.orientechnologies.orient.core.record.impl.ODocument;%0Aimport com.orientechnologies.orient.core.sql.parser.OInteger;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.util.concurrent.CountDownLatch;%0Aimport java.util.concurrent.Executors;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class OSessionRetryTest %7B%0A%0A  private OrientDB orientDB;%0A%0A  @Before%0A  public void before() %7B%0A    orientDB = new OrientDB(%22embedded:%22, OrientDBConfig.defaultConfig());%0A    orientDB.create(OSessionRetryTest.class.getSimpleName(), ODatabaseType.MEMORY);%0A  %7D%0A%0A  @Test%0A  public void testRetry() %7B%0A    ODatabaseSession session = orientDB.open(OSessionRetryTest.class.getSimpleName(), %22admin%22, %22admin%22);%0A    session.createClass(%22Test%22);%0A    OElement doc = session.newElement(%22Test%22);%0A    doc.setProperty(%22one%22, %22tas%22);%0A    ORID id = session.save(doc).getIdentity();%0A%0A    CountDownLatch wrote = new CountDownLatch(1);%0A    CountDownLatch read = new CountDownLatch(1);%0A%0A    Executors.newCachedThreadPool().execute(() -%3E %7B%0A      ODatabaseSession session1 = orientDB.open(OSessionRetryTest.class.getSimpleName(), %22admin%22, %22admin%22);%0A      OElement loaded = session1.load(id);%0A      try %7B%0A        read.await();%0A      %7D catch (InterruptedException e) %7B%0A        //%0A      %7D%0A      loaded.setProperty(%22one%22, %22two%22);%0A      session1.save(loaded);%0A      wrote.countDown();%0A      session1.close();%0A    %7D);%0A%0A    OModifiableInteger integer = new OModifiableInteger(0);%0A    session.executeWithRetry(2, (session1) -%3E %7B%0A      integer.increment();%0A      session1.begin();%0A      OElement loaded = session1.load(id);%0A      read.countDown();%0A%0A      try %7B%0A        wrote.await();%0A      %7D catch (InterruptedException e) %7B%0A        e.printStackTrace();%0A      %7D%0A%0A      loaded.setProperty(%22two%22, %22three%22);%0A      session1.save(loaded);%0A      session1.commit();%0A      return null;%0A    %7D);%0A%0A    assertEquals(integer.getValue(), 2);%0A%0A    session.close();%0A  %7D%0A%0A  @After%0A  public void after() %7B%0A    orientDB.close();%0A  %7D%0A%0A%7D%0A

add test case for new retry api