We clean up the stored acks received when the remoteCSeq in param is greater and
that the ackReceived is true
@param remoteCSeq remoteCSeq the basis CSeq for cleaning up earlier (lower CSeq) stored ackReceived
168074
protected void cleanupAcksReceived(long remoteCSeq) {
		List<Long> toBeRemoved = new ArrayList<Long>();
		final Iterator<Entry<Long, Boolean>> cSeqs = acksReceived.entrySet().iterator();
		while (cSeqs.hasNext()) {
			final Entry<Long, Boolean> entry = cSeqs.next();
			final long cSeq = entry.getKey();
			final boolean ackReceived = entry.getValue();
			if(ackReceived && cSeq < remoteCSeq) {
				toBeRemoved.add(cSeq);
			}
		}
		for(Long cSeq: toBeRemoved) {
			acksReceived.remove(cSeq);
			if(logger.isDebugEnabled()) {
				logger.debug("removed ackReceived for CSeq " + cSeq);
			}
		}
	}
462838
public static void validateRemoteRefUpdates(String errorPrefix, Collection<RemoteRefUpdate> refUpdates) {
                for (RemoteRefUpdate refUpdate : refUpdates) {
                        RemoteRefUpdate.Status status = refUpdate.getStatus();

                        if (status == RemoteRefUpdate.Status.REJECTED_NODELETE ||
                            status == RemoteRefUpdate.Status.NON_EXISTING ||
                            status == RemoteRefUpdate.Status.NOT_ATTEMPTED ||
                            status == RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD ||
                            status == RemoteRefUpdate.Status.REJECTED_OTHER_REASON ||
                            status == RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED) {
                                throw new BuildException(String.format("%s - Status '%s'", errorPrefix, status.name()));
                        }
                }
        }
905532
void removeEQ(Object o) {
        final ReentrantLock lock = this.lock;
        lock.lock();
        try {
            for (Iterator<E> it = q.iterator(); it.hasNext(); ) {
                if (o == it.next()) {
                    it.remove();
                    break;
                }
            }
        } finally {
            lock.unlock();
        }
    }
12061
private static void purgeQueue() {

        ChronoReference cref;

        while ((cref = (ChronoReference) QUEUE.poll()) != null) {
            for (ChronoReference test : CHRONOS) {
                if (test.name.equals(cref.name)) {
                    CHRONOS.remove(test);
                    break;
                }
            }
        }

    }
785412
public void complete(VirtualConnection vc, TCPReadRequestContext rsc) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "complete() called: vc=" + vc);
        }
        HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
        mySC.continueRead();
    }
1088342
protected Object common_remove(Object key) {

        // CPF_CODE_REVIEW - Should this be cache.getEntryFromMemory() ??
        // CPF_CODE_REVIEW - Since we are going to invalidate anyway,
        // why go to the remote??

        ValidateUtility.objectNotNull(key, "key");
        Object old = get(key);
        cache.invalidateById(key, true);
        return old;
    }
507161
public void cancel(String[] protocol, int[] reasonCode, String[] reasonText) {
		if(proxy.getAckReceived()) throw new IllegalStateException("There has been an ACK received on this branch. Can not cancel.");
		
		try {			
			cancelTimer();
			if(this.isStarted() && !canceled && !timedOut &&
					(outgoingRequest.getMethod().equalsIgnoreCase(Request.INVITE) ||
							// https://code.google.com/p/sipservlets/issues/detail?id=253
							outgoingRequest.getMethod().equalsIgnoreCase(Request.PRACK) ||
							// https://code.google.com/p/sipservlets/issues/detail?id=33
							outgoingRequest.getMethod().equalsIgnoreCase(Request.UPDATE))) {
				if(lastResponse != null) { /* According to SIP RFC we should send cancel only if we receive any response first*/
					if(logger.isDebugEnabled()) {
						logger.debug("Trying to cancel ProxyBranch for outgoing request " + outgoingRequest);
					}
					if(lastResponse.getStatus() > Response.OK && !recursedBranches.isEmpty()) {
						//  Javadoc says it should throw an java.lang.IllegalStateException if the transaction has already been completed and it has no child branches
						if(logger.isDebugEnabled()) {
							logger.debug("lastResponse status for this branch is " + lastResponse.getStatus() + " and it has " + recursedBranches.size() + " to cancel");
						}
						return;
					}
					SipServletRequest cancelRequest = null;
					if(outgoingRequest.getMethod().equalsIgnoreCase(Request.PRACK) || outgoingRequest.getMethod().equalsIgnoreCase(Request.UPDATE)) {
						// https://code.google.com/p/sipservlets/issues/detail?id=253 and https://code.google.com/p/sipservlets/issues/detail?id=33
						// in case of PRACK or UPDATE we need to take the original INVITE
						cancelRequest = originalRequest.getLinkedRequest().createCancel();
					} else {
						cancelRequest = outgoingRequest.createCancel();
					}
					
					//https://code.google.com/p/sipservlets/issues/detail?id=272 Adding reason headers if needed
					if(protocol != null && reasonCode != null && reasonText != null
							&& protocol.length == reasonCode.length && reasonCode.length == reasonText.length) {
						for (int i = 0; i < protocol.length; i++) {
							String reasonHeaderValue = protocol[i] + ";cause=" + reasonCode[i];
							if(reasonText[i] != null && reasonText[i].trim().length() > 0) {
								reasonHeaderValue = reasonHeaderValue.concat(";text=\"" + reasonText[i] + "\"");
							}
							((SipServletRequestImpl)cancelRequest).setHeaderInternal("Reason", reasonHeaderValue, false);
							
						}
					}
					cancelRequest.send();
				} else {
					// We dont send cancel, but we must stop the invite retrans
					SIPClientTransaction tx = (SIPClientTransaction) outgoingRequest.getTransaction();
					
					if(tx != null) {
						StaticServiceHolder.disableRetransmissionTimer.invoke(tx);
						//disableTimeoutTimer.invoke(tx);
					} else {
						logger.warn("Transaction is null. Can not stop retransmission, they are already dead in the branch.");
					}
					/*
					try {
						//tx.terminate();
						// Do not terminate the tx here, because com.bea.sipservlet.tck.agents.spec.ProxyTest.testProxyCancel test is failing. If the tx
						// is terminated 100 Trying is dropped at JSIP.
					} catch(Exception e2) {
						logger.error("Can not terminate transaction", e2);
					}*/

				}
				canceled = true;
			}
			if(!this.isStarted() &&
					(outgoingRequest.getMethod().equalsIgnoreCase(Request.INVITE) ||
							// https://code.google.com/p/sipservlets/issues/detail?id=253
							outgoingRequest.getMethod().equalsIgnoreCase(Request.PRACK))) {
				canceled = true;	
			}
		}
		catch(Exception e) {
			throw new IllegalStateException("Failed canceling proxy branch", e);
		} finally {
			onBranchTerminated();
		}
			
	}
1231680
public void cleanUpState(VirtualConnection vc) {
        // if discrimination returned MAYBE, then we stored a link object that
        // now needs to be cleaned up
        HttpInboundLink link = (HttpInboundLink) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPICL);
        if (null != link) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Performing cleanup after discrim MAYBE");
            }
            link.destroy(null);
        }
    }
904763
@ManagedOperation
    public void remove(K key, boolean synchronous) {
        try {
            disp.callRemoteMethods(null, new MethodCall(REMOVE, key),
                                   new RequestOptions(synchronous? ResponseMode.GET_ALL : ResponseMode.GET_NONE, call_timeout));
            if(l1_cache != null)
                l1_cache.remove(key);
        }
        catch(Throwable t) {
            if(log.isWarnEnabled())
                log.warn("remove() failed", t);
        }
    }
539803
function wrapRemoteCache(remoteCache) {
    return {
        get: function (key) {
            var deferred = Q.defer();

            remoteCache.get(key, function (err, value) {
                if (err) {
                    console.log('redis remoteCache.get err ' + err);
                    deferred.resolve();
                }

                if (_.isString(value) && value.charAt(0) === '{') {
                    value = JSON.parse(value);
                }

                deferred.resolve(value);
            });

            return deferred.promise;
        },
        set: function (key, value) {
            value = _.isObject(value) ? JSON.stringify(value) : value;
            remoteCache.set(key, value);
            remoteCache.expire(key, 3600);
        },
        del: function (key) {
            remoteCache.del(key);
        },
        quit: function () {
            remoteCache.quit();
        },
        flush: function () {
            remoteCache.flushdb();
        }
    };
}
193675
def _resume_sm(self, remote_ctr):
        
        self._logger.info("resuming SM stream with remote_ctr=%d", remote_ctr)
        # remove any acked stanzas
        self.sm_ack(remote_ctr)
        # reinsert the remaining stanzas
        for token in self._sm_unacked_list:
            self._active_queue.putleft_nowait(token)
        self._sm_unacked_list.clear()
262040
public void processAckExpected(ControlAckExpected ackExpMsg) throws SIResourceException 
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "processAckExpectedMessage", new Object[] { ackExpMsg });
    
    int priority = ackExpMsg.getPriority().intValue();
    Reliability reliability = ackExpMsg.getReliability();
    
    SIBUuid12 streamID = ackExpMsg.getGuaranteedStreamUUID();
    StreamSet streamSet = getStreamSet(streamID, true);
  
    InternalInputStream internalInputStream = null;
    synchronized(streamSet)
    {
      internalInputStream = (InternalInputStream) streamSet.getStream(priority, reliability);        

      // This may be the first message which has required this stream    
      if(internalInputStream == null && 
      (reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0))
      {
        internalInputStream = createStream(streamSet, priority, reliability);      
      }
    }
        
    internalInputStream.processAckExpected(ackExpMsg.getTick());
        
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "processAckExpectedMessage");
  }
1196400
@Override
    public void clear() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Clearing ISC: " + this);
        }
        super.clear();
        this.bCheckedAcceptEncoding = false;
        this.bContainsLargeMessage = false;
        this.remoteUser = "";
        this.forwardedHeaderInitialized = false;
        this.forwardedHost = null;
        this.forwardedProto = null;
        this.forwardedRemoteAddress = null;
        this.forwardedRemotePort = -1;
        if (getHttpConfig().runningOnZOS()) {
            // @311734 - clean the statemap of the final write mark
            getVC().getStateMap().remove(HttpConstants.FINAL_WRITE_MARK);
        }
    }
728572
def do_clearrep(self, line):
        
        self._split_args(line, 0, 0)
        self._command_processor.get_session().get_replication_policy().clear()
        self._print_info_if_verbose("Cleared the replication policy")
32301
private void clean(Connection conn) {
        this.selectColumns = null;
        this.isSQLLimit = false;
        this.orderBySQL = new StringBuilder();
        this.conditionSQL = new StringBuilder();
        this.paramValues.clear();
        this.excludedColumns.clear();
        this.updateColumns.clear();

        ifThen(localConnection.get() == null && conn != null,
                () -> conn.close());
    }
1273930
@Override
    public void setRemoteServices(RemoteServices remoteServices) {
        final String methodName = "setRemoteServices(remoteServices)";
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called");
        }
    }
151715
boolean cleanupLocalisations() throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "cleanupLocalisations");

        // true if all localisations have been cleaned up successfully
        boolean allCleanedUp = true;

        // True if we determine calling reallocation is appropriate
        boolean reallocationCanBeCalled = false;

        //Check the destination has not already been deleted first
        if (!isDeleted())
        {
            synchronized (this) //Stop cleanup happening while the destination is being altered
            {
                //synchronizes with updateLocalisationSet
                //If the entire destination is to be deleted
                //then all the localisations are to be deleted.
                // 448943 Remove a check for !isReconciled - We dont need this
                if (isToBeDeleted())
                {
                    addAllLocalisationsForCleanUp();
                }

                allCleanedUp = _protoRealization.cleanupPremediatedItemStreams();

                if (!isPubSub())
                {
                    //If the entire destination is being deleted, clean up the remote get
                    //infrastructure
                    if (isToBeDeleted())
                    {
                        boolean remoteGetCleanup = _ptoPRealization.cleanupLocalisations();
                        if (allCleanedUp)
                            allCleanedUp = remoteGetCleanup;
                    }
                    else
                    {
                        // PK57432 We are not deleting the destination. Just perform
                        // any other localisation cleanup
                        reallocationCanBeCalled = true;
                    }
                }
                else
                {
                    // For pub/sub, we'll want to remove any infrastructure associated with
                    // durable subscriptions since these are implemented as queue-like localizations.
                    if (isToBeDeleted())
                    {
                        boolean pubSubCleanedUp = _pubSubRealization.cleanupLocalisations();
                        if (allCleanedUp)
                            allCleanedUp = pubSubCleanedUp;
                    }
                    else
                    {
                        // We are not deleting the destination. Just perform
                        // any other localisation cleanup
                        reallocationCanBeCalled = true;
                    }
                }

            }
        }

        // PK57432 We must not hold any locks when we reallocate.
        if (reallocationCanBeCalled)
        {
            boolean syncReallocRequiredCheck;
            synchronized (this) {
                syncReallocRequiredCheck = _isToBeReallocated;
                _isToBeReallocated = false;
            }
            if (syncReallocRequiredCheck)
                reallocateTransmissionStreams(null);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "cleanupLocalisations", Boolean.valueOf(allCleanedUp));

        return allCleanedUp;
    }