Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: core
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      488

      Description

      DebugList doesn't currently allow passing in of a publisher and lock, which
      causes problems when debugging composite list based pipelines.

      The following patch adds this (note the delegation of equals() and hashcode() in
      DebugReadWriteLock - this is necessary for composite list to not complain.

      Index: source/ca/odell/glazedlists/DebugList.java
      ===================================================================
      RCS file: /cvs/glazedlists/source/ca/odell/glazedlists/DebugList.java,v
      retrieving revision 1.6
      diff -u -r1.6 DebugList.java
      — source/ca/odell/glazedlists/DebugList.java 15 Mar 2009 12:36:58 -0000 1.6
      +++ source/ca/odell/glazedlists/DebugList.java 27 Jan 2010 15:40:26 -0000
      @@ -67,7 +67,7 @@

      • sense for the list pipeline.
        */
        public DebugList() { - this(null, new DebugReadWriteLock()); + this(null, LockFactory.DEFAULT.createReadWriteLock()); }

      /**
      @@ -76,8 +76,8 @@

      • particularly useful when multiple {@link DebugList}

        s are used within a

      • {@link CompositeList}

        and must share the same lock and publisher.
        */

      • private DebugList(ListEventPublisher publisher, DebugReadWriteLock
        debugReadWriteLock) {
      • this.debugReadWriteLock = debugReadWriteLock;
        + public DebugList(ListEventPublisher publisher, ReadWriteLock readWriteLock) {
        + this.debugReadWriteLock = new DebugReadWriteLock(readWriteLock);

      // use a normal BasicEventList as the delegate implementation
      this.delegate = new BasicEventList<E>(publisher, this.debugReadWriteLock);
      @@ -446,16 +446,21 @@

      • Thread holds the read or write lock.
        */
        private static class DebugReadWriteLock implements ReadWriteLock {
        + private final ReadWriteLock decorated;
        private final DebugLock readLock;
        private final DebugLock writeLock;

      public DebugReadWriteLock()

      { // decorate normaly read/write locks with Thread recording - final ReadWriteLock decorated = LockFactory.DEFAULT.createReadWriteLock(); + this(LockFactory.DEFAULT.createReadWriteLock()); + }

      +
      + public DebugReadWriteLock(ReadWriteLock decorated)

      { + this.decorated = decorated; this.readLock = new DebugLock(decorated.readLock()); this.writeLock = new DebugLock(decorated.writeLock()); }

      -
      +
      public Lock readLock()

      { return readLock; }

      public Lock writeLock()

      { return writeLock; }

      @@ -467,6 +472,17 @@
      return
      writeLock.getThreadsHoldingLock().contains(Thread.currentThread());
      }

      + public boolean equals(Object obj) {
      + if (obj instanceof ReadWriteLock)

      { + return decorated.equals(obj); + }

      + return false;
      + }
      +
      + public int hashCode()

      { + return decorated.hashCode(); + }

      +
      /**

      • Returns <tt>true</tt> if the current Thread holds the read lock or
      • write lock.

        Activity

        Hide
        brands added a comment -

        Will something like the following not work for your needs?

        DebugList m1 = new DebugList();
        CompositeList composed = new CompositeList(m1.getPublisher(),
        m1.getReadWriteLock());
        composed.addMemberList(m1);
        DebugList m2 = m1.createNewDebugList();
        composed.addMemberList(m2);

        Show
        brands added a comment - Will something like the following not work for your needs? DebugList m1 = new DebugList(); CompositeList composed = new CompositeList(m1.getPublisher(), m1.getReadWriteLock()); composed.addMemberList(m1); DebugList m2 = m1.createNewDebugList(); composed.addMemberList(m2);

          People

          • Assignee:
            jessewilson
            Reporter:
            trumpetinc
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: