/** * Releases an index commit that acquired by {@link #acquireIndexCommit(boolean)}. * * @return true if the snapshotting commit can be clean up. */ synchronized boolean releaseCommit(final IndexCommit snapshotCommit) { final IndexCommit releasingCommit = ((SnapshotIndexCommit) snapshotCommit).delegate; assert snapshottedCommits.containsKey(releasingCommit) : "Release non-snapshotted commit;" + "snapshotted commits [" + snapshottedCommits + "], releasing commit [" + releasingCommit + "]"; final int refCount = snapshottedCommits.addTo(releasingCommit, -1); // release refCount assert refCount >= 0 : "Number of snapshots can not be negative [" + refCount + "]"; if (refCount == 0) { snapshottedCommits.remove(releasingCommit); } // The commit can be clean up only if no pending snapshot and it is neither the safe commit nor last commit. return refCount == 0 && releasingCommit.equals(safeCommit) == false && releasingCommit.equals(lastCommit) == false; }
public int remove(T key) { return g_map.remove(key); }
this.remove((KType) c.value);
private void releaseViewExpansionToken(ViewExpansionToken token) { final String viewOwner = token.viewOwner; if (Objects.equals(queryUser, viewOwner)) { // If the token owner and queryUser are same, no need to track the token release. return; } Preconditions.checkState(userTokens.containsKey(token.viewOwner), "Given user doesn't exist in User Token store. Make sure token for this user is obtained first."); final int userTokenCount = userTokens.get(viewOwner); if (userTokenCount == 1) { // Remove the user from collection, when there are no more tokens issued to the user. userTokens.remove(viewOwner); } else { userTokens.put(viewOwner, userTokenCount - 1); } logger.debug("Released view expansion token issued for user '{}'", viewOwner); }
private void releaseViewExpansionToken(ViewExpansionToken token) { final String viewOwner = token.viewOwner; if (viewOwner.equals(queryUser)) { // If the token owner and queryUser are same, no need to track the token release. return; } Preconditions.checkState(userTokens.containsKey(token.viewOwner), "Given user doesn't exist in User Token store. Make sure token for this user is obtained first."); final int userTokenCount = userTokens.get(viewOwner); if (userTokenCount == 1) { // Remove the user from collection, when there are no more tokens issued to the user. userTokens.remove(viewOwner); } else { userTokens.put(viewOwner, userTokenCount - 1); } logger.debug("Released view expansion token issued for user '{}'", viewOwner); }
@Override public int test() { final ObjectIntHashMap<Integer> m_map = new ObjectIntHashMap<>( m_keys.length / 2 + 1, m_fillFactor ); int add = 0, remove = 0; while ( add < m_keys.length ) { m_map.put( m_keys[ add ], add ); ++add; m_map.put( m_keys[ add ], add ); ++add; m_map.remove( m_keys[ remove++ ] ); } return m_map.size(); } }
/** * Releases an index commit that acquired by {@link #acquireIndexCommit(boolean)}. * * @return true if the snapshotting commit can be clean up. */ synchronized boolean releaseCommit(final IndexCommit snapshotCommit) { final IndexCommit releasingCommit = ((SnapshotIndexCommit) snapshotCommit).delegate; assert snapshottedCommits.containsKey(releasingCommit) : "Release non-snapshotted commit;" + "snapshotted commits [" + snapshottedCommits + "], releasing commit [" + releasingCommit + "]"; final int refCount = snapshottedCommits.addTo(releasingCommit, -1); // release refCount assert refCount >= 0 : "Number of snapshots can not be negative [" + refCount + "]"; if (refCount == 0) { snapshottedCommits.remove(releasingCommit); } // The commit can be clean up only if no pending snapshot and it is neither the safe commit nor last commit. return refCount == 0 && releasingCommit.equals(safeCommit) == false && releasingCommit.equals(lastCommit) == false; }
/** * Releases an index commit that acquired by {@link #acquireIndexCommit(boolean)}. * * @return true if the snapshotting commit can be clean up. */ synchronized boolean releaseCommit(final IndexCommit snapshotCommit) { final IndexCommit releasingCommit = ((SnapshotIndexCommit) snapshotCommit).delegate; assert snapshottedCommits.containsKey(releasingCommit) : "Release non-snapshotted commit;" + "snapshotted commits [" + snapshottedCommits + "], releasing commit [" + releasingCommit + "]"; final int refCount = snapshottedCommits.addTo(releasingCommit, -1); // release refCount assert refCount >= 0 : "Number of snapshots can not be negative [" + refCount + "]"; if (refCount == 0) { snapshottedCommits.remove(releasingCommit); } // The commit can be clean up only if no pending snapshot and it is neither the safe commit nor last commit. return refCount == 0 && releasingCommit.equals(safeCommit) == false && releasingCommit.equals(lastCommit) == false; }
this.remove((KType) c.value);