public void checkOrRepairUuid(final int partition, final UUID newUuid) {
        assert newUuid != null;

        MetaDataContainer metaData = getMetaDataContainer(partition);
        while (true) {
            UUID prevUuid = metaData.getUuid();
            if (prevUuid != null && prevUuid.equals(newUuid)) {
                break;
            }
            if (metaData.casUuid(prevUuid, newUuid)) {
                metaData.resetSequence();
                metaData.resetStaleSequence();
                if (logger.isFinestEnabled()) {
                    logger.finest(format("%s:[name=%s,partition=%d,prevUuid=%s,newUuid=%s]",
                            "Invalid UUID, lost remote partition data unexpectedly", name, partition, prevUuid, newUuid));
                }
                break;
            }
        }
    }
public void checkOrRepairUuid ( final int partition , final UUID newUuid ) { assert newUuid != null ; MetaDataContainer metaData = getMetaDataContainer ( partition ) ; while ( true ) { UUID prevUuid = metaData . getUuid ( ) ; if ( prevUuid != null && prevUuid . equals ( newUuid ) ) { break ; } if ( metaData . casUuid ( prevUuid , newUuid ) ) { metaData . resetSequence ( ) ; metaData . resetStaleSequence ( ) ; if ( logger . isFinestEnabled ( ) ) { logger . finest ( format ( "%s:[name=%s,partition=%d,prevUuid=%s,newUuid=%s]" , "Invalid UUID, lost remote partition data unexpectedly" , name , partition , prevUuid , newUuid ) ) ; } break ; } } }
multiple threads can concurrently call this method: one is anti-entropy, other one is event service thread