Receive a batch of up to batchSize. Other than batching this method is the same as {@link JmsTemplate#receive()}
@return A list of {@link Message}
@param batchSize The batch size
@throws JmsException The {@link JmsException}
773751
public List<Message> receiveBatch(int batchSize) throws JmsException {

        Destination defaultDestination = getDefaultDestination();

        if (defaultDestination != null) {
            return receiveBatch(defaultDestination, batchSize);
        } else {
            return receiveBatch(getRequiredDefaultDestinationName(), batchSize);
        }
    }
632938
public List<T> batchLoad(Iterable<T> itemsToGet) {
        final Map<String,List<Object>> results = mapper.batchLoad(itemsToGet);
        if (results.isEmpty()) {
            return Collections.<T>emptyList();
        }
        return (List<T>)results.get(mapper.getTableName(model.targetType(), config));
    }
775222
private void executeInternalBatch(int size) throws SQLException {
    executeQueryPrologue(true);
    results = new Results(this, 0, true, size, false, resultSetScrollType,
            resultSetConcurrency, autoGeneratedKeys, protocol.getAutoIncrementIncrement());
    if (protocol
        .executeBatchClient(protocol.isMasterConnection(), results, prepareResult, parameterList,
            hasLongData)) {
      return;
    }

    //send query one by one, reading results for each query before sending another one
    SQLException exception = null;

    if (queryTimeout > 0) {
      for (int batchQueriesCount = 0; batchQueriesCount < size; batchQueriesCount++) {
        protocol.stopIfInterrupted();
        try {
          protocol.executeQuery(protocol.isMasterConnection(), results, prepareResult,
              parameterList.get(batchQueriesCount));
        } catch (SQLException e) {
          if (options.continueBatchOnError) {
            exception = e;
          } else {
            throw e;
          }
        }
      }

    } else {
      for (int batchQueriesCount = 0; batchQueriesCount < size; batchQueriesCount++) {
        try {
          protocol.executeQuery(protocol.isMasterConnection(), results, prepareResult,
              parameterList.get(batchQueriesCount));
        } catch (SQLException e) {
          if (options.continueBatchOnError) {
            exception = e;
          } else {
            throw e;
          }
        }
      }
    }
    if (exception != null) {
      throw exception;
    }

  }
355946
@Override
    public Message getWithoutAck(ClientIdentity clientIdentity, int batchSize) throws CanalServerException {
        return getWithoutAck(clientIdentity, batchSize, null, null);
    }
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();
    }
321794
public List<String> receiveTextMessages(int maxSize) {
        List<String> messages = new ArrayList<>();
        try {
            while (messages.size() <= maxSize){
                TextMessage message = (TextMessage) consumer.receive(timeout);
                if (message == null) {
                    return messages;
                }else {
                    messages.add(message.getText());
                }
            }
        } catch (JMSException e) {
            throw new AsyncException(e);
        }
        return messages;
    }
319434
@Override
    public void action(String queueUrl, List<String> receiptHandles) throws JMSException {
        if (receiptHandles == null || receiptHandles.isEmpty()) {
            return;
        }

        List<DeleteMessageBatchRequestEntry> deleteMessageBatchRequestEntries = new ArrayList<DeleteMessageBatchRequestEntry>();
        int batchId = 0;
        for (String receiptHandle : receiptHandles) {
            // Remove the message from queue of unAckMessages
            unAckMessages.poll();
            
            DeleteMessageBatchRequestEntry entry = new DeleteMessageBatchRequestEntry(
                    Integer.toString(batchId), receiptHandle);
            deleteMessageBatchRequestEntries.add(entry);
            batchId++;
        }
        
        DeleteMessageBatchRequest deleteMessageBatchRequest = new DeleteMessageBatchRequest(
                queueUrl, deleteMessageBatchRequestEntries);
        /**
         * TODO: If one of the batch calls fail, then the remaining messages on
         * the batch will not be deleted, and will be visible and delivered as
         * duplicate after visibility timeout expires.
         */
        amazonSQSClient.deleteMessageBatch(deleteMessageBatchRequest);
    }
740212
protected void getBatch(int batchSize){

//      if (numCalls == 0) {
//        for (int i = 0; i < 1538*\15; i++) {
//          randGenerator.nextInt(this.dataDimension());
//        }
//      }
//      numCalls++;

    if (thisBatch == null || thisBatch.length != batchSize){
      thisBatch = new int[batchSize];
    }

    //-----------------------------
    //RANDOM WITH REPLACEMENT
    //-----------------------------
    if (sampleMethod.equals(SamplingMethod.RandomWithReplacement)){
      for(int i = 0; i<batchSize;i++){
        thisBatch[i] = randGenerator.nextInt(this.dataDimension());        //Just generate a random index
//        System.err.println("numCalls = "+(numCalls++));
      }
      //-----------------------------
      //ORDERED
      //-----------------------------
    }else if(sampleMethod.equals(SamplingMethod.Ordered)){
      for(int i = 0; i<batchSize;i++){
        thisBatch[i] = (curElement + i) % this.dataDimension() ;          //Take the next batchSize points in order
      }
      curElement = (curElement + batchSize) % this.dataDimension();       //watch out for overflow

      //-----------------------------
      //RANDOM WITHOUT REPLACEMENT
      //-----------------------------
    }else if(sampleMethod.equals(SamplingMethod.RandomWithoutReplacement)){
      //Declare the indices array if needed.
      if (allIndices == null || allIndices.size()!= this.dataDimension()){

        allIndices = new ArrayList<Integer>();
        for(int i=0;i<this.dataDimension();i++){
          allIndices.add(i);
        }
        Collections.shuffle(allIndices,randGenerator);
      }

      for(int i = 0; i<batchSize;i++){
        thisBatch[i] = allIndices.get((curElement + i) % allIndices.size());  //Grab the next batchSize indices
      }

      if (curElement + batchSize > this.dataDimension()){
        Collections.shuffle(Arrays.asList(allIndices),randGenerator);                   //Shuffle if we got to the end of the list
      }

      //watch out for overflow
      curElement = (curElement + batchSize) % allIndices.size();          //Rollover


    }else{
      System.err.println("NO SAMPLING METHOD SELECTED");
      System.exit(1);
    }


  }
320449
public static <T> BatchingCallback<T> batchInto(int size, Callback<? super List<T>> out)
    {
        return new BatchingCallback<T>(size, out);
    }
579024
public static <U extends Aggregate> List<Batch<U>> getBatches(List<U> list) {
        return getBatches(list, batchLimit);
    }
355089
@Override
    public Message receive() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "receive");

        try {
            return receive(0);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "receive");
        }
    }
628803
private void getBatchSize(String persistenceUnit, Map<String, Object> puProperties)
    {
        String batch_Size = puProperties != null ? (String) puProperties.get(PersistenceProperties.KUNDERA_BATCH_SIZE)
                : null;
        if (batch_Size != null)
        {
            setBatchSize(Integer.valueOf(batch_Size));
        }
        else
        {
            PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata,
                    persistenceUnit);
            setBatchSize(puMetadata.getBatchSize());
        }
    }
804079
byte[] encodeToBytes(EncodingLevel encodingLevel) throws JMSException {

        // If we haven't already got the encoding cached, encode & cache it now.
        if (cachedEncoding[encodingLevel.ordinal()] == null) {
            cachedEncoding[encodingLevel.ordinal()] = destEncoder.getMessageRepresentationFromDest(this, encodingLevel);
        }
        return cachedEncoding[encodingLevel.ordinal()];
    }
981885
protected void writeBatchSizeEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
        sb.append("\"batchSize\":");
        sb.append(execInfo.getBatchSize());
        sb.append(", ");
    }
415472
def send_batches(self, batch_list):
        
        if isinstance(batch_list, BaseMessage):
            batch_list = batch_list.SerializeToString()

        return self._post('/batches', batch_list)
1005537
public <T> void queue(StorageRequest<T> req, JsonBatchCallback<T> callback) throws IOException {
    checkState(
        !requestsExecutor.isShutdown() && !requestsExecutor.isTerminated(),
        "requestsExecutor should not be terminated to queue batch requests");
    if (maxRequestsPerBatch == 1) {
      responseFutures.add(
          requestsExecutor.submit(
              () -> {
                execute(req, callback);
                return null;
              }));
    } else {
      pendingRequests.add(batch -> req.queue(batch, callback));

      flushIfPossibleAndRequired();
    }
  }
1279631
def _get_queue_batch_size(self, queue):
        """"""

        # Fetch one item unless this is a batch queue.
        # XXX: It would be more efficient to loop in reverse order and break.
        batch_queues = self.config['BATCH_QUEUES']
        batch_size = 1
        for part in dotted_parts(queue):
            if part in batch_queues:
                batch_size = batch_queues[part]

        return batch_size