java.lang.Object
org.gcube.informationsystem.resourceregistry.persistence.orientdb.utils.ConcurrentWriteDetector

public final class ConcurrentWriteDetector extends Object
Recognizes the failure of a write that lost the race with another write: the backend reports it with an ONeedRetryException when both changed the same records, and with a duplicate key (see DuplicateKeyDetector) when both wrote the same value of a unique index (e.g. the same id), which the checks of the service, made before the other write committed, could not see. The layers above may have wrapped it. Repeated, the write meets the committed one and gets its ordinary answer.
Author:
Luca Frosini (ISTI - CNR)
  • Method Details

    • isConcurrentWrite

      public static boolean isConcurrentWrite(Throwable throwable)
      Returns whether the given failure, or one of its causes, is a concurrent write lost.
      Parameters:
      throwable - the failure
      Returns:
      true if the write can be repeated as it is