Details

      Description

      It might make sense to update Extent:

      public interface Extent<E> extends Iterable<E> {
      :
      :
      }

      and in PersistenceManager:

      Extent<T> getExtent (Class<T> cls, boolean subclasses);
      Extent<T> getExtent (Class<T> cls);

      This way, iteration over all the instances of a class could be simplified:

      for (Person person : pm.getExtent(Person.class))
      System.out.println(person.getName());

      1. jdo-542.patch
        3 kB
        Craig L Russell

        Activity

        Hide
        Craig L Russell added a comment -

        Changes were committed to svn.

        Show
        Craig L Russell added a comment - Changes were committed to svn.
        Hide
        Ilan Kirsh added a comment -

        The patch looks good as well as the proposal for the close issue.

        Show
        Ilan Kirsh added a comment - The patch looks good as well as the proposal for the close issue.
        Hide
        Craig L Russell added a comment -

        This patch implements the suggested change to Extent, adding Class<T> getCandidateClass().

        Show
        Craig L Russell added a comment - This patch implements the suggested change to Extent, adding Class<T> getCandidateClass().
        Hide
        Craig L Russell added a comment -

        This change seems non-controversial.

        Here's what I'd propose for the close issue:

        <proposed>
        There is a potential issue in case an implicit iterator is acquired by use of the iterator in a "for" construct, and not iterated to completion. To avoid leaking resources, an iterator is automatically closed if it completes; and must not be strongly referenced by the implementation. This allows the underlying resources to be garbage collected if the iterator itself is garbage collected.
        </proposed>

        Show
        Craig L Russell added a comment - This change seems non-controversial. Here's what I'd propose for the close issue: <proposed> There is a potential issue in case an implicit iterator is acquired by use of the iterator in a "for" construct, and not iterated to completion. To avoid leaking resources, an iterator is automatically closed if it completes; and must not be strongly referenced by the implementation. This allows the underlying resources to be garbage collected if the iterator itself is garbage collected. </proposed>
        Hide
        Ilan Kirsh added a comment -

        We should think what to do with Extent.close(iterator) when the iterator is implicit.

        Does calling close / closeAll in Extent is mandatory?
        Still closeAll can be used also in that case.

        Show
        Ilan Kirsh added a comment - We should think what to do with Extent.close(iterator) when the iterator is implicit. Does calling close / closeAll in Extent is mandatory? Still closeAll can be used also in that case.

          People

          • Assignee:
            Unassigned
            Reporter:
            Ilan Kirsh
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development