/* (non-Javadoc)
@see com.ibm.ws.sib.msgstore.ItemCollection#removeFirstMatching(com.ibm.ws.sib.msgstore.Filter, com.ibm.ws.sib.msgstore.Transaction)
494994
public final AbstractItem removeFirstMatching(Filter filter, Transaction transaction) throws MessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "removeFirstMatching", new Object[] { filter, transaction});

        PrioritizedList refs = _references();
        AbstractItem item = refs.removeFirstMatching(filter, (PersistentTransaction)transaction);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "removeFirstMatching", item);
        return item;
    }
31796
@Override
    public ItemStream findFirstMatching(Filter filter) throws MessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "findFirstMatching", filter);

        if (_rootMembership != null)
        {
            ItemStream item = _rootMembership.findFirstMatchingItemStream(filter);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "findFirstMatching", item);
            return item;
        }
        else
        {
            MessageStoreUnavailableException msue;
            if (!_startupExceptions.isEmpty())
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Operation not possible as MessageStore failed to start!");
                msue = new MessageStoreUnavailableException("Operation not possible as MessageStore failed to start!", _startupExceptions.get(0));
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Operation not possible as MessageStore is unavailable!");
                msue = new MessageStoreUnavailableException("Operation not possible as MessageStore is unavailable!");
            }

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "findFirstMatching");
            throw msue;
        }
    }
680738
@Override
	public void removeByCommerceOrderId(long commerceOrderId) {
		for (CommerceOrderNote commerceOrderNote : findByCommerceOrderId(
				commerceOrderId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(commerceOrderNote);
		}
	}
788683
public synchronized void removeMPReadTransactions() {
        TransactionTask  task = m_backlog.peekFirst();
        while (task != null && task.getTransactionState().isReadOnly()) {
            task.getTransactionState().setDone();
            flush(task.getTxnId());
            task = m_backlog.peekFirst();
        }
    }
1064151
@Override
	public void removeByG_C(long groupId, long commerceAccountId) {
		for (CommerceOrder commerceOrder : findByG_C(groupId,
				commerceAccountId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(commerceOrder);
		}
	}
359245
@Override
	public void removeByG_A(long groupId, boolean active) {
		for (CommerceCurrency commerceCurrency : findByG_A(groupId, active,
				QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(commerceCurrency);
		}
	}
68936
@Override
  public boolean removeEldestEntry(Map.Entry eldest) {
    boolean mustBeRemoved = this.size() > maxSize;

    if (mustBeRemoved) {
      ServerPrepareResult serverPrepareResult = ((ServerPrepareResult) eldest.getValue());
      serverPrepareResult.setRemoveFromCache();
      if (serverPrepareResult.canBeDeallocate()) {
        try {
          protocol.forceReleasePrepareStatement(serverPrepareResult.getStatementId());
        } catch (SQLException e) {
          //eat exception
        }
      }
    }
    return mustBeRemoved;
  }
757883
static Matcher removeTrueInSequence(Matcher matcher) {
    if (matcher instanceof SeqMatcher) {
      List<Matcher> matchers = matcher.<SeqMatcher>as().matchers();
      List<Matcher> ms = new ArrayList<>();
      for (Matcher m : matchers) {
        if (!(m instanceof TrueMatcher)) {
          ms.add(m);
        }
      }
      return SeqMatcher.create(ms);
    }
    return matcher;
  }
687994
public void removeProtocolItems(TransactionCommon transaction)
    throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "removeProtocolItems", transaction );

    Transaction msTran = _messageProcessor.resolveAndEnlistMsgStoreTransaction(transaction);
    
    try
    {
      //Clean up destination stream state
      if (_targetProtocolItemStream != null)
      {
        _targetProtocolItemStream.removeAll(msTran);
      }
     
      if (_sourceProtocolItemStream != null)
      { 
        _sourceProtocolItemStream.removeAll(msTran);
      }
      
    }
    catch (MessageStoreException e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.destination.AbstractRemoteSupport.removeProtocolItems",
        "1:636:1.25",
        this);

      SibTr.exception(tc, e);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "removeProtocolItems", e);

      throw new SIResourceException(e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "removeProtocolItems");
  }
43299
public boolean remove( LocalSession localSession , TransactionItem[] items ) throws JMSException
    {
    	checkNotClosed();
    	checkTransactionLock();
    	
    	int volatileCommitted = 0;
    	int persistentCommitted = 0;
    	
        synchronized (storeLock)
        {
    		for (int n = 0 ; n < items.length ; n++)
            {
    			TransactionItem transactionItem = items[n];
            	if (transactionItem.getDestination() != this)
            		continue;
            	
            	if (traceEnabled)
                	log.trace(localSession+" COMMIT "+transactionItem.getMessageId());
            	
            	// Delete message from store
            	if (transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT)
            	{
            		persistentStore.delete(transactionItem.getHandle());
            		persistentCommitted++;
            	}
            	else
            	{
            		volatileStore.delete(transactionItem.getHandle());
            		volatileCommitted++;
            	}
            }
        }
        acknowledgedGetCount.addAndGet(volatileCommitted + persistentCommitted);
        
        if (persistentCommitted > 0 && requiresTransactionalUpdate())
        {
        	pendingChanges = true;
        	return true;
        }
        else
        	return false;
    }
219479
List<Configuration> removeMismatching() {
		// List mismatching
		List<InventoryEntry> mismatching = configs.values().stream()
			.filter(v->
				(v.getConfiguration().isPresent()
				&& !v.getIdentifier().equals(v.getConfiguration().get().getDetails().getKey()))
			).collect(Collectors.toList());
		// Remove from inventory
		mismatching.forEach(v->configs.remove(v.getIdentifier()));
		// Return the list of removed configurations 
		return mismatching.stream()
				.map(v->v.getConfiguration().get())
				.collect(Collectors.toList());
	}
67048
public final AbstractItem findFirstMatching(Filter filter) throws MessageStoreException
    {
        AbstractItem item = null;
        for (int priority = Priorities.HIGHEST_PRIORITY; null == item
                && priority >= Priorities.LOWEST_PRIORITY; priority--)
        {
            LinkedList tl = _prioritySublists[priority];
            if (null != tl)
            {
                item = tl.findFirstMatching(filter);
            }
        }
        return item;
    }
119381
public boolean removeThisMessageFilter(BaseMessageFilter filter)
    {
        if (m_filter instanceof BaseMessageFilter)
        {
            if (m_filter != filter) // Should be this one.
                return false;   // Error
            m_filter = null;
            return true;    // Success
        }
        else
            return (((Map)m_filter).remove(filter.getFilterID()) != null);
    }
988591
public final AbstractItem removeFirstMatching(final Filter filter, PersistentTransaction transaction) throws MessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "removeFirstMatching", new Object[] { filter, transaction});

        AbstractItem found = null;

        Link link = getHead();

        while (link != null && found == null)
        {
            found = ((AbstractItemLink)link).removeIfMatches(filter, transaction);

            if (found == null)
            {
                // Defect 493652/PK59872
                // We need to lock on the list at this point as our current link
                // may have been unlinked by another thread during the matches() 
                // call. In that case we need to start at the head of the list again 
                // as the next/previous pointers for the unlinked link will not be
                // set.
                synchronized(this)
                {
                    if (link.isPhysicallyUnlinked())
                    {
                        // We have been unlinked while we were doing the match. 
                        // Start again at the beginning of the list.
                        link = getHead();

                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current link is PhysicallyUnlinked so returning to beginning of list.");
                    }
                    else
                    {   
                        link = link.getNextLogicalLink();
                    }
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "removeFirstMatching", found);
        return found;
    }
168982
public final ItemStream findFirstMatchingItemStream(Filter filter) throws MessageStoreException 
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "findFirstMatchingItemStream", filter);

        ItemStream item = (ItemStream) _itemStreams.findFirstMatching(filter);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "findFirstMatchingItemStream", item);
        return item;
    }
401978
@Override
    public boolean removeFirstOccurrence(DelayedEntry incoming) {
        Data incomingKey = (Data) incoming.getKey();
        Object incomingValue = incoming.getValue();

        DelayedEntry current = map.get(incomingKey);
        if (current == null) {
            return false;
        }

        Object currentValue = current.getValue();
        if (incomingValue == null && currentValue == null
                || incomingValue != null && currentValue != null && incomingValue.equals(currentValue)) {
            map.remove(incomingKey);
            return true;
        }

        return false;
    }
609206
void removeFromIndexes(TransactionContext transactionContext, Object key) {
      Stream<IndexedTypeIdentifier> typeIdentifiers = getKnownClasses().stream()
            .filter(searchFactoryHandler::hasIndex)
            .map(PojoIndexedTypeIdentifier::new);
      Set<Work> deleteWorks = typeIdentifiers
            .map(e -> searchWorkCreator.createEntityWork(keyToString(key), e, WorkType.DELETE))
            .collect(Collectors.toSet());
      performSearchWorks(deleteWorks, transactionContext);
   }