@Override public boolean isInUse() { // Note that it is critical here that we always check isWritable() BEFORE checking // the claimant count. This is due to the fact that if the claim is in fact writable, the claimant count // could increase. So if we first check claimant count and that is 0, and then we check isWritable, it may be // that the claimant count has changed to 1 before checking isWritable. // However, if isWritable() is false, then the only way that the claimant count can increase is if a FlowFile referencing // the Resource Claim is cloned. In this case, though, the claimant count has not become 0. // Said another way, if isWritable() == false, then the claimant count can never increase from 0. return isWritable() || claimManager.getClaimantCount(this) > 0; } }
@Override public boolean isInUse() { // Note that it is critical here that we always check isWritable() BEFORE checking // the claimant count. This is due to the fact that if the claim is in fact writable, the claimant count // could increase. So if we first check claimant count and that is 0, and then we check isWritable, it may be // that the claimant count has changed to 1 before checking isWritable. // However, if isWritable() is false, then the only way that the claimant count can increase is if a FlowFile referencing // the Resource Claim is cloned. In this case, though, the claimant count has not become 0. // Said another way, if isWritable() == false, then the claimant count can never increase from 0. return isWritable() || claimManager.getClaimantCount(this) > 0; } }