/*
(non-Javadoc)

@see com.ibm.ws.sib.processor.impl.interfaces.MessageEventListener#eventPostCommitRemove(com.ibm.ws.sib.processor.impl.interfaces.SIMPMessage,
com.ibm.ws.sib.msgstore.Transaction)
495004
protected void eventPostCommitRemove(SIMPMessage msg, TransactionCommon transaction)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "eventPostCommitRemove", new Object[] { msg, transaction });

        // NB: ideally this would go in afterCompletion but we
        // dont have the transaction reference to register for the callback
        synchronized (orderLock)
        {

            // Remove the transaction from the transactionSet if applicable
            // Use the orderLock to synch with attachConsumer
            if (transactionSet != null)
            {
                transactionSet.remove(transaction.getPersistentTranId());
                if (transactionSet.isEmpty())
                {
                    transactionSet = null;
                    // Get the consumer and resume it
                    consumerPoints.get(0).
                                    getConsumerPoint().
                                    resumeConsumer(DispatchableConsumerPoint.SUSPEND_FLAG_INITIAL_INDOUBTS);
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "eventPostCommitRemove");
    }
580359
public void moveMessage(boolean discard)
    throws SIMPControllableNotFoundException,
           SIMPRuntimeOperationFailedException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "moveMessage", new Object[] { Boolean.valueOf(discard) });

    assertValidControllable();

    LocalTransaction tran = _txManager.createLocalTransaction(false);
    SIMPMessage msg = null;
    try
    {
      msg = getSIMPMessage();
    }
    catch (SIResourceException e)
    {
      // No FFDC code needed    
      SIMPRuntimeOperationFailedException finalE =
        new SIMPRuntimeOperationFailedException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0003",
            new Object[] {"QueuedMessage.moveMessage",
                          "1:473:1.66",
                          e,
                          Long.toString(_messageID)},
            null), e,
            "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {Long.toString(_messageID)});
  
      SibTr.exception(tc, finalE);
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
        SibTr.exit(tc, "moveMessage", finalE);
      throw finalE;
    } 
    if(!discard)
    { 
      try
      {
        copyMessageToExceptionDestination(tran);  
      }
      catch (Exception e)
      {
        // No FFDC code needed 
        SIMPRuntimeOperationFailedException finalE =
          new SIMPRuntimeOperationFailedException(e);
        
        SibTr.exception(tc, finalE);
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
          SibTr.exit(tc, "moveMessage", finalE);
        throw finalE; 
      }

      discard = true;
    }
    
    if (discard)
    {      
      try
      {
        if(msg.isInStore())
        {
          if(msg.getLockID()==AbstractItem.NO_LOCK_ID)
          {
            //lock the message
            // Cache a lock ID to lock the items with          
            long lockID = _messageProcessor.getMessageStore().getUniqueLockID(AbstractItem.STORE_NEVER);
            msg.lockItemIfAvailable(lockID);
          }
          Transaction msTran = _messageProcessor.resolveAndEnlistMsgStoreTransaction(tran);
          msg.remove(msTran, msg.getLockID());  
        }
      }
      catch (Exception e)
      {
        // No FFDC code needed
        
        SIMPRuntimeOperationFailedException finalE = null;
        
        boolean adding = false;
        boolean removing = false;      
        
        if (msg instanceof MessageItem)
        {
          adding = ((MessageItem)msg).isAdding();
          removing = ((MessageItem)msg).isRemoving();
        }
        else
        {
          adding = ((MessageItemReference)msg).isAdding();
          removing = ((MessageItemReference)msg).isRemoving();          
        }
        
        if (adding)
        {
          // If the message is adding it probably means that 
          // we have an indoubt transaction which hasn't been committed
          finalE =
            new SIMPRuntimeOperationFailedException(
              nls.getFormattedMessage(
                "MESSAGE_INDOUBT_WARNING_CWSIP0361",
                new Object[] {Long.toString(_messageID),
                              _destinationHandler.getName()},
                null), 
              e,
              "MESSAGE_INDOUBT_WARNING_CWSIP0361", new Object[] {Long.toString(_messageID),
                _destinationHandler.getName() });          
        }         
        else if (removing)
        {
          // If the message is deleting it probably means that 
          // we have delivered the message to a consumer
          finalE =
            new SIMPRuntimeOperationFailedException(
              nls.getFormattedMessage(
                "MESSAGE_INDOUBT_WARNING_CWSIP0362",
                new Object[] {Long.toString(_messageID),
                              _destinationHandler.getName()},
                null), 
              e,
              "MESSAGE_INDOUBT_WARNING_CWSIP0362", new Object[] { Long.toString(_messageID),
                  _destinationHandler.getName() });          
        }         
        else
        {
          // Unexpected exception
          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.runtime.QueuedMessage.moveMessage",
            "1:579:1.66",
            this);
    
          finalE =
            new SIMPRuntimeOperationFailedException(
              nls.getFormattedMessage(
                "INTERNAL_MESSAGING_ERROR_CWSIP0003",
                new Object[] {"QueuedMessage.removeMessage",
                              "1:587:1.66",
                              e,
                              Long.toString(_messageID)},
                null), e,
                "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] { Long.toString(_messageID)});
        }
        
        try
        {
          tran.rollback();
        }
        catch (SIException ee)
        {
          FFDCFilter.processException(
            ee,
            "com.ibm.ws.sib.processor.runtime.QueuedMessage.moveMessage",
            "1:603:1.66",
            this);
          
          SibTr.exception(tc, ee);
        }
        

        SibTr.exception(tc, finalE);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
          SibTr.exit(tc, "moveMessage", finalE);
        throw finalE;             
      }
    }
    try
    {
      tran.commit();
    }
    catch (SIException e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.runtime.QueuedMessage.moveMessage",
        "1:625:1.66",
        this);

      SIMPRuntimeOperationFailedException finalE =
        new SIMPRuntimeOperationFailedException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0003",
            new Object[] {"QueuedMessage.removeMessage",
                          "1:633:1.66",
                          e,
                          Long.toString(_messageID)},
            null), e,
            "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {Long.toString(_messageID)});

      SibTr.exception(tc, finalE);
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "moveMessage", finalE);
      throw finalE;
    }   
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "moveMessage"); 
  }
729298
public void batchCommitted()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "batchCommitted");
      
    if (batchSendList.size() != 0)
    {
      try
      {
        sendMsgs(batchSendList, false);
      }
      catch (SIResourceException e)
      {
        //FFDC
        FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.gd.SourceStream.batchCommitted",
          "1:2590:1.138",
          this);

        SibTr.exception(tc, e);
      }
    }
    
    // Empty list ready for use by next batch
    batchList.clear();
    batchSendList.clear();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "batchCommitted");
  }
531025
public void messageEventOccurred(int event,
                                   SIMPMessage msg,
                                   TransactionCommon tran) throws SIResourceException 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "messageEventOccurred", new Object[]{new Integer(event),msg,tran});

    if(event == MessageEvents.POST_COMMITTED_TRANSACTION)
    {
      eventPostCommit(msg);
    }
    else if(event == MessageEvents.POST_COMMIT_ADD)
    {
      eventPostAdd(msg, tran, false);
    }
    else if(event == MessageEvents.POST_ROLLBACK_ADD)
    {
      eventPostAdd(msg, tran, true);
    }
    else
    {
      SIErrorException e = new SIErrorException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0001",
          new Object[] {
            "com.ibm.ws.sib.processor.impl.PtoPOutputHandler",
            "1:1275:1.241" },
          null));

      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.messageEventOccurred",
        "1:1281:1.241",
        this);

      SibTr.exception(tc, e);
      SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
        new Object[] {
          "com.ibm.ws.sib.processor.impl.PtoPOutputHandler",
          "1:1288:1.241" });

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

      throw e;
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "messageEventOccurred");
  }
1294915
@Override
    public SIBusMessage[] processMsgSet(SIMessageHandle[] msgHandles,
                                        TransactionCommon transaction,
                                        BifurcatedConsumerSessionImpl owner,
                                        boolean unlock,
                                        boolean delete,
                                        boolean read,
                                        boolean incrementLockCount)

                    throws SISessionUnavailableException, SIMPMessageNotLockedException, SIConnectionLostException, SIIncorrectCallException, SIResourceException, SIErrorException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "processMsgSet",
                        new Object[] { this,
                                      SIMPUtils.messageHandleArrayToString(msgHandles),
                                      transaction,
                                      owner,
                                      Boolean.valueOf(unlock),
                                      Boolean.valueOf(delete),
                                      Boolean.valueOf(read) });

        // Do a dirty read of the (volatile) closed/closing states to avoid the synch block if poss
        if (_closed || _closing)
        {
            this.lock();
            try
            {
                checkNotClosed();
            } finally
            {
                this.unlock();
            }
        }

        int numMsgs = 0;
        SIBusMessage messages[] = null;

        if (msgHandles != null && msgHandles.length > 0)
            numMsgs = msgHandles.length;

        if (numMsgs > 0)
        {
            // Actually process the message Ids
            messages = _allLockedMessages.processMsgSet(msgHandles, transaction, owner, unlock, delete, read, incrementLockCount);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "processMsgSet", messages);

        return messages;
    }
1263739
public void postCommit(boolean retainValues, boolean detachAllOnCommit) {
		int logSizeObjBefore = objs.size();
		long t1 = System.nanoTime();
		//TODO later: empty cache (?)
		
		if (!deletedObjects.isEmpty()) {
			for (ZooPC co: deletedObjects.values()) {
				if (co.jdoZooIsDeleted()) {
					objs.remove(co.jdoZooGetOid());
					co.jdoZooGetContext().notifyEvent(co, ZooInstanceEvent.POST_DELETE);
				}
			}
		}
		
		if (detachAllOnCommit) {
			detachAllOnCommit();
		} else if (retainValues) {
			if (!dirtyObjects.isEmpty()) {
				for (ZooPC co: dirtyObjects) {
					if (!co.jdoZooIsDeleted()) {
						co.jdoZooMarkClean();
					}
				}
			}
		} else {
			if (objs.size() > 100000) {
				LOGGER.warn("Cache is getting large. Consider retainValues=true"
						+ " to speed up and avoid expensive eviction.");
			}
            for (ZooPC co: objs.values()) {
                if (retainValues || co instanceof ZooClassDef) {
                    co.jdoZooMarkClean();
                } else {
                    co.jdoZooEvict();
                }
                co.jdoZooGetContext().notifyEvent(co, ZooInstanceEvent.POST_STORE);
            }
		}
		dirtyObjects.clear();
		deletedObjects.clear();
		
		//generic objects
		if (!dirtyGenObjects.isEmpty()) {
	        for (GenericObject go: dirtyGenObjects) {
	        	if (go.jdoZooIsDeleted()) {
	        		genericObjects.remove(go.getOid());
	        		continue;
	        	}
	        	go.jdoZooMarkClean();
	        }
		}
		if (!genericObjects.isEmpty()) {
	        for (GenericObject go: genericObjects.values()) {
	        	if (!retainValues) {
	        		go.jdoZooMarkHollow();
	        	}
	        }
		}
        dirtyGenObjects.clear();

        //schema
		Iterator<ZooClassDef> iterS = schemata.values().iterator();
		for (; iterS.hasNext(); ) {
			ZooClassDef cs = iterS.next();
			if (cs.jdoZooIsDeleted()) {
				iterS.remove();
        		nodeSchemata.get(cs.jdoZooGetNode()).remove(cs.getJavaClass());
				continue;
			}
			//keep in cache???
			cs.jdoZooMarkClean();  //TODO remove if cache is flushed -> retainValues!!!!!
		}
		
		if (Session.LOGGER.isInfoEnabled()) {
			int logSizeObjAfter = objs.size();
			long t2 = System.nanoTime();
			Session.LOGGER.info("ClientCache.postCommit() -- Time= {} ns; Cache size before/after: {} / {}", 
					(t2-t1), logSizeObjBefore, logSizeObjAfter);
		}
	}
396737
protected void eventPostRollbackRemove(
                                           SIMPMessage msg,
                                           TransactionCommon transaction) throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "eventPostRollbackRemove",
                        new Object[] { msg, transaction });

        // NB: ideally this would go in afterCompletion but we
        // dont have the transaction reference to register for the callback
        synchronized (orderLock)
        {

            // Remove the transaction from the transactionSet if applicable
            // Use the orderLock to synch with attachConsumer
            if (transactionSet != null)
            {
                transactionSet.remove(transaction.getPersistentTranId());
                if (transactionSet.isEmpty())
                {
                    transactionSet = null;
                    // Get the consumer and resume it
                    consumerPoints.get(0).
                                    getConsumerPoint().
                                    resumeConsumer(DispatchableConsumerPoint.SUSPEND_FLAG_INITIAL_INDOUBTS);
                }
            }
        }

        // 174107.1
        // Msgstore state model shows that rollback moves to locked state (IF the message
        // was removed under a lock).
        // We must explicitly unlock the message before finding a new consumer.
        try
        {
            if (!msg.isPersistentlyLocked())
            {
                if (!msg.isHidden())
                {
                    if (msg.isLocked())
                        msg.unlockMsg(msg.getLockID(), null, true);
                    else
                        msg.eventUnlocked();
                }
            }
        } catch (MessageStoreException e)
        {
            // MessageStoreException shouldn't occur so FFDC.
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.eventPostRollbackRemove",
                                        "1:2618:1.280.5.25",
                                        this);

            SibTr.exception(tc, e);
            SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                        new Object[] {
                                      "com.ibm.ws.sib.processor.impl.ConsumerDispatcher",
                                      "1:2625:1.280.5.25",
                                      e });

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

            throw new SIResourceException(
                            nls.getFormattedMessage(
                                                    "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                                    new Object[] {
                                                                  "com.ibm.ws.sib.processor.impl.ConsumerDispatcher",
                                                                  "1:2636:1.280.5.25",
                                                                  e },
                                                    null),
                            e);
        }
        //do not want to call internalPut again yet - internalPut will be called from the
        //eventUnlocked callback

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "eventPostRollbackRemove");
    }
1046844
public final void preCommit(final PersistentTransaction transaction) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "preCommit", transaction);

        getItem();  // try to cache item in case we havent got it yet....
        getLink().preCommitRemove(transaction);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "preCommit");
    }
151770
public void afterCompletion(TransactionCommon transaction, boolean committed)
    {
        // When the reference count is about to reach zero, this class registers *itself* as
        // a transaction callback. This method then gets called after the transaction
        // completes and the item's itemReferencesDroppedToZero callback is called.
        if (isAvailable())
        {
        	try
        	{
        		Item item = (Item) getItem();
        		if (null != item)
        		{
        			item.itemReferencesDroppedToZero();
        		}
			} 
        	catch (SevereMessageStoreException e) 
        	{
	            FFDCFilter.processException(e, "com.ibm.ws.sib.msgstore.cache.links.ItemLink.afterCompletion", "1:286:1.104.1.1");
	            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Exception caught attempting to drop item reference count to zero!", e);
			}

        }
    }
708080
public void moveMessage(boolean discard)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "removeMessage", new Boolean(discard));

    InvalidOperationException finalE =
      new InvalidOperationException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0005",
          new Object[] {"RemoteMessageRequest.removeMessage",
                        "1:259:1.34",
                        this},
          null));

    SibTr.exception(tc, finalE);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "removeMessage", finalE);
    throw finalE;
  }
414379
protected void eventPostCommitAdd(SIMPMessage msg, TransactionCommon transaction)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
    {
      SibTr.entry(tc, "eventPostCommitAdd", new Object[]{msg, transaction});
      SibTr.exit(tc, "eventPostCommitAdd");
    }
  }
781636
@Override
    public void eventPostCommitAdd(Transaction transaction) throws SevereMessageStoreException
    {
        super.eventPostCommitAdd(transaction);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "eventPostCommitAdd", transaction);

        if (failedInitInRestore)
        {
            initialiseNonPersistent(true);
            setRegisterForPostEvents(true);
        }

        if (TraceComponent.isAnyTracingEnabled() && UserTrace.tc_mt.isDebugEnabled())
        {
            try
            {
                if (getJSMessage(true).isApiMessage())
                {
                    boolean foreignBus = false;
                    boolean link = false;
                    boolean mqlink = false;

                    String targetME = null;
                    if (debugName != null)
                    {
                        SIMPItemStream itemstream = (SIMPItemStream) getItemStream();

                        BaseDestinationHandler destination = getDestinationHandler(false, itemstream);

                        if (itemstream instanceof PubSubMessageItemStream)
                        {
                            targetME = destination.getMessageProcessor().getMessagingEngineName();
                        }
                        else
                        {
                            SIBUuid8 meUUID = ((PtoPMessageItemStream) itemstream).getLocalizingMEUuid();
                            if (meUUID.equals(destination.getMessageProcessor().getMessagingEngineUuid()))
                                targetME = destination.getMessageProcessor().getMessagingEngineName();
                            else
                            {
                                // If it's not the local messaging engine, then don't attempt the very
                                // expensive operation of trawling through admin for a messaging engine
                                // we may (intra-bus) or may not (inter-bus) know about - just for UserTrace.
                                // While the V7 and later interface is better than V6.1, looking up the
                                // name would be an excessive overhead in the critical path.
                                targetME = meUUID.toString();
                            }

                        }

                        foreignBus = destination.isForeignBus();
                        link = destination.isLink();
                        mqlink = destination.isMQLink();
                    }

                    String apiMsgId = null;
                    String correlationId = null;

                    if (getJSMessage(true) instanceof JsApiMessage)
                    {
                        apiMsgId = ((JsApiMessage) getJSMessage(true)).getApiMessageId();
                        correlationId = ((JsApiMessage) getJSMessage(true)).getCorrelationId();
                    }
                    else
                    {
                        if (getJSMessage(true).getApiMessageIdAsBytes() != null)
                            apiMsgId = new String(getJSMessage(true).getApiMessageIdAsBytes());

                        if (getJSMessage(true).getCorrelationIdAsBytes() != null)
                            correlationId = new String(getJSMessage(true).getCorrelationIdAsBytes());
                    }

                    String msg = "PRODUCER_SEND_COMMIT_CWSJU0003";

                    if (foreignBus)
                        msg = "PRODUCER_SEND_COMMIT_BUS_CWSJU0064";
                    else if (mqlink)
                        msg = "PRODUCER_SEND_COMMIT_MQLINK_CWSJU0066";
                    else if (link)
                        msg = "PRODUCER_SEND_COMMIT_LINK_CWSJU0065";

                    SibTr.debug(this, UserTrace.tc_mt,
                                nls_mt.getFormattedMessage(
                                                           msg,
                                                           new Object[] {
                                                                         apiMsgId,
                                                                         getJSMessage(true).getSystemMessageId(),
                                                                         correlationId,
                                                                         debugName,
                                                                         targetME },
                                                           null));
                }
            } catch (MessageStoreException e)
            {
                // No FFDC code needed

                // Log the exception
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.exception(tc, e);

                // As the item is no longer in the store it has likely been committed already.
                // there doesn't seem any point to log the Message Trace at this point.
            }
        }

        // Remove temporary hack to delete publication with no subscribers 183715.1
        if (!transaction.isAutoCommit())
        {
            try
            {
                if (POST_COMMIT_ADD_1 != null)
                {
                    POST_COMMIT_ADD_1.messageEventOccurred(MessageEvents.POST_COMMIT_ADD, this, transaction);
                }
                if (POST_COMMIT_ADD_2 != null)
                {
                    POST_COMMIT_ADD_2.messageEventOccurred(MessageEvents.POST_COMMIT_ADD, this, transaction);
                }
            } catch (SIException e)
            {
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.store.items.MessageItem.eventPostCommitAdd",
                                            "1:1313:1.244.1.40",
                                            this);

                SibTr.exception(tc, e);

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

                throw new SIErrorException(e);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "eventPostCommitAdd");
    }
220321
@Override
    public void messageEventOccurred(
                                     int event,
                                     SIMPMessage msg,
                                     TransactionCommon tran)
                    throws SIRollbackException,
                    SIConnectionLostException,
                    SIIncorrectCallException,
                    SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "messageEventOccurred",
                        new Object[] { Integer.valueOf(event), msg, tran });

        if (event == MessageEvents.REFERENCES_DROPPED_TO_ZERO)
        {
            _pubSubRealization.itemReferencesDroppedToZero(msg);
        }
        else if (event == MessageEvents.EXPIRY_NOTIFICATION)
        {
            eventMessageExpiryNotification(msg, tran);
        }
        else if (event == MessageEvents.COD_CALLBACK) //183715.1
        {
            sendCODMessage(msg, tran);
        }
        else
        {
            final SIErrorException e =
                            new SIErrorException(
                                            nls.getFormattedMessage(
                                                                    "INTERNAL_MESSAGING_ERROR_CWSIP0001",
                                                                    new Object[] {
                                                                                  "com.ibm.ws.sib.processor.impl.BaseDestinationHandler",
                                                                                  "1:3717:1.700.3.45" },
                                                                    null));

            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.messageEventOccurred",
                                        "1:3723:1.700.3.45",
                                        this);

            SibTr.exception(tc, e);

            SibTr.error(
                        tc,
                        "INTERNAL_MESSAGING_ERROR_CWSIP0001",
                        new Object[] {
                                      "com.ibm.ws.sib.processor.impl.BaseDestinationHandler",
                                      "1:3733:1.700.3.45" });

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

            throw e;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "messageEventOccurred");
    }
866374
final void cmdRequestUpdate(final PersistentTransaction transaction) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "cmdRequestUpdate", new Object[] { "Item Link:   " + this, "Stream Link: " + _owningStreamLink, "Transaction: " + transaction });

        boolean hasBecomeNotReleasable = false;
        synchronized (this)
        {
            if (ItemLinkState.STATE_AVAILABLE == _itemLinkState)
            {

                ListStatistics stats = getParentStatistics();
                synchronized (stats)
                {
                    stats.decrementAvailable();
                    stats.incrementUpdating();
                }

                _transactionId = transaction.getPersistentTranId();
                hasBecomeNotReleasable = _declareNotDiscardable(_getItemNoRestore());
                _itemLinkState = ItemLinkState.STATE_UPDATING_DATA;
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "cmdRequestUpdate");
                throw new StateException(_itemLinkState.toString());
            }
        }
        if (hasBecomeNotReleasable)
        {
            _declareNotReleasable();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "cmdRequestUpdate");
    }
631068
public void moveMessage(boolean discard) throws SIMPControllableNotFoundException, 
                                                    SIMPRuntimeOperationFailedException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "moveMessage", Boolean.valueOf(discard));
      
    assertValidControllable();
    
    // This is a pubsub messages so we cannot remove the actual message from the ItemStream.
    // In fact, there is no need to remove the underlying message, we leave that to the stream
    // to call back to the PubSubInputHandler to remove the reference to the message if
    // possible (i.e. others are not also referencing it).
    try
    {
      Stream stream = getStream();
      if(stream != null)
        stream.writeSilenceForced(getStartTick());
    }
    catch (SIException e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.runtime.LinkTransmitMessageControl.moveMessage",
        "1:184:1.5",
        this);
  
      SIMPRuntimeOperationFailedException finalE =
        new SIMPRuntimeOperationFailedException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0003",
            new Object[] {"TransmitMessage.moveMessage",
                "1:192:1.5",
                          e,
                          new Long(getStartTick())},
            null), e);

      SibTr.exception(tc, finalE);
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "moveMessage", finalE);
      
      throw finalE;             
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "moveMessage");
  }
297482
@Override
    public void afterCompletion(TransactionCommon tran, boolean committed)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "afterCompletion", new Object[] { tran, Boolean.valueOf(committed) });

        // We don't care if the transaction committed or rolled back, either way
        // this callback indicates that a message that this consumer had active
        // is no longer active and therefore we should decrement the active message
        // count (this callback is called once per active message).
        removeActiveMessages(1);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "afterCompletion");
    }
963451
public void writeUncommitted(SIMPMessage m)
                    throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "writeUncommitted", new Object[] { m });

        TickRange tr = null;

        JsMessage jsMsg = m.getMessage();
        long stamp = jsMsg.getGuaranteedValueValueTick();

        long starts = jsMsg.getGuaranteedValueStartTick();
        long ends = jsMsg.getGuaranteedValueEndTick();
        long completedPrefix;

        tr = TickRange.newUncommittedTick(stamp);
        tr.startstamp = starts;
        tr.endstamp = ends;

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        {
            SibTr.debug(tc, "writeUncommitted at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + streamID);
        }

        synchronized (this)
        {
            // write into stream
            oststream.writeCombinedRange(tr);

            completedPrefix = oststream.getCompletedPrefix();

            sendSilence(starts, completedPrefix);

            // SIB0105
            // If this is the first uncommitted messages to be added to the stream, start off the 
            // blocked message health state timer. This will check back in the future to see if the
            // message successfully sent.
            if (blockedStreamAlarm == null)
            {
                blockedStreamAlarm = new BlockedStreamAlarm(this, getCompletedPrefix());
                am.create(GDConfig.BLOCKED_STREAM_HEALTH_CHECK_INTERVAL, blockedStreamAlarm);
            }

        } // end synchronized

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

    }