code: @Override
      public short incrementFailureCount(long taskId) throws Exception {
          String update = "UPDATE Task t SET t.RFAILS=t.RFAILS+1 WHERE t.ID=:i AND t.RFAILS<" + Short.MAX_VALUE;
          String find = "SELECT t.RFAILS FROM Task t WHERE t.ID=:i";
          final boolean trace = TraceComponent.isAnyTracingEnabled();
          if (trace && tc.isEntryEnabled())
              Tr.entry(this, tc, "incrementFailureCount", taskId, update, find);
  
          short consecutiveFailureCount;
          EntityManager em = getPersistenceServiceUnit().createEntityManager();
          try {
              Query updateQuery = em.createQuery(update.toString());
              updateQuery.setParameter("i", taskId);
              updateQuery.executeUpdate();
              TypedQuery<Short> findQuery = em.createQuery(find, Short.class);
              findQuery.setParameter("i", taskId);
              List<Short> results = findQuery.getResultList();
              consecutiveFailureCount = results.size() == 1 ? results.get(0) : -1;
          } finally {
              em.close();
          }
  
          if (trace && tc.isEntryEnabled())
              Tr.exit(this, tc, "incrementFailureCount", consecutiveFailureCount);
          return consecutiveFailureCount;
      }
docs: {@inheritDoc}