Method removeStateItemStreams.
<p>This removes the state itemstreams associated with the link.
@param transaction
@throws SIStoreException
421086
private void removeStateItemStreams(Transaction transaction)
    throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "removeStateItemStreams", transaction );

    try
    {
      // Clean up mqlink state stream. This is a raw itemstream so
      // we do this "by hand". 
      if( _mqLinkStateItemStream != null && _mqLinkStateItemStream.isInStore()) 
      {
        Item item = null;
    
        while (null != (item = _mqLinkStateItemStream.findFirstMatchingItem(null)))
        {
          item.remove(transaction, NO_LOCK_ID);
        }
        
        // Now remove the itemstream itself
        _mqLinkStateItemStream.remove(transaction, NO_LOCK_ID);        
      }
      
      // Clean up pubsub bridge state itemstream.
      // Note that pubsub bridge should already have tidied up contained
      // itemstreams. This does a final tidy and removes the state itemstream
      // itself.  Must check that this is not in store as we may have the item stream
      // from a previous failed delete
      if( _mqLinkPubSubBridgeItemStream != null && _mqLinkPubSubBridgeItemStream.isInStore()) 
      {
        _mqLinkPubSubBridgeItemStream.removeAll(transaction);
      }
      
      // Set refs to null removed as we may fail the delete later.
//      _mqLinkStateItemStream = null;
//      _mqLinkPubSubBridgeItemStream = null;  
    }
    catch (MessageStoreException e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.MQLinkHandler.removeStateItemStreams",
        "1:910:1.71",
        this);

      SibTr.exception(tc, e);

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

      throw new SIResourceException(e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "removeStateItemStreams");
  }
1052584
public function removeItems(Transaction $transaction)
    {
        $qb = $this->getItemQueryBuilder()
            ->delete()
            ->where('i.transaction = :transaction')
            ->setParameter('transaction', $transaction);

        $qb->getQuery()->execute();
    }
1188428
public boolean remove(T transaction, I item) {
		return matrix.remove(transactionToIndex(transaction), itemToIndex(item));
	}
1248819
@Override
    public synchronized ChainData removeChain(ChainData chain) throws ChainException {
        String chainName = (null != chain) ? chain.getName() : null;
        String entryMsg = "removeChain: " + chainName;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, entryMsg);
        }
        if (null == chain) {
            throw new InvalidChainNameException("Input chain is null");
        }

        // Verify this chain does exist
        if (!chainDataMap.containsKey(chainName)) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                // Due to timing windows (i.e. multiple channel providers going away), there is
                // a race to stop and/or clean up chains. This is not a notable condition: the chain can only be removed
                // once.
                Tr.exit(tc, entryMsg, "Chain not found");
            }
            return null;
        }

        removeChainInternal(chain);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, entryMsg);
        }
        return chain;
    }
1059927
public final void abortPersistLock(PersistentTransaction transaction) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "abortPersistLock", transaction);

        synchronized (this)
        {
            if (ItemLinkState.STATE_PERSISTING_LOCK == _itemLinkState)
            {
                _assertCorrectTransaction(transaction);
                _itemLinkState = ItemLinkState.STATE_LOCKED;
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "abortPersistLock");
                throw new StateException(_itemLinkState.toString());
            }
            _transactionId = null;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "abortPersistLock");
    }
1194573
final public void delete(Transaction t) {
		t.delete(Utils.getTableName(getClass()), Utils.getWhereStatement(this));
        t.addOnTransactionCommittedListener(new OnTransactionCommittedListener() {

            @Override
            public void onTransactionCommitted() {
                Sprinkles.sInstance.mContext.getContentResolver().notifyChange(
                        Utils.getNotificationUri(Model.this.getClass()), null);
            }
        });
		afterDelete();
	}
392953
public final void commitPersistUnlock(PersistentTransaction transaction) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "commitPersistUnlock", transaction);

        AbstractItem item = null;
        boolean hasBecomeAvailable = false;
        boolean linkHasBecomeReleasable = false;
        synchronized (this)
        {
            if (ItemLinkState.STATE_UNLOCKING_PERSISTENTLY_LOCKED == _itemLinkState)
            {
                _assertCorrectTransaction(transaction);

                item = getItem();

                ListStatistics stats = getParentStatistics();
                synchronized (stats)
                {
                    stats.decrementLocked();
                    stats.incrementAvailable();
                }

                // Save the item before we change the state
                _lockID = NO_LOCK_ID;
                _unlockCount++;
                linkHasBecomeReleasable = _declareDiscardable();
                _itemLinkState = ItemLinkState.STATE_AVAILABLE;
                hasBecomeAvailable = true;
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "commitPersistUnlock");
                throw new StateException(_itemLinkState.toString());
            }
            _transactionId = null;
        }
        // this stuff has to be done outside the synchronized block
        if (linkHasBecomeReleasable)
        {
            _declareReleasable(item);
        }

        // PK37596
        // Now we have completed an unlock we have become available again
        // and so need to inform our containing list in case we need to
        // be added to a cursors jumpback list.
        if (hasBecomeAvailable)
        {
            // all items are discardable in avaialable state.
            if (_owningStreamLink != null)
            {
                _owningStreamLink.linkAvailable(this);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "commitPersistUnlock");
    }
1280873
public void remove(ItemState item)
   {
      if (item.isNode())
      {
         remove(item.getData().getQPath());
      }
      else 
      {
         removeProperty(item, -1);
      }
   }
113140
@Override
    public void eventPostRollbackRemove(Transaction transaction) throws SevereMessageStoreException
    {
        super.eventPostRollbackRemove(transaction);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "eventPostRollbackRemove",
                        new Object[] { transaction });

        if (failedInitInRestore)
        {
            //we can only register the listeners if we are fully initialized
            if (stream instanceof DurableSubscriptionItemStream)
            {
                stream.registerListeners(this);
            }
            failedInitInRestore = false;
        }

        /**
         * Message was rolled back. Call the handleUndeliverableMessage routine on the
         * consumer. This may or may not redirect the message depending on the cicumstances
         * of the delivery
         */

        // TODO : wrap in an if statement ?

        // consumerPoint.handleUndeliverableMessage(this, null);                                 

        try
        {
            if (POST_ROLLBACK_REMOVE_4 != null)
            {
                POST_ROLLBACK_REMOVE_4.messageEventOccurred(MessageEvents.POST_ROLLBACK_REMOVE, this, transaction);
            }
            if (POST_ROLLBACK_REMOVE_3 != null)
            {
                POST_ROLLBACK_REMOVE_3.messageEventOccurred(MessageEvents.POST_ROLLBACK_REMOVE, this, transaction);
            }
            if (POST_ROLLBACK_REMOVE_2 != null)
            {
                POST_ROLLBACK_REMOVE_2.messageEventOccurred(MessageEvents.POST_ROLLBACK_REMOVE, this, transaction);
            }
            if (POST_ROLLBACK_REMOVE_1 != null)
            {
                POST_ROLLBACK_REMOVE_1.messageEventOccurred(MessageEvents.POST_ROLLBACK_REMOVE, this, transaction);
            }
        } catch (SIException e)
        {
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.store.items.MessageItemReference.eventPostRollbackRemove",
                                        "1:553:1.147",
                                        this);

            SibTr.exception(tc, e);

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

            throw new SIErrorException(e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "eventPostRollbackRemove");
    }
632808
public void setMQLinkStateItemStream(ItemStream mqLinkStateItemStream) 
    throws SIException                                      
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "setMQLinkStateItemStream", 
        new Object[]{mqLinkStateItemStream});
      // Test that itemstream has not already been set
      
      if(_mqLinkStateItemStream != null)
      {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
          SibTr.exit(tc, "setMQLinkStateItemStream", "SIIncorrectCallException");
          
        throw new SIIncorrectCallException(
          nls.getFormattedMessage(
            "MQLINK_STATE_ITEMSTREAM_ALREADY_EXISTS",
            null,
            null));
      }      
            
      // Now set the itemstream
      _mqLinkStateItemStream = mqLinkStateItemStream;
     
      // First, create a local transaction
      ExternalAutoCommitTransaction transaction = 
        messageProcessor.getTXManager().createAutoCommitTransaction();
          
      try
      {
        // Try to set the mqlink itemstream.             
        addItemStream(mqLinkStateItemStream, transaction);
        
        // Get the itemstreams id - we'll use this in reconstitution
        _mqLinkStateItemStreamId = mqLinkStateItemStream.getID();
        
        // Prod the MQLinkHandler to persist this id
        requestUpdate(transaction);
      }
      catch (OutOfCacheSpace e)
      {
        // No FFDC code needed
        SibTr.exception(tc, e);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
          SibTr.exit(tc, "setMQLinkStateItemStream", "SIResourceException");
        throw new SIResourceException(e);
      }
      catch (MessageStoreException e)
      {
        // FFDC
        FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.impl.MQLinkHandler.setMQLinkStateItemStream",
          "1:5452:1.341",
          this);
      
        // Map to a core exception  
        SIResourceException eCore =
            new SIResourceException(
              nls.getFormattedMessage(
                "MQLINK_STATE_ITEMSTREAM_MESSAGE_STORE_ERROR",
                null,
                null));   
                
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
          SibTr.exit(tc, "setMQLinkStateItemStream", eCore);
           
        throw eCore;  
      }          

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "setMQLinkStateItemStream");        
      
  }
557326
private boolean cleanLockedObjects(ITransaction transaction,
            LockedObject lo, boolean temporary) {

        if (lo._children == null) {
            if (lo._owner == null) {
                if (temporary) {
                    lo.removeTempLockedObject();
                } else {
                    lo.removeLockedObject();
                }

                return true;
            } else {
                return false;
            }
        } else {
            boolean canDelete = true;
            int limit = lo._children.length;
            for (int i = 0; i < limit; i++) {
                if (!cleanLockedObjects(transaction, lo._children[i], temporary)) {
                    canDelete = false;
                } else {

                    // because the deleting shifts the array
                    i--;
                    limit--;
                }
            }
            if (canDelete) {
                if (lo._owner == null) {
                    if (temporary) {
                        lo.removeTempLockedObject();
                    } else {
                        lo.removeLockedObject();
                    }
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        }
    }
931311
public void removeTransaction(String txId) {
            if(this.transactionMap.remove(txId) != null) {
                    if(logger.isDebugEnabled()) {
                            logger.debug("Transaction "+txId+" removed from proxy.");
                    }
            }
            checkAndCleanProxy();
    }
103877
final void cmdRemoveExpiring(final long lockId, final PersistentTransaction transaction) throws ProtocolException, TransactionException, SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "cmdRemoveExpiring", new Object[] { "Item Link:   " + this, "Stream Link: " + _owningStreamLink, formatLockId(lockId),
                                                                     "Transaction: " + transaction });

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(this, tc, "expiring item " + _tuple.getUniqueId());

        synchronized (this)
        {
            if (ItemLinkState.STATE_LOCKED_FOR_EXPIRY == _itemLinkState)
            {
                if (_lockID != lockId)
                {
                    throw new LockIdMismatch(_lockID, lockId);
                }

                ListStatistics stats = getParentStatistics();
                synchronized (stats)
                {
                    stats.decrementExpiring();
                    stats.incrementRemoving();
                }

                _transactionId = transaction.getPersistentTranId();
                _itemLinkState = ItemLinkState.STATE_REMOVING_EXPIRING;
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "cmdRemoveExpiring");
                throw new StateException(_itemLinkState.toString());
            }
        }
        final Task task = new RemoveLockedTask(this);
        transaction.addWork(task);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "cmdRemoveExpiring");
    }
869789
public void deregisterTransaction(TransactionImpl tran) {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "deregisterTransaction", new Object[] { this, tran });

        _recoveringTransactions.remove(tran);

        if (tc.isEntryEnabled())
            Tr.exit(tc, "deregisterTransaction", _recoveringTransactions.size());
    }
458181
function (connection) {
        delete Transaction.connections[connection.transactionId];
        connection.transactionId = null;
        connection.transactionConfig = null;
    }
806967
@Override
    public void add(ItemStream itemStream, long lockID, Transaction transaction) throws MessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "add", new Object[] { itemStream, transaction });

        if (_rootMembership != null)
        {
            _rootMembership.addItemStream(itemStream, lockID, transaction);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "add");
        }
        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, "add");
            throw msue;
        }
    }
91667
public boolean removeAllItemsWithNoRefCount(Transaction tran) throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "removeAllItemsWithNoRefCount", tran);

        Item item = null;

        boolean deletedItems = false;

        try
        {
            deleteMessageslock.lockInterruptibly();
            /*
             * Loop through all the items and check if they have any reference count.
             * Introduce a new DeliveryDelayDeleteFilter which basically retrieves
             * the messages which are either available or which are locked
             * for delivery delay It is just a marker class.Earlier to
             * delivery delay feature null was being passed
             */
            while (null != (item = findFirstMatchingItem(new DeliveryDelayDeleteFilter())))
            {
                try
                {
                    if (item.getReferenceCount() == 0)
                    {
                        item.remove(tran, NO_LOCK_ID);

                        deletedItems = true;
                    }
                } catch (NotInMessageStore e)
                {
                    // No FFDC code needed
                    SibTr.exception(tc, e);

                    // It is possible that this item has just been removed, log and continue
                }
            }
        } catch (InterruptedException e) {
            // No FFDC code needed
            // code flow may never enter here as nobody would interrupt this thread.
            // aborb interrrput and trace it.
            SibTr.exception(tc, e);

        } catch (MessageStoreException e)
        {
            // // FFDC
            FFDCFilter
                            .processException(
                                              e,
                                              "com.ibm.ws.sib.processor.impl.store.itemstreams.PubSubMessageItemStream.removeAllItemsWithNoRefCount",
                                              "1:840:1.74", this);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "removeAllItemsWithNoRefCount", "SIResourceException");
            throw new SIResourceException(e);
        }

        finally {
            deleteMessageslock.unlock();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "removeAllItemsWithNoRefCount", Boolean.valueOf(deletedItems));
        return deletedItems;
    }