/* (non-Javadoc)
@see com.ibm.ws.sib.processor.runtime.SIMPRemoteConsumerTransmitControllable#getTransmitMessageRequestIterator()
502988
public SIMPIterator getTransmitMessageRequestIterator()
  {
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
			SibTr.entry(tc, "getTransmitMessageRequestIterator");
		
  	AOStreamIterator aoStreamIterator = new AOStreamIterator(_aoStream, _messageProcessor, _aoh);
    
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
			SibTr.exit(tc, "getTransmitMessageRequestIterator", aoStreamIterator);
					
		return aoStreamIterator;
  }
379708
public SIMPIterator getRemoteSubscriptionIterator()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getRemoteSubscriptionIterator");
      
    DestinationTypeFilter filter = new DestinationTypeFilter();
    filter.QUEUE = Boolean.FALSE;
    
    Collection mpAIHCollection = new LinkedList();
    for (SIMPIterator iter = destinationIndex.iterator(filter); iter.hasNext();)
    {
      BaseDestinationHandler destination = (BaseDestinationHandler) iter.next();
      Map destAIHMap = destination.getPseudoDurableAIHMap();
      mpAIHCollection.add(destAIHMap.values());
    }
    
    AttachedRemoteSubscriberIterator remoteSubscriptionItr 
      = new AttachedRemoteSubscriberIterator(mpAIHCollection);
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getRemoteSubscriptionIterator", remoteSubscriptionItr);
    return remoteSubscriptionItr;
  }
807415
public final Long getMessageWaitTime() {
        /* If the transient has never been set, get the value in the message */
        if (cachedMessageWaitTime == null) {
            cachedMessageWaitTime = (Long) getHdr2().getField(JsHdr2Access.MESSAGEWAITTIME);
        }
        return cachedMessageWaitTime;
    }
284993
@Override
	protected int retrieveMessagePriority(int handle) throws JMSException
    {
    	// Only read the first header bytes of the message to read the priority field
    	byte[] msgHeader = ((AbstractBlockBasedDataStore)dataStore).retrieveHeader(handle, 2);    	
    	return msgHeader[1] & 0x0F;
    }
1167184
public int getRemainingMessageCount() 
  throws SISessionUnavailableException, SISessionDroppedException,
         SIIncorrectCallException
  {
    if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
      SibTr.entry(CoreSPILockedMessageEnumeration.tc, "getRemainingMessageCount", this);
          
    checkValidState("getRemainingMessageCount");
          
    _localConsumerPoint.checkNotClosed();
    
    int remaining = 0;
    
    if(!_seenSingleMessage)
    {
      remaining = 1;
    }
    
    if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
      SibTr.exit(CoreSPILockedMessageEnumeration.tc, "getRemainingMessageCount", 
        new Integer(remaining));    
      
    return remaining;
  }
1127406
public SIMPIterator getQueuedMessageIterator() 
  throws SIMPRuntimeOperationFailedException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getQueuedMessageIterator");

    List<ControlAdapter> messages = new ArrayList<ControlAdapter>();
    
    NonLockingCursor cursor = null;
    try
    {
      cursor = itemStream.newNonLockingItemCursor(null);
      cursor.allowUnavailableItems();
      MessageItem item = (MessageItem)cursor.next();
      while(item != null)
      {
        // force the arrival time to be written to the jsMessage  
        item.forceCurrentMEArrivalTimeToJsMessage();
        
        // It's possible to get a null adapter back 
        ControlAdapter cAdapter = item.getControlAdapter();
        if(cAdapter != null)
          messages.add(cAdapter);
        
        item = (MessageItem)cursor.next();      
      }      
    }
    catch (MessageStoreException e)
    {
      FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.runtime.LocalQueuePoint.getQueuedMessageIterator",
          "1:264:1.58", 
          this);
      SibTr.exception(tc, e);
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
        SibTr.exit(tc, "getQueuedMessageIterator", e);
      throw new SIMPRuntimeOperationFailedException(e);
    }
    finally
    {
      if (cursor != null)
        cursor.finished();
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getQueuedMessageIterator");
      
    return new BasicSIMPIterator(messages.iterator());    
  }
64605
@Override
	public final MutableObjectIterator<T> getIterator() {
		final SingleSegmentInputView startIn = new SingleSegmentInputView(this.recordsPerSegment * this.recordSize);
		startIn.set(this.sortBuffer.get(0), 0);
		
		return new MutableObjectIterator<T>() {
			
			private final SingleSegmentInputView in = startIn;
			private final TypeComparator<T> comp = comparator;
			
			private final int numTotal = size();
			private final int numPerSegment = recordsPerSegment;
			
			private int currentTotal = 0;
			private int currentInSegment = 0;
			private int currentSegmentIndex = 0;

			@Override
			public T next(T reuse) {
				if (this.currentTotal < this.numTotal) {
					
					if (this.currentInSegment >= this.numPerSegment) {
						this.currentInSegment = 0;
						this.currentSegmentIndex++;
						this.in.set(sortBuffer.get(this.currentSegmentIndex), 0);
					}
					
					this.currentTotal++;
					this.currentInSegment++;
					
					try {
						return this.comp.readWithKeyDenormalization(reuse, this.in);
					}
					catch (IOException ioe) {
						throw new RuntimeException(ioe);
					}
				}
				else {
					return null;
				}
			}

			@Override
			public T next() {
				if (this.currentTotal < this.numTotal) {

					if (this.currentInSegment >= this.numPerSegment) {
						this.currentInSegment = 0;
						this.currentSegmentIndex++;
						this.in.set(sortBuffer.get(this.currentSegmentIndex), 0);
					}

					this.currentTotal++;
					this.currentInSegment++;

					try {
						return this.comp.readWithKeyDenormalization(serializer.createInstance(), this.in);
					}
					catch (IOException ioe) {
						throw new RuntimeException(ioe);
					}
				}
				else {
					return null;
				}
			}
		};
	}
521772
public SIMPMessage getMessageLocked() throws MessageStoreException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getMessageLocked");
    
    SIMPMessage msg = null;
    
    if(classifyingMessages)
    {
      // Take the classifications read lock
      consumerSet.takeClassificationReadLock();

      // Classifications may change dynamically, so check the pendingReset
      // flag under this lock. If classifications have changed then we'll
      // set up the filters again
      if(pendingFlowReset)
      {
        pendingFlowReset = false;
        resetFlowProperties();
      }
        
      // Determine which cursor to use. chooseGetCursorIndex() will 
      // randomly choose an index if XD has specified weightings.
      // The method can be called more than once. This supports the situation
      // where we've looked for but not found any messages of a particular 
      // classification. 
      // 
      // If chooseGetCursorIndex() returns 0, then either no classifications were 
      // specified or we've already tried all the classifications. An index
      // of 0 leads to the use of the default (unclassified) cursor.
      int classIndex = -1;
      while(classIndex != 0)
      {
        classIndex = chooseGetCursorIndex(classIndex);
     
        // Always use the cursor straight from the key
        msg = getMessageLocked(classIndex);

        if(msg != null)
          classIndex = 0;
      }

      // Free the classifications read lock
      consumerSet.freeClassificationReadLock();
    }
    else // Not classifying
    {
      // Use the zeroth index
      msg = getMessageLocked(0);
    }

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

    return msg;
  }
76583
protected String getSender(final SmsSendRequestDto smsSendRequestDto) {
    if (StringUtils.isNotBlank(smsSendRequestDto.getSender())) {
      return smsSendRequestDto.getSender();
    }
    Validate.notEmpty(defaultSender, "defaultSender must not be null or blank");
    return defaultSender;
  }
1231033
public SIMPIterator getPubSubInboundReceiverIterator() {
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
			SibTr.entry(tc, "getPubSubInboundReceiverIterator");

		TargetStreamManager tsm = getInputHandler().getTargetStreamManager();
		SIMPIterator itr = tsm.getTargetStreamSetControlIterator();

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

		return itr;
	}
401239
@Override
    public long getMessageWaitTime()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            SibTr.entry(this, tc, "getMessageWaitTime");
            SibTr.exit(this,
                       tc, "getMessageWaitTime", Long.valueOf(messageWaitTime));
        }

        return messageWaitTime;
    }
132345
protected int getTransactionCounter() throws CommunicationException {
		int ret = UNKNOW;
		if (LOGGER.isDebugEnabled()) {
			LOGGER.debug("Get Transaction Counter ATC");
		}
		byte[] data = template.get().getProvider().transceive(new CommandApdu(CommandEnum.GET_DATA, 0x9F, 0x36, 0).toBytes());
		if (ResponseUtils.isSucceed(data)) {
			// Extract ATC
			byte[] val = TlvUtil.getValue(data, EmvTags.APP_TRANSACTION_COUNTER);
			if (val != null) {
				ret = BytesUtils.byteArrayToInt(val);
			}
		}
		return ret;
	}
1107455
SubscriptionMessageHandler getMessageHandler()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getMessageHandler");

    SubscriptionMessageHandler messageHandler =
      (SubscriptionMessageHandler) _subscriptionMessagePool.remove();

    if (messageHandler == null)
    {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(
          tc,
          "doProxySubscribeOp",
          "Creating a new Message Handler as none available");

      messageHandler = new SubscriptionMessageHandler(this);
    }

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

    return messageHandler;
  }
414699
public SIMPRequestMessageInfo getRequestMessageInfo() throws SIMPRuntimeOperationFailedException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getRequestMessageInfo");

    SIMPRequestMessageInfo requestMessageInfo = null;
    try
    {
      if (State.REQUEST.toString().equals(getState()))
      {
        // This RemoteMessageRequest is in state request so lets get the info
        TickRange tickRange = _aiStream.getTickRange(_tick);
        requestMessageInfo = new RequestMessageInfo((AIRequestedTick)tickRange.value);
      }
    }
    catch(SIMPException e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.runtime.RemoteMessageRequest.getRequestMessageInfo",
        "1:407:1.34",
        this);

      SIMPRuntimeOperationFailedException e1 =
        new SIMPRuntimeOperationFailedException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0003",
            new Object[] {"RemoteMessageRequest.getRequestMessageInfo",
                          "1:415:1.34",
                          e,
                          _aiStream.getStreamId()},
            null), e);

      SibTr.exception(tc, e1);
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRequestMessageInfo", e1);
      throw e1;
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getRequestMessageInfo", requestMessageInfo);
    return requestMessageInfo;
  }
925822
public SIMPIterator getQueuedMessageIterator()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getQueuedMessageIterator");

    List<ControlAdapter> messages = new ArrayList<ControlAdapter>();
    
    NonLockingCursor cursor = null;

    MessageItem referredItem = null;
    try
    {
      cursor =
        consumerDispatcher.getReferenceStream().newNonLockingCursor(null);
      cursor.allowUnavailableItems();
      MessageItemReference item = (MessageItemReference) cursor.next();
      while(item != null)
      {
        try
        {
          referredItem = (MessageItem)item.getReferredItem();
          if(referredItem != null)
          {
            // force the arrival time to be written to the jsMessage  
            referredItem.forceCurrentMEArrivalTimeToJsMessage();
          }
          
          // It's possible to get a null adapter back 
          ControlAdapter cAdapter = item.getControlAdapter();
          if(cAdapter != null)
            messages.add(cAdapter);
          
          item = (MessageItemReference) cursor.next();
        }
        catch (NotInMessageStore ef)
        {
          // No FFDC code needed
          // The message has already been consumed. Trace the exception but allow processing to continue.
          SibTr.exception(tc, ef);
        }
        catch (MessageStoreException e)
        {
          // FFDC
          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.runtime.LocalSubscriptionControl.getQueuedMessageIterator",
            "1:275:1.36",
            this);
            

          SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
            new Object[] { "com.ibm.ws.sib.processor.runtime.LocalSubscriptionControl.getQueuedMessageIterator", 
                           "1:281:1.36", 
                           SIMPUtils.getStackTrace(e) });
        }        
      }      
    }
    catch (MessageStoreException e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.runtime.LocalSubscriptionControl.getQueuedMessageIterator",
        "1:292:1.36",
        this);
        

      SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
        new Object[] { "com.ibm.ws.sib.processor.runtime.LocalSubscriptionControl.getQueuedMessageIterator", 
                       "1:298:1.36", 
                       SIMPUtils.getStackTrace(e) });
    }
    finally
    {
      if (cursor != null)
        cursor.finished();
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getQueuedMessageIterator");
      
    return new BasicSIMPIterator(messages.iterator());    
  }
91078
public synchronized SIBusMessage getMessage(CommsConnection commsConnection)
      throws SIResourceException
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getMessage");

      checkReleased();

      SIBusMessage mess = null;
      // Now build a JsMessage from the returned data. Note that a message length of -1 indicates
      // that no message has been returned and a null value should be returned to the caller.

      // Get length of JsMessage
      int messageLen = (int) getLong();
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Message length", messageLen);
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Remaining in buffer", receivedBuffer.remaining());

      if (messageLen > -1)
      {
         // Build Message from byte array. If the buffer is backed by an array we should simply
         // pass that into MFP rather than copying into a new byte[]
         try
         {
            if (receivedBuffer.hasArray())
            {
               if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received buffer has a backing array");

               mess = JsMessageFactory.getInstance().createInboundJsMessage(receivedBuffer.array(),
                                                                            receivedBuffer.position() + receivedBuffer.arrayOffset(),
                                                                            messageLen,
                                                                            commsConnection);

               // Move the position to the end of the message so that any data after the message
               // can be got
               receivedBuffer.position(receivedBuffer.position() + messageLen);
            }
            else
            {
               if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received buffer does NOT have a backing array");

               byte[] messageArray = get(messageLen);
               mess = JsMessageFactory.getInstance().createInboundJsMessage(messageArray,
                                                                            0,
                                                                            messageLen,
                                                                            commsConnection);
            }
         }
         catch (Exception e)
         {
            FFDCFilter.processException(e, CLASS_NAME + ".getMessage", CommsConstants.COMMSBYTEBUFFER_GETMESSAGE_01, this,
              new Object[] {"messageLen="+messageLen+", position="+receivedBuffer.position()+", limit="+receivedBuffer.limit() + " " +
                (receivedBuffer.hasArray()?"arrayOffset="+receivedBuffer.arrayOffset()+" array.length="+receivedBuffer.array().length:"no backing array")});

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            {
               SibTr.debug(this, tc, "Unable to create message", e);
               dump(this, tc, 100);
            }

            throw new SIResourceException(e);
         }
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMessage", mess);
      return mess;
   }
1080100
public SIMPIterator getQueueIterator()
  {
    DestinationTypeFilter filter = new DestinationTypeFilter();
    filter.QUEUE = Boolean.TRUE;
    SIMPIterator queuesItr = destinationIndex.iterator(filter);
    return new ControllableIterator(queuesItr);
  }