weakly referenced paged queries

From: Øyvind Harboe (oyvind.harbo..ylin.com)
Date: Fri Jun 20 2008 - 09:46:06 EDT

  • Next message: Elena Doyle: "RE: Configuring SSL"

    I'm toying around with weak references in paged queries.

    This turned out to be rather hairy from the point of view that
    a query is supposed to return a List and this List has
    to live up to a lot of expectations from the calling code +
    promises of the List interfaces.

    Consider two of the subList implementations in IncrementalFaultList:

    a)

        public List<E> subList(int fromIndex, int toIndex) {
            synchronized (elements) {
                resolveInterval(fromIndex, toIndex);
                return elements.subList(fromIndex, toIndex);
            }
        }

    b)

        public List<E> subList(int fromIndex, int toIndex) {
                List<E> l=new LinkedList<E>();
                for (int i=fromIndex; i<toIndex; i++)
                {
                        l.add(get(i));
                }
                return l;
        }

    1. JavaDoc states that list.subList(from, to).clear() will clear that
    range. Here b) is broken.

    2. I was greatly surprised to see synchronized() for the list returned
    from the query. Is the synchronisation for the benefit of the
    calling code or the implementation?

    Attached is the work in progress. First and foremost I'm after measuring
    the performance of such an implementation. So far it doesn't look very
    promising. It does use less memory but it is dog slow. Will tinker with it more.

    -- 
    Øyvind Harboe
    http://www.zylin.com/zy1000.html
    ARM7 ARM9 XScale Cortex
    JTAG debugger and flash programmer
    



    This archive was generated by hypermail 2.0.0 : Fri Jun 20 2008 - 09:46:43 EDT