Example usage for org.apache.commons.lang3.mutable MutableLong increment

List of usage examples for org.apache.commons.lang3.mutable MutableLong increment

Introduction

In this page you can find the example usage for org.apache.commons.lang3.mutable MutableLong increment.

Prototype

public void increment() 

Source Link

Document

Increments the value.

Usage

From source file:org.apache.hadoop.hbase.replication.regionserver.SerialReplicationChecker.java

public boolean canPush(Entry entry, Cell firstCellInEdit) throws IOException {
    String encodedNameAsString = Bytes.toString(entry.getKey().getEncodedRegionName());
    long seqId = entry.getKey().getSequenceId();
    Long canReplicateUnderSeqId = canPushUnder.getIfPresent(encodedNameAsString);
    if (canReplicateUnderSeqId != null) {
        if (seqId < canReplicateUnderSeqId.longValue()) {
            LOG.trace("{} is before the end barrier {}, pass", entry, canReplicateUnderSeqId);
            return true;
        }/*from   www  .  ja va 2  s. c om*/
        LOG.debug("{} is beyond the previous end barrier {}, remove from cache", entry, canReplicateUnderSeqId);
        // we are already beyond the last safe point, remove
        canPushUnder.invalidate(encodedNameAsString);
    }
    // This is for the case where the region is currently opened on us, if the sequence id is
    // continuous then we are safe to replicate. If there is a breakpoint, then maybe the region
    // has been moved to another RS and then back, so we need to check the barrier.
    MutableLong previousPushedSeqId = pushed.getUnchecked(encodedNameAsString);
    if (seqId == previousPushedSeqId.longValue() + 1) {
        LOG.trace("The sequence id for {} is continuous, pass", entry);
        previousPushedSeqId.increment();
        return true;
    }
    return canPush(entry, CellUtil.cloneRow(firstCellInEdit));
}