local_runtime_shared_jetty9/src/main/java/com/google/apphosting/utils/servlet/TaskQueueViewerServlet.java [236:321]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // If a QUEUE_NAME is supplied, then the tasks for that queue
    // are shown otherwise the list of queues are show.
    String selectedQueueName = req.getParameter(QUEUE_NAME);
    Map<String, QueueStateInfo> queueInfo = getQueueInfo();
    int start = getIntParam(req, START, 0);
    int numPerPage = getIntParam(req, NUM_PER_PAGE, 10);
    List<TaskStateInfo> taskPage = new ArrayList<TaskStateInfo>(numPerPage);

    int currentPage = start / numPerPage;
    int startIndex = currentPage * numPerPage;
    int countForQueue = 0;

    if (selectedQueueName != null) {
      // Generate information for one page of tasks.
      QueueStateInfo queueStateInfo = queueInfo.get(selectedQueueName);
      if (queueStateInfo != null) {
        req.setAttribute(LIST_QUEUE_NAME, selectedQueueName);
        req.setAttribute(LIST_QUEUE_INFO, queueStateInfo);
        List<TaskStateInfo> taskInfo = queueStateInfo.getTaskInfo();
        countForQueue = taskInfo.size();
        // Fix the case that the start index is larger than the count of items.
        if (startIndex >= countForQueue) {
          startIndex = countForQueue - 1;
          currentPage = startIndex / numPerPage;
          startIndex = currentPage * numPerPage;
        }

        // Make a collection of tasks (taskPage) for the current page.
        int lastItemIndex = numPerPage + startIndex;
        // Don't go past the end of the list.
        if (lastItemIndex > countForQueue) {
          lastItemIndex = countForQueue;
        }
        for (int index = startIndex; index < lastItemIndex; ++index) {
          taskPage.add(taskInfo.get(index));
        }
      }
    }

    int nextPage = currentPage + 1;
    int numPages = (int) ceil(countForQueue * (1.0 / numPerPage));

    int pageStart = (int) max(floor(currentPage - (MAX_PAGER_LINKS / 2)), 0);
    int pageEnd = min(pageStart + MAX_PAGER_LINKS, numPages);
    List<Page> pages = new ArrayList<Page>();
    // Page numbers are relative to 0 so we're adding 1 for display.
    for (int i = pageStart + 1; i < pageEnd + 1; ++i) {
      pages.add(new Page(i, (i - 1) * numPerPage));
    }

    Collection<String> queueNames = queueInfo.keySet();

    QueueBatch pushQueueInfo = new QueueBatch("Push Queues", true, true);
    QueueBatch pullQueueInfo = new QueueBatch("Pull Queues", false, false);
    for (Map.Entry<String, QueueStateInfo> entry : queueInfo.entrySet()) {
      if (entry.getValue().getMode() == Mode.PUSH) {
        pushQueueInfo.put(entry.getKey(), entry.getValue());
      } else {
        pullQueueInfo.put(entry.getKey(), entry.getValue());
      }
    }
    List<QueueBatch> queueStateInfo = new ArrayList<QueueBatch>();
    queueStateInfo.add(pushQueueInfo);
    queueStateInfo.add(pullQueueInfo);

    req.setAttribute(QUEUE_STATE_INFO, queueStateInfo);
    req.setAttribute(QUEUE_NAMES_LIST, queueNames);
    req.setAttribute(TASK_INFO_PAGE, taskPage);
    req.setAttribute(TASK_COUNT, countForQueue);
    req.setAttribute(APPLICATION_NAME, ApiProxy.getCurrentEnvironment().getAppId());
    req.setAttribute(PAGES, pages);
    req.setAttribute(CURRENT_PAGE, nextPage);
    req.setAttribute(START, startIndex);
    req.setAttribute(NUM_PER_PAGE, numPerPage);
    req.setAttribute(PREV_START, nextPage > 1 ? (nextPage - 2) * numPerPage : -1);
    req.setAttribute(NEXT_START, nextPage < numPages ? nextPage * numPerPage : -1);
    req.setAttribute(START_BASE_URL, filterURL(req, QUEUE_NAME, NUM_PER_PAGE));

    try {
      getServletContext().getRequestDispatcher(
          "/_ah/adminConsole?subsection=taskqueueViewer").forward(req, resp);
    } catch (ServletException e) {
      throw new RuntimeException("Could not forward request", e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



local_runtime_shared_jetty12/src/main/java/com/google/apphosting/utils/servlet/TaskQueueViewerServlet.java [236:321]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // If a QUEUE_NAME is supplied, then the tasks for that queue
    // are shown otherwise the list of queues are show.
    String selectedQueueName = req.getParameter(QUEUE_NAME);
    Map<String, QueueStateInfo> queueInfo = getQueueInfo();
    int start = getIntParam(req, START, 0);
    int numPerPage = getIntParam(req, NUM_PER_PAGE, 10);
    List<TaskStateInfo> taskPage = new ArrayList<TaskStateInfo>(numPerPage);

    int currentPage = start / numPerPage;
    int startIndex = currentPage * numPerPage;
    int countForQueue = 0;

    if (selectedQueueName != null) {
      // Generate information for one page of tasks.
      QueueStateInfo queueStateInfo = queueInfo.get(selectedQueueName);
      if (queueStateInfo != null) {
        req.setAttribute(LIST_QUEUE_NAME, selectedQueueName);
        req.setAttribute(LIST_QUEUE_INFO, queueStateInfo);
        List<TaskStateInfo> taskInfo = queueStateInfo.getTaskInfo();
        countForQueue = taskInfo.size();
        // Fix the case that the start index is larger than the count of items.
        if (startIndex >= countForQueue) {
          startIndex = countForQueue - 1;
          currentPage = startIndex / numPerPage;
          startIndex = currentPage * numPerPage;
        }

        // Make a collection of tasks (taskPage) for the current page.
        int lastItemIndex = numPerPage + startIndex;
        // Don't go past the end of the list.
        if (lastItemIndex > countForQueue) {
          lastItemIndex = countForQueue;
        }
        for (int index = startIndex; index < lastItemIndex; ++index) {
          taskPage.add(taskInfo.get(index));
        }
      }
    }

    int nextPage = currentPage + 1;
    int numPages = (int) ceil(countForQueue * (1.0 / numPerPage));

    int pageStart = (int) max(floor(currentPage - (MAX_PAGER_LINKS / 2)), 0);
    int pageEnd = min(pageStart + MAX_PAGER_LINKS, numPages);
    List<Page> pages = new ArrayList<Page>();
    // Page numbers are relative to 0 so we're adding 1 for display.
    for (int i = pageStart + 1; i < pageEnd + 1; ++i) {
      pages.add(new Page(i, (i - 1) * numPerPage));
    }

    Collection<String> queueNames = queueInfo.keySet();

    QueueBatch pushQueueInfo = new QueueBatch("Push Queues", true, true);
    QueueBatch pullQueueInfo = new QueueBatch("Pull Queues", false, false);
    for (Map.Entry<String, QueueStateInfo> entry : queueInfo.entrySet()) {
      if (entry.getValue().getMode() == Mode.PUSH) {
        pushQueueInfo.put(entry.getKey(), entry.getValue());
      } else {
        pullQueueInfo.put(entry.getKey(), entry.getValue());
      }
    }
    List<QueueBatch> queueStateInfo = new ArrayList<QueueBatch>();
    queueStateInfo.add(pushQueueInfo);
    queueStateInfo.add(pullQueueInfo);

    req.setAttribute(QUEUE_STATE_INFO, queueStateInfo);
    req.setAttribute(QUEUE_NAMES_LIST, queueNames);
    req.setAttribute(TASK_INFO_PAGE, taskPage);
    req.setAttribute(TASK_COUNT, countForQueue);
    req.setAttribute(APPLICATION_NAME, ApiProxy.getCurrentEnvironment().getAppId());
    req.setAttribute(PAGES, pages);
    req.setAttribute(CURRENT_PAGE, nextPage);
    req.setAttribute(START, startIndex);
    req.setAttribute(NUM_PER_PAGE, numPerPage);
    req.setAttribute(PREV_START, nextPage > 1 ? (nextPage - 2) * numPerPage : -1);
    req.setAttribute(NEXT_START, nextPage < numPages ? nextPage * numPerPage : -1);
    req.setAttribute(START_BASE_URL, filterURL(req, QUEUE_NAME, NUM_PER_PAGE));

    try {
      getServletContext().getRequestDispatcher(
          "/_ah/adminConsole?subsection=taskqueueViewer").forward(req, resp);
    } catch (ServletException e) {
      throw new RuntimeException("Could not forward request", e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



local_runtime_shared_jetty12/src/main/java/com/google/apphosting/utils/servlet/ee10/TaskQueueViewerServlet.java [236:321]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // If a QUEUE_NAME is supplied, then the tasks for that queue
    // are shown otherwise the list of queues are show.
    String selectedQueueName = req.getParameter(QUEUE_NAME);
    Map<String, QueueStateInfo> queueInfo = getQueueInfo();
    int start = getIntParam(req, START, 0);
    int numPerPage = getIntParam(req, NUM_PER_PAGE, 10);
    List<TaskStateInfo> taskPage = new ArrayList<TaskStateInfo>(numPerPage);

    int currentPage = start / numPerPage;
    int startIndex = currentPage * numPerPage;
    int countForQueue = 0;

    if (selectedQueueName != null) {
      // Generate information for one page of tasks.
      QueueStateInfo queueStateInfo = queueInfo.get(selectedQueueName);
      if (queueStateInfo != null) {
        req.setAttribute(LIST_QUEUE_NAME, selectedQueueName);
        req.setAttribute(LIST_QUEUE_INFO, queueStateInfo);
        List<TaskStateInfo> taskInfo = queueStateInfo.getTaskInfo();
        countForQueue = taskInfo.size();
        // Fix the case that the start index is larger than the count of items.
        if (startIndex >= countForQueue) {
          startIndex = countForQueue - 1;
          currentPage = startIndex / numPerPage;
          startIndex = currentPage * numPerPage;
        }

        // Make a collection of tasks (taskPage) for the current page.
        int lastItemIndex = numPerPage + startIndex;
        // Don't go past the end of the list.
        if (lastItemIndex > countForQueue) {
          lastItemIndex = countForQueue;
        }
        for (int index = startIndex; index < lastItemIndex; ++index) {
          taskPage.add(taskInfo.get(index));
        }
      }
    }

    int nextPage = currentPage + 1;
    int numPages = (int) ceil(countForQueue * (1.0 / numPerPage));

    int pageStart = (int) max(floor(currentPage - (MAX_PAGER_LINKS / 2)), 0);
    int pageEnd = min(pageStart + MAX_PAGER_LINKS, numPages);
    List<Page> pages = new ArrayList<Page>();
    // Page numbers are relative to 0 so we're adding 1 for display.
    for (int i = pageStart + 1; i < pageEnd + 1; ++i) {
      pages.add(new Page(i, (i - 1) * numPerPage));
    }

    Collection<String> queueNames = queueInfo.keySet();

    QueueBatch pushQueueInfo = new QueueBatch("Push Queues", true, true);
    QueueBatch pullQueueInfo = new QueueBatch("Pull Queues", false, false);
    for (Map.Entry<String, QueueStateInfo> entry : queueInfo.entrySet()) {
      if (entry.getValue().getMode() == Mode.PUSH) {
        pushQueueInfo.put(entry.getKey(), entry.getValue());
      } else {
        pullQueueInfo.put(entry.getKey(), entry.getValue());
      }
    }
    List<QueueBatch> queueStateInfo = new ArrayList<QueueBatch>();
    queueStateInfo.add(pushQueueInfo);
    queueStateInfo.add(pullQueueInfo);

    req.setAttribute(QUEUE_STATE_INFO, queueStateInfo);
    req.setAttribute(QUEUE_NAMES_LIST, queueNames);
    req.setAttribute(TASK_INFO_PAGE, taskPage);
    req.setAttribute(TASK_COUNT, countForQueue);
    req.setAttribute(APPLICATION_NAME, ApiProxy.getCurrentEnvironment().getAppId());
    req.setAttribute(PAGES, pages);
    req.setAttribute(CURRENT_PAGE, nextPage);
    req.setAttribute(START, startIndex);
    req.setAttribute(NUM_PER_PAGE, numPerPage);
    req.setAttribute(PREV_START, nextPage > 1 ? (nextPage - 2) * numPerPage : -1);
    req.setAttribute(NEXT_START, nextPage < numPages ? nextPage * numPerPage : -1);
    req.setAttribute(START_BASE_URL, filterURL(req, QUEUE_NAME, NUM_PER_PAGE));

    try {
      getServletContext().getRequestDispatcher(
          "/_ah/adminConsole?subsection=taskqueueViewer").forward(req, resp);
    } catch (ServletException e) {
      throw new RuntimeException("Could not forward request", e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



