code: @Override
      public boolean remove(long taskId, String owner, boolean removeIfEnded) throws Exception {
          StringBuilder delete = new StringBuilder(66)
                          .append("DELETE FROM Task t WHERE t.ID=:i");
          if (!removeIfEnded)
              delete.append(" AND t.STATES<").append(TaskState.ENDED.bit);
          if (owner != null)
              delete.append(" AND t.OWNR=:o");
  
          final boolean trace = TraceComponent.isAnyTracingEnabled();
          if (trace && tc.isEntryEnabled())
              Tr.entry(this, tc, "remove", taskId, owner, removeIfEnded, delete);
  
          EntityManager em = getPersistenceServiceUnit().createEntityManager();
          try {
              Query query = em.createQuery(delete.toString());
              query.setParameter("i", taskId);
              if (owner != null)
                  query.setParameter("o", owner);
  
              boolean removed = query.executeUpdate() > 0;
  
              if (trace && tc.isEntryEnabled())
                  Tr.exit(this, tc, "remove", removed);
              return removed;
          } finally {
              em.close();
          }
      }
docs: {@inheritDoc}