server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedResponseManagerImpl.java
private boolean computeQuorumResponse(boolean reachedTimeout) {
    if (quorumResponse != null)
      // ALREADY COMPUTED
      return true;

    if (groupResponsesByResult) {
      for (List<ODistributedResponse> group : responseGroups) {
        if (group.size() >= quorum) {
          int responsesForQuorum = 0;
          for (ODistributedResponse r : group) {
            if (nodesConcurInQuorum.contains(r.getExecutorNodeName())) {
              final Object payload = r.getPayload();

              if (payload instanceof Throwable) {
                if (payload instanceof ODistributedRecordLockedException)
                  // JUST ONE ODistributedRecordLockedException IS ENOUGH TO FAIL THE OPERATION BECAUSE RESOURCES CANNOT BE LOCKED
                  break;
                if (payload instanceof OConcurrentCreateException)
                  // JUST ONE OConcurrentCreateException IS ENOUGH TO FAIL THE OPERATION BECAUSE RID ARE DIFFERENT
                  break;
              } else if (++responsesForQuorum >= quorum) {
                // QUORUM REACHED
                setQuorumResponse(r);
                return true;
              }
            }
          }
        }
      }

    } else {
      if (receivedResponses >= quorum) {
        int responsesForQuorum = 0;
        for (Map.Entry<String, Object> response : responses.entrySet()) {
          if (response.getValue() != NO_RESPONSE && nodesConcurInQuorum.contains(response.getKey())
              && ++responsesForQuorum >= quorum) {
            // QUORUM REACHED
            ODistributedResponse resp = (ODistributedResponse) response.getValue();
            if (resp != null && !(resp.getPayload() instanceof Throwable))
              setQuorumResponse(resp);
            return true;
          }
        }
      }
    }

    return false;
  }
private boolean computeQuorumResponse(boolean reachedTimeout) {
    if (quorumResponse != null)
      // ALREADY COMPUTED
      return true;

    if (groupResponsesByResult) {
      for (List<ODistributedResponse> group : responseGroups) {
        if (group.size() >= quorum) {
          int responsesForQuorum = 0;
          for (ODistributedResponse r : group) {
            if (nodesConcurInQuorum.contains(r.getExecutorNodeName())) {
              final Object payload = r.getPayload();

              if (payload instanceof Throwable) {
                if (payload instanceof ODistributedRecordLockedException)
                  // JUST ONE ODistributedRecordLockedException IS ENOUGH TO FAIL THE OPERATION BECAUSE RESOURCES CANNOT BE LOCKED
                  break;
                if (payload instanceof OConcurrentCreateException)
                  // JUST ONE OConcurrentCreateException IS ENOUGH TO FAIL THE OPERATION BECAUSE RID ARE DIFFERENT
                  break;
              } else if (++responsesForQuorum >= quorum) {
                // QUORUM REACHED
                setQuorumResponse(r);
                return true;
              }
            }
          }
        }
      }

    } else {
      if (receivedResponses >= quorum) {
        int responsesForQuorum = 0;
        for (Map.Entry<String, Object> response : responses.entrySet()) {
          if (response.getValue() != NO_RESPONSE && nodesConcurInQuorum.contains(response.getKey())
              && ++responsesForQuorum >= quorum) {
            // QUORUM REACHED
            ODistributedResponse resp = (ODistributedResponse) response.getValue();
            if (resp != null && !(resp.getPayload() instanceof Throwable))
              setQuorumResponse(resp);
            return true;
          }
        }
      }
    }

    return false;
  }
private boolean computeQuorumResponse ( boolean reachedTimeout ) { if ( quorumResponse != null ) // ALREADY COMPUTED return true ; if ( groupResponsesByResult ) { for ( List < ODistributedResponse > group : responseGroups ) { if ( group . size ( ) >= quorum ) { int responsesForQuorum = 0 ; for ( ODistributedResponse r : group ) { if ( nodesConcurInQuorum . contains ( r . getExecutorNodeName ( ) ) ) { final Object payload = r . getPayload ( ) ; if ( payload instanceof Throwable ) { if ( payload instanceof ODistributedRecordLockedException ) // JUST ONE ODistributedRecordLockedException IS ENOUGH TO FAIL THE OPERATION BECAUSE RESOURCES CANNOT BE LOCKED break ; if ( payload instanceof OConcurrentCreateException ) // JUST ONE OConcurrentCreateException IS ENOUGH TO FAIL THE OPERATION BECAUSE RID ARE DIFFERENT break ; } else if ( ++ responsesForQuorum >= quorum ) { // QUORUM REACHED setQuorumResponse ( r ) ; return true ; } } } } } } else { if ( receivedResponses >= quorum ) { int responsesForQuorum = 0 ; for ( Map . Entry < String , Object > response : responses . entrySet ( ) ) { if ( response . getValue ( ) != NO_RESPONSE && nodesConcurInQuorum . contains ( response . getKey ( ) ) && ++ responsesForQuorum >= quorum ) { // QUORUM REACHED ODistributedResponse resp = ( ODistributedResponse ) response . getValue ( ) ; if ( resp != null && ! ( resp . getPayload ( ) instanceof Throwable ) ) setQuorumResponse ( resp ) ; return true ; } } } } return false ; }
Computes the quorum response if possible by returning true and setting the field quorumResponse with the ODistributedResponse.
Computes the quorum response if possible by returning true and setting the field quorumResponse with the ODistributedResponse .