Gets a batch of messages from the queue.

@param batchSize
@param convHelper

@return Returns an array of JsMessage objects
498076
private synchronized JsMessage[] getBatch(int batchSize, ConversationHelper convHelper)
      throws SIResourceException, SIConnectionDroppedException
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getBatch",
                                           new Object[]{batchSize, convHelper});

      if (batchesReady == 0)
      {
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "No batches are ready!!");

         // We are getting a batch of messages from the queue but there are none ready. Oops.
         SIErrorException e = new SIErrorException(
            nls.getFormattedMessage("ASYNC_BATCH_NOT_READY_SICO1033", null, null)
         );

         FFDCFilter.processException(e, CLASS_NAME + ".getBatch",
                                     CommsConstants.ASYNCHPQ_GETBATCH_01, this);

         throw e;
      }

      int currentSessionId = 0;
      JsMessage[] msg = new JsMessage[batchSize];
      QueueData data = null;

      for (int i=0; i<msg.length; ++i)
      {
         data = queue.removeFirst();
         currentSessionId = data.getProxyQueue().getId();
         msg[i] = (JsMessage) data.getMessage();

         // Is this the last bit of data? If so - out we go
         if (data.isLastInBatch()) break;
      }
      batchesReady--;

      // Have a quick check and see if there is any data left on the queue. If there is, it is
      // probably for another session and we should therefore transistion that session into
      // delivery by calling batch()
      if (!isQueueEmpty())
      {
         QueueData qd = queue.get(0);
         AsynchConsumerProxyQueue pq = (AsynchConsumerProxyQueue)qd.getProxyQueue();

         if (pq.getId() != currentSessionId)
         {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Next data on the queue is for a different session:", pq);
            pq.nudge();
         }
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getBatch", msg);
      return msg;
   }
431753
@Override
    public java.util.concurrent.Future<ChangeMessageVisibilityBatchResult> changeMessageVisibilityBatchAsync(String queueUrl,
            java.util.List<ChangeMessageVisibilityBatchRequestEntry> entries,
            com.amazonaws.handlers.AsyncHandler<ChangeMessageVisibilityBatchRequest, ChangeMessageVisibilityBatchResult> asyncHandler) {

        return changeMessageVisibilityBatchAsync(new ChangeMessageVisibilityBatchRequest().withQueueUrl(queueUrl).withEntries(entries), asyncHandler);
    }
994361
public int[] batchUpdate(List<? extends Model> modelList, int batchSize) {
    	if (modelList == null || modelList.size() == 0)
    		return new int[0];
    	
    	Model model = modelList.get(0);
    	Table table = TableMapping.me().getTable(model.getClass());
    	String[] pKeys = table.getPrimaryKey();
    	Map<String, Object> attrs = model._getAttrs();
    	List<String> attrNames = new ArrayList<String>();
    	// the same as the iterator in Dialect.forModelSave() to ensure the order of the attrs
    	for (Entry<String, Object> e : attrs.entrySet()) {
    		String attr = e.getKey();
    		if (config.dialect.isPrimaryKey(attr, pKeys) == false && table.hasColumnLabel(attr))
    			attrNames.add(attr);
    	}
    	for (String pKey : pKeys)
    		attrNames.add(pKey);
    	String columns = StrKit.join(attrNames.toArray(new String[attrNames.size()]), ",");
    	
    	// update all attrs of the model not use the midifyFlag of every single model
    	Set<String> modifyFlag = attrs.keySet();	// model.getModifyFlag();
    	
    	StringBuilder sql = new StringBuilder();
    	List<Object> parasNoUse = new ArrayList<Object>();
    	config.dialect.forModelUpdate(TableMapping.me().getTable(model.getClass()), attrs, modifyFlag, sql, parasNoUse);
    	return batch(sql.toString(), columns, modelList, batchSize);
    }
423646
static public synchronized MessageMap getMessageMap(JSchema sfs, BigInteger code) {
    // This method must be synchronized since some of the work done when constructing
    // a new MessageMap is not thread safe.
    MessageMapTable maps = (MessageMapTable)sfs.getInterpreterCache(JMFRegistry.JMF_ENCODING_VERSION);
    if (maps == null) {
      BigInteger count = ((JSType)sfs.getJMFType()).getMultiChoiceCount();
      maps = new MessageMapTable(count);
      sfs.setInterpreterCache(JMFRegistry.JMF_ENCODING_VERSION, maps);
    }
    MessageMap ans = maps.getMap(code);
    if (ans == null)
      maps.set(ans = new MessageMap(sfs, code));
    return ans;
  }
1273303
@GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response getBatches(@Context HttpServletRequest req) {
        PrincipalUser owner = validateAndGetOwner(req, null);
        SystemAssert.requireArgument(owner != null, "Owner cannot be null");

        Map<String,String> batches = batchService.findBatchesByOwnerName(owner.getUserName());
        return Response.ok(batches, MediaType.APPLICATION_JSON).build();
    }
1000145
public static int cusolverRfBatchSetupHost(
        int batchSize, 
        int n, 
        int nnzA, 
        Pointer h_csrRowPtrA, 
        Pointer h_csrColIndA, 
        Pointer h_csrValA_array, 
        int nnzL, 
        Pointer h_csrRowPtrL, 
        Pointer h_csrColIndL, 
        Pointer h_csrValL, 
        int nnzU, 
        Pointer h_csrRowPtrU, 
        Pointer h_csrColIndU, 
        Pointer h_csrValU, 
        Pointer h_P, 
        Pointer h_Q, 
        /** Output (in the device memory) */
        cusolverRfHandle handle)
    {
        return checkResult(cusolverRfBatchSetupHostNative(batchSize, n, nnzA, h_csrRowPtrA, h_csrColIndA, h_csrValA_array, nnzL, h_csrRowPtrL, h_csrColIndL, h_csrValL, nnzU, h_csrRowPtrU, h_csrColIndU, h_csrValU, h_P, h_Q, handle));
    }
441164
private RestoreWork processMessage(DecodedContainer msg,
                                       CachedByteBufferAllocator resultBufferAllocator) {
        if (msg == null) {
            return null;
        }

        RestoreWork restoreWork = null;
        try {
            if (msg.m_msgType == StreamSnapshotMessageType.FAILURE) {
                VoltDB.crashLocalVoltDB("Rejoin source sent failure message.", false, null);

                // for test code only
                if (m_expectedEOFs.decrementAndGet() == 0) {
                    m_EOF = true;
                }
            }
            else if (msg.m_msgType == StreamSnapshotMessageType.END) {
                if (rejoinLog.isTraceEnabled()) {
                    rejoinLog.trace("Got END message " + msg.m_blockIndex + " from " +
                            CoreUtils.hsIdToString(msg.m_srcHSId) +
                            " (TargetId " + msg.m_dataTargetId + ")");
                }

                if (m_expectedEOFs.decrementAndGet() == 0) {
                    m_EOF = true;
                }
            }
            else if (msg.m_msgType == StreamSnapshotMessageType.SCHEMA) {
                rejoinLog.trace("Got SCHEMA message " + msg.m_blockIndex + " from " +
                        CoreUtils.hsIdToString(msg.m_srcHSId) +
                        " (TargetId " + msg.m_dataTargetId + ")");
                ByteBuffer block = msg.m_container.b();
                block.position(StreamSnapshotDataTarget.contentOffset);
                byte[] schemaBytes = new byte[block.remaining()];
                block.get(schemaBytes);
                m_schemas.put(msg.m_tableId, schemaBytes);
            }
            else if (msg.m_msgType == StreamSnapshotMessageType.HASHINATOR) {
                ByteBuffer block = msg.m_container.b();
                block.position(StreamSnapshotDataTarget.contentOffset);
                long version = block.getLong();
                byte[] hashinatorConfig = new byte[block.remaining()];
                block.get(hashinatorConfig);

                restoreWork = new HashinatorRestoreWork(version, hashinatorConfig);
            }
            else {
                // It's normal snapshot data afterwards
                rejoinLog.trace("Got DATA message " + msg.m_blockIndex + " from " +
                        CoreUtils.hsIdToString(msg.m_srcHSId) +
                        " (TargetId " + msg.m_dataTargetId + ")");

                ByteBuffer block = msg.m_container.b();

                if (!m_schemas.containsKey(msg.m_tableId)) {
                    VoltDB.crashLocalVoltDB("No schema for table with ID " + msg.m_tableId,
                                            false, null);
                }

                // Get the byte buffer ready to be consumed
                block.position(StreamSnapshotDataTarget.contentOffset);
                ByteBuffer nextChunk = getNextChunk(m_schemas.get(msg.m_tableId), block, resultBufferAllocator);
                m_bytesReceived += nextChunk.remaining();

                restoreWork = new TableRestoreWork(msg.m_tableId, nextChunk);
            }

            return restoreWork;
        } finally {
            msg.m_container.discard();

            // Queue ack to this block (after the container has been discarded)
            m_ack.ack(msg.m_srcHSId, msg.m_msgType == StreamSnapshotMessageType.END, msg.m_dataTargetId, msg.m_blockIndex);
        }
    }
684578
public ObjectManagerByteArrayOutputStream[] getBuffers()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass
                        , "getBuffers"
                            );

        ObjectManagerByteArrayOutputStream[] buffers = new ObjectManagerByteArrayOutputStream[1];

        // Create the buffer to contain the header for this log record. 
        buffers[0] = new ObjectManagerByteArrayOutputStream(4);
        buffers[0].writeInt(LogRecord.TYPE_CHECKPOINT_END);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "getBuffers"
                       , new Object[] { buffers }
                            );
        return buffers;
    }
308733
public static BatchSession newBatchSessionByBatchSize(KnowledgePackage knowledgePackage,int batchSize){
		return new BatchSessionImpl(knowledgePackage,BatchSession.DEFAULT_THREAD_SIZE,batchSize);
	}
247783
static SIMessageHandle[] getMessageHandles(final List messages) {

        final SIMessageHandle[] messageHandles = new SIMessageHandle[messages
                        .size()];
        for (int i = 0; i < messageHandles.length; i++) {
            final SIBusMessage message = (SIBusMessage) messages.get(i);
            messageHandles[i] = message.getMessageHandle();
        }
        return messageHandles;

    }
465253
public static MessageBatcher getBatcher(String name) {
		MessageBatcher batcher = batcherMap.get(name);
		return batcher;
	}
1187030
public SIMPIterator getTransmitMessagesIterator(int maxMsgs) throws SIMPControllableNotFoundException, SIMPRuntimeOperationFailedException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getTransmitMessagesIterator");

    assertValidControllable();

    SIMPIterator msgItr = null;
    try
    {
      msgItr = new SourceStreamSetXmitMessageIterator(maxMsgs);
    }
    catch (SIResourceException e)
    {
      FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.runtime.SourceStreamSetControl.getTransmitMessagesIterator",
          "1:283:1.39",
          this);

        SIMPRuntimeOperationFailedException finalE =
          new SIMPRuntimeOperationFailedException(
            nls.getFormattedMessage(
              "INTERNAL_MESSAGING_ERROR_CWSIP0002",
              new Object[] {"SourceStreamSetControl.getTransmitMessagesIterator",
                  "1:291:1.39",
                            e},
              null), e);

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

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

    return msgItr;
  }
632593
protected Func1<HttpClientResponse<ByteBuf>, Integer> withBookkeeping(final int batchSize) {
    return response -> {
      boolean ok = response.getStatus().code() == 200;
      if (ok) {
        numMetricsSent.increment(batchSize);
      } else {
        LOGGER.info("Status code: {} - Lost {} metrics",
            response.getStatus().code(), batchSize);
        numMetricsDroppedHttpErr.increment(batchSize);
      }

      return batchSize;
    };
  }
1216904
private Integer getBatchSize(Method method) {
    // Determine queue batch size, if any
    Batch batch = method.getAnnotation(Batch.class);
    if (batch != null) {
      int batchSize = batch.value();
      Preconditions.checkArgument(batchSize > 0, "Batch size should be > 0: %s", method.getName());
      return batchSize;
    }
    return null;
  }
85338
protected List<Message> getMessages(int prefetchBatchSize) throws InterruptedException {

        assert prefetchBatchSize > 0;

        ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(queueUrl)
                                                              .withMaxNumberOfMessages(prefetchBatchSize)
                                                              .withAttributeNames(ALL)
                                                              .withMessageAttributeNames(ALL)
                                                              .withWaitTimeSeconds(WAIT_TIME_SECONDS);
        //if the receive request is for FIFO queue, provide a unique receive request attempt it, so that
        //failed calls retried by SDK will claim the same messages
        if (sqsDestination.isFifo()) {
            receiveMessageRequest.withReceiveRequestAttemptId(UUID.randomUUID().toString());
        }
        List<Message> messages = null;
        try {
            ReceiveMessageResult receivedMessageResult = amazonSQSClient.receiveMessage(receiveMessageRequest);
            messages = receivedMessageResult.getMessages();
            retriesAttempted = 0;
        } catch (JMSException e) {
            LOG.warn("Encountered exception during receive in ConsumerPrefetch thread", e);
            try {
                sleep(backoffStrategy.delayBeforeNextRetry(retriesAttempted++));
            } catch (InterruptedException ex) {
                LOG.warn("Interrupted while retrying on receive", ex);
                throw ex;
            }
        }
        return messages;
    }
592498
public static JsMessagingEngine[] getMessagingEngines(final String busName) {

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

        final JsMessagingEngine[] result;

        synchronized (MESSAGING_ENGINES) {

            // Do we have any messaging engines for the given bus?
            final Set messagingEngines = (Set) MESSAGING_ENGINES.get(busName);

            if (messagingEngines == null) {

                // If not, return an empty array
                result = new JsMessagingEngine[0];

            } else {

                // If we do, convert the set to an array
                result = (JsMessagingEngine[]) messagingEngines
                        .toArray(new JsMessagingEngine[messagingEngines.size()]);

            }

        }

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

    }
589582
def batch_message(cls, batch, request_ids):
        ''''''
        assert isinstance(batch, Batch)
        if not cls.allow_batches:
            raise ProtocolError.invalid_request(
                'protocol does not permit batches')
        id_iter = iter(request_ids)
        rm = cls.request_message
        nm = cls.notification_message
        parts = (rm(request, next(id_iter)) if isinstance(request, Request)
                 else nm(request) for request in batch)
        return cls.batch_message_from_parts(parts)