Use this method to persist the redelivered count for the item.

@param redeliveredCount
@throws SevereMessageStoreException
184676
public void persistRedeliveredCount(int redeliveredCount) throws SevereMessageStoreException
    {
        Membership thisItemLink = _getMembership();
        if (null == thisItemLink)
        {
            throw new NotInMessageStore();
        }
        thisItemLink.persistRedeliveredCount(redeliveredCount);
    }
57425
public final void append(final AbstractItemLink link) throws SevereMessageStoreException
    {
        if (link.isItemStreamLink())
        {
            _itemStreams.append(link);
        }
        else
        {
            throw new SevereMessageStoreException("Cannot add this directly to message store");
        }
    }
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");
    }
600455
public int countProtocolItems()
    throws MessageStoreException
  {
    if (tc.isEntryEnabled())  
      SibTr.entry(tc, "countProtocolItems");      

    int count = 0;
    
    NonLockingCursor cursor 
      = newNonLockingItemCursor(new ClassEqualsFilter(StreamSet.class));
           
    AbstractItem item = cursor.next();
    while (null != item)
    {
      //ProtocolItem protocolItem = (ProtocolItem)item;
      count++;
      item = cursor.next();
    }
 
    if (tc.isEntryEnabled())  
      SibTr.exit(tc, "countProtocolItems", new Integer(count));
            
    return count;
  }
1196368
protected void cleanup() {

        final String methodName = "cleanup";
        if (TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName);
        }

        if (_unsuccessfulMessages.size() > 0) {

            try {

                // 250710: Fix to workaround the problem where failed messages are
                // unlocked but the retry count is not incremented. Perform a
                // delete on the messages under a transaction and then roll back
                // the transaction - this will cause the messages to be unlocked
                // and have their retry count incremented. If the an exception
                // is thrown during this processing the messages will remain locked.
                try
				{
                	SIUncoordinatedTransaction localTran = _connection.createUncoordinatedTransaction();
                	deleteMessages(getMessageHandles(_unsuccessfulMessages), localTran);
                	localTran.rollback();
				}
                catch (SIException ex)
				{
                    FFDCFilter.processException(ex, CLASS_NAME + "."
                            + methodName, FFDC_PROBE_2, this);
                    if (TRACE.isEventEnabled()) {
                        SibTr.exception(this, TRACE, ex);
                    }
				}
//                unlockMessages(_unsuccessfulMessages);

            } catch (final ResourceException exception) {

                FFDCFilter.processException(exception, CLASS_NAME + "."
                        + methodName, FFDC_PROBE_1, this);
                if (TRACE.isEventEnabled()) {
                    SibTr.exception(this, TRACE, exception);
                }

            } finally {

                _unsuccessfulMessages.clear();

            }

        }

        if (TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName);
        }

    }
393659
@Override
	public void redo(Transaction tx) {
		Buffer buff = tx.bufferMgr().pin(blk);
		buff.setVal(offset, newVal, tx.getTransactionNumber(), null);
		tx.bufferMgr().unpin(buff);
	}
264062
@Override
    public void setJMSRedelivered(boolean arg0) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setJMSRedelivered", arg0);

        if (arg0 == false) {
            // This is well defined.
            msg.setRedeliveredCount(0);
        }
        else {
            // This is quite arbitrary, however the user application only calls
            // this if the want to alter the value after the message has been received,
            // in which case they get what they deserve.
            msg.setRedeliveredCount(1);
        }

        // Invalidate the toString cache
        cachedToString = null;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setJMSRedelivered");
    }
310435
@Override
    public void restore(final List<DataSlice> dataSlices)
                    throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "restore", dataSlices);

        stream = (MessageReferenceStream) getReferenceStream();
        //we can only register the listeners if we are fully initialized
        if (stream instanceof DurableSubscriptionItemStream)
        {
            if (!stream.hasInDoubtItems())
            {
                stream.registerListeners(this);
                failedInitInRestore = false; //Set to false so we don't call it again
            }
            else
            {
                //we are not yet restored due to an indoubt tran.
                //We have to mark that we failed to initialise and do
                //it later when we get a callback
                failedInitInRestore = true;
            }
        }

        // If in-doubt remove, set current active transaction for ordered messaging
        if (isRemoving())
            stream.setCurrentTransaction(this, false);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "restore");
    }
203220
public void reconstitute(BaseDestinationHandler destinationHandler,
                           SIMPTransactionManager txManager)
    throws MessageStoreException
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "reconstitute", new Object[] {destinationHandler, txManager}); 
      
    initializeNonPersistent(destinationHandler, txManager);
        
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "reconstitute");           
  }
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");
    }
1021877
public void redo() {

        if (!m_redo.isEmpty()) {
            m_undo.push(m_current);
            m_current = m_redo.pop();
            changeEntityContentValues(
                m_current.getEntityData(),
                m_current.getEntityId(),
                m_current.getAttributeName(),
                m_current.getValueIndex(),
                m_current.getType());
            fireStateChange();
        }
    }
988641
@Override
    public final long getUniqueTickCount() throws PersistenceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getUniqueTickCount");

        if (_tickCountGenerator != null)
        {
            long key = AbstractItem.NO_ID;

            key = _tickCountGenerator.getUniqueValue();

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "getUniqueTickCount", Long.valueOf(key));
            return key;
        }
        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, "getUniqueTickCount");
            throw msue;
        }
    }
249639
protected final void initializeFromRaw( RawDataBuffer rawMessage )
    {
    	this.rawMessage = rawMessage;
    	this.unserializationLevel = MessageSerializationLevel.BASE_HEADERS;
    	
    	// Only deserialize level 1 headers
    	byte lvl1Flags = rawMessage.readByte();
    	priority     = lvl1Flags & 0x0F;
    	redelivered  = (lvl1Flags & (1 << 4)) != 0;
    	deliveryMode = (lvl1Flags & (1 << 5)) != 0 ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
    	if ((lvl1Flags & (1 << 6)) != 0) expiration = rawMessage.readLong();
    	if ((lvl1Flags & (1 << 7)) != 0) id = rawMessage.readUTF();
    	destination = DestinationSerializer.unserializeFrom(rawMessage);
    }
779899
final void cmdPersistLock(final PersistentTransaction transaction) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "cmdPersistLock", new Object[] { "Item Link:   " + this, "Stream Link: " + _owningStreamLink, "Transaction: " + transaction });

        if (null != transaction)
        {
            boolean hasBecomeNonReleasable = false;
            synchronized (this)
            {
                if (ItemLinkState.STATE_LOCKED == _itemLinkState)
                {
                    _transactionId = transaction.getPersistentTranId();
                    hasBecomeNonReleasable = _declareNotDiscardable(_getAndAssertItem());
                    _itemLinkState = ItemLinkState.STATE_PERSISTING_LOCK;
                }
                else
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                        SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState);
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(this, tc, "cmdPersistLock");
                    throw new StateException(_itemLinkState.toString());
                }
            }
            if (hasBecomeNonReleasable)
            {
                _declareNotReleasable();
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "cmdPersistLock");
    }
82365
public void restore(ObjectInputStream dis, int dataVersion)
  throws SevereMessageStoreException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc, "restore", new Object[] { dis, new Integer(dataVersion) });

    itemStream = (ProtocolItemStream) getItemStream();
    
    persistent = true;    

    try
    {      
      //read back the cellule
      byte[] celluleBytes = new byte[9];
      dis.read(celluleBytes, 0, 9);
      remoteMEUuid = new MessagingEngine(celluleBytes).getUuid();
      
      //read back the streamID
      byte[] streamIDBytes = new byte[12];
      dis.read(streamIDBytes, 0, 12);
      streamID = new SIBUuid12(streamIDBytes);
      
      //read back the destID
      byte[] destIDBytes = new byte[12];
      dis.read(destIDBytes, 0, 12);
      destID = new SIBUuid12(destIDBytes);
      
      //read back the busID
      byte[] busIDBytes = new byte[8];
      dis.read(busIDBytes, 0, 8);
      busID = new SIBUuid8(busIDBytes);
            
      initialData = dis.readLong();
      type = Type.getType(dis.readInt());
      
      //read back the number of subset IDs we should expect
      int numberOfSubsets = dis.readInt();
      
      // Now we've restored our persistent data, we can initialise the set.
      initialize();
      
      ReliabilitySubset[] newSubsets = new ReliabilitySubset[numberOfSubsets];
      long[] newSubsetIDs = new long[numberOfSubsets];
      
      //now go find all of the stored subsets via their IDs
      for(int i=0;i<numberOfSubsets;i++)
      {
        //get the next ID
        long subsetID = dis.readLong();
        //get the next reliability
        Reliability reliability = Reliability.getReliability(dis.readInt());
        //if the subset was properly stored, we will have a valid ID
        if(subsetID != NO_ID)
        {
          //find the subset via it's ID
          ReliabilitySubset subset = (ReliabilitySubset) getItemStream().findById(subsetID);
          if(subset != null)
          {
            //set the reliability
            subset.setReliability(reliability);
            //store the subset in a temporary array
            newSubsets[getIndex(reliability)] = subset;
          }
          else
          {
            //if we didn't find it, set the ID to NO_ID so that it will get recreated below.
            subsetID = NO_ID;
          }
        }        
        newSubsetIDs[i] = subsetID;
      }
      
      int j = 0;
      while(j<numberOfSubsets && newSubsetIDs[j] == NO_ID)
      {
        j++;
      }

      //loop through the current array of subsets
      for(int i=0;i<maxReliabilityIndex+1;i++)
      {
        //get the next restored subset
        ReliabilitySubset subset = null;
        Reliability reliability = null;
        if(j<numberOfSubsets)
        {
          subset = newSubsets[j];
          reliability = subset.getReliability();
        }
        //if it's reliability matches that of the current entry of the array
        if( reliability == getReliability(i))
        {
          //store the restored subset in the array
          subsets[i] = subset;
          subsetIDs[i] = newSubsetIDs[j++];
          //find the next valid restored subset
          while(j<numberOfSubsets && newSubsetIDs[j] == NO_ID)
          {
            j++;
          }
        }
      }
      
      //SIB0105.mp.6
      if (dataVersion >= PERSISTENT_VERSION)
        linkTarget = (String)dis.readObject();
    }
    catch (Exception e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.gd.StreamSet.restore",
        "1:680:1.67",
        this);

      SibTr.exception(tc, e);
      SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
        new Object[] {
          "com.ibm.ws.sib.processor.gd.StreamSet",
          "1:687:1.67",
          e });
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restore", "SIErrorException");
      
      throw new SIErrorException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0002",
          new Object[] {
            "com.ibm.ws.sib.processor.gd.StreamSet",
            "1:697:1.67",
            e },
          null),
        e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "restore");
  }
2520
protected void redeliverMessage( AbstractMessage msg , MessageStore store , int handle )
    {
    	try
    	{
	    	synchronized (storeLock)
	        {
		    	// Unlock message in store
		   		store.unlock(handle);
		   		if (traceEnabled)
		        	log.trace("(Deferred) UNLOCKED "+msg.getJMSMessageID());
	        }
	    	
	    	// Dispatch notification
	    	sendAvailabilityNotification(msg);
    	}
    	catch (JMSException e)
    	{
    		ErrorTools.log(e, log);
    	}
    }
1243962
public final void initialize() throws PersistenceException, SevereMessageStoreException
    {
        PersistentMessageStore pm = _messageStore.getPersistentMessageStore();
        final HashMap tupleMap = _buildTupleMap(pm);
        _buildStreamTree(tupleMap);
        _recoverStreamsWithInDoubts(pm);
    }