code: @Override
      public List<Object[]> findUpcomingTasks(long partition, long maxNextExecTime, Integer maxResults) throws Exception {
          StringBuilder find = new StringBuilder(129)
                          .append("SELECT t.ID,t.MBITS,t.NEXTEXEC,t.TXTIMEOUT FROM Task t WHERE t.PARTN=:p AND t.STATES<")
                          .append(TaskState.SUSPENDED.bit)
                          .append(" AND t.NEXTEXEC<=:m ORDER BY t.NEXTEXEC");
  
          final boolean trace = TraceComponent.isAnyTracingEnabled();
          if (trace && tc.isEntryEnabled())
              Tr.entry(this, tc, "findUpcomingTasks", partition, Utils.appendDate(new StringBuilder(30), maxNextExecTime), maxResults, find);
  
          List<Object[]> resultList;
          EntityManager em = getPersistenceServiceUnit().createEntityManager();
          try {
              TypedQuery<Object[]> query = em.createQuery(find.toString(), Object[].class);
              query.setParameter("p", partition);
              query.setParameter("m", maxNextExecTime);
              if (maxResults != null)
                  query.setMaxResults(maxResults);
              List<Object[]> results = query.getResultList();
              resultList = results;
          } finally {
              em.close();
          }
  
          if (trace && tc.isEntryEnabled())
              Tr.exit(this, tc, "findUpcomingTasks", resultList.size());
          return resultList;
      }
docs: {@inheritDoc}