Don't refer to RequestProcessor in fields of MetaInfServicesLookup separate-lookup-170056
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 31 Oct 2009 15:06:58 +0100
branchseparate-lookup-170056
changeset 840cacaeb2ec7f3
parent 839 9a12cc406da3
child 841 fd5b0861df41
Don't refer to RequestProcessor in fields of MetaInfServicesLookup
openide.util/src/org/openide/util/lookup/MetaInfServicesLookup.java
openide.util/test/unit/src/org/openide/util/lookup/MetaInfServicesLookupTest.java
     1.1 --- a/openide.util/src/org/openide/util/lookup/MetaInfServicesLookup.java	Fri Oct 30 10:41:18 2009 -0400
     1.2 +++ b/openide.util/src/org/openide/util/lookup/MetaInfServicesLookup.java	Sat Oct 31 15:06:58 2009 +0100
     1.3 @@ -57,6 +57,7 @@
     1.4  import java.util.List;
     1.5  import java.util.Map;
     1.6  import java.util.WeakHashMap;
     1.7 +import java.util.concurrent.Executor;
     1.8  import java.util.logging.Level;
     1.9  import java.util.logging.Logger;
    1.10  import org.openide.util.Lookup;
    1.11 @@ -70,7 +71,7 @@
    1.12  final class MetaInfServicesLookup extends AbstractLookup {
    1.13  
    1.14      private static final Logger LOGGER = Logger.getLogger(MetaInfServicesLookup.class.getName());
    1.15 -    static final RequestProcessor RP = new RequestProcessor(MetaInfServicesLookup.class.getName(), 1);
    1.16 +    static final Executor RP = new RequestProcessor(MetaInfServicesLookup.class.getName(), 1);
    1.17      private static int knownInstancesCount;
    1.18      private static final List<Reference<Object>> knownInstances;
    1.19      static {
     2.1 --- a/openide.util/test/unit/src/org/openide/util/lookup/MetaInfServicesLookupTest.java	Fri Oct 30 10:41:18 2009 -0400
     2.2 +++ b/openide.util/test/unit/src/org/openide/util/lookup/MetaInfServicesLookupTest.java	Sat Oct 31 15:06:58 2009 +0100
     2.3 @@ -410,7 +410,22 @@
     2.4          });
     2.5          assertNotNull("Interface found", l.lookup(xface));
     2.6          assertFalse(event.get());
     2.7 -        MetaInfServicesLookup.RP.post(new Runnable() {public void run() {}}).waitFinished();
     2.8 +        class W implements Runnable {
     2.9 +            boolean ok;
    2.10 +            public synchronized void run() {
    2.11 +                ok = true;
    2.12 +                notifyAll();
    2.13 +            }
    2.14 +
    2.15 +            public synchronized void await() throws Exception {
    2.16 +                while (!ok) {
    2.17 +                    wait();
    2.18 +                }
    2.19 +            }
    2.20 +        }
    2.21 +        W w = new W();
    2.22 +        MetaInfServicesLookup.RP.execute(w);
    2.23 +        w.await();
    2.24          assertEquals("Now two", 2, res.allInstances().size());
    2.25      }
    2.26