This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 151267
Collapse All | Expand All

(-)a/java.source/src/org/netbeans/modules/java/source/usages/RepositoryUpdater.java (-5 / +41 lines)
Lines 617-622 Link Here
617
        if (!noscan) {
617
        if (!noscan) {
618
            synchronized (this) {
618
            synchronized (this) {
619
                this.noSubmited++;
619
                this.noSubmited++;
620
                LOGGER.log(Level.WARNING, "submit()+: " + this.noSubmited);
620
            }
621
            }
621
            final CompileWorker cw = new CompileWorker (work);
622
            final CompileWorker cw = new CompileWorker (work);
622
            JavaSource.Priority p;
623
            JavaSource.Priority p;
Lines 771-778 Link Here
771
        Reference<Task> taskRef = url2CompileWithDepsTask.get(root);
772
        Reference<Task> taskRef = url2CompileWithDepsTask.get(root);
772
        Task t = taskRef != null ? taskRef.get() : null;
773
        Task t = taskRef != null ? taskRef.get() : null;
773
        Collection<File> storedFiles;
774
        Collection<File> storedFiles;
775
        Boolean can = null;
776
777
        LOGGER.log(Level.WARNING, "t: " + t);
774
        
778
        
775
        if (t == null || !t.cancel()) {
779
        if (t == null || (can = !t.cancel())) {
780
            if (can != null) {
781
                 LOGGER.log(Level.WARNING, "canceling: " + System.identityHashCode(t) + ", " + can);
782
            }
776
            if (lockRU == 0 || t != null) {
783
            if (lockRU == 0 || t != null) {
777
                storedFiles = new LinkedHashSet<File>();
784
                storedFiles = new LinkedHashSet<File>();
778
                url2CompileWithDeps.put(root, storedFiles);
785
                url2CompileWithDeps.put(root, storedFiles);
Lines 788-793 Link Here
788
                //the task either does not exist, or has been already started - create new one:
795
                //the task either does not exist, or has been already started - create new one:
789
                LOGGER.log(Level.FINER, "creating a new task for root: {0}", root.toExternalForm());
796
                LOGGER.log(Level.FINER, "creating a new task for root: {0}", root.toExternalForm());
790
                final Collection<File> storedFilesFin = storedFiles;
797
                final Collection<File> storedFilesFin = storedFiles;
798
                final Task[] tt = new Task[1];
791
                t = WORKER.create(new Runnable() {
799
                t = WORKER.create(new Runnable() {
792
                    public void run() {
800
                    public void run() {
793
                        synchronized (RepositoryUpdater.this) {
801
                        synchronized (RepositoryUpdater.this) {
Lines 795-819 Link Here
795
                        }
803
                        }
796
                        submit(Work.compileWithDeps(root, storedFilesFin));
804
                        submit(Work.compileWithDeps(root, storedFilesFin));
797
                        noSubmited--;
805
                        noSubmited--;
806
                        LOGGER.log(Level.WARNING, "assureCompiledWithDeps-: " + noSubmited + ":" + System.identityHashCode(tt[0]));
798
                    }
807
                    }
799
                });
808
                });
800
                url2CompileWithDepsTask.put(root, new WeakReference<Task>(t));
809
                tt[0] = t;
810
                class WR extends WeakReference<Task> implements Runnable {
811
812
                    long l;
813
                    public WR(Task t) {
814
                        super(t, Utilities.activeReferenceQueue());
815
                        l = System.identityHashCode(t);
816
                    }
817
818
                    public void run() {
819
                         LOGGER.log(Level.WARNING, "GCing: " + l);
820
                    }
821
822
                }
823
                url2CompileWithDepsTask.put(root, new WR(t));
801
                compileScheduled++;
824
                compileScheduled++;
802
                noSubmited++;
825
                LOGGER.log(Level.WARNING, "assureCompiledWithDeps+: " + noSubmited + ":" + System.identityHashCode(t));
803
            } else {
826
            } else {
804
                url2CompileWithDepsTask.remove(root);
827
                url2CompileWithDepsTask.remove(root);
805
            }
828
            }
806
        } else {
829
        } else {
807
            storedFiles = url2CompileWithDeps.get(root);
830
            storedFiles = url2CompileWithDeps.get(root);
831
            if (can != null) {
832
                 LOGGER.log(Level.WARNING, "2. canceling: " + System.identityHashCode(t) + ", " + can);
833
            }
834
            if (t != null) {
835
                noSubmited--;
836
            }
808
        }
837
        }
809
        
838
        
810
        assert storedFiles != null;
839
        assert storedFiles != null;
811
840
812
        storedFiles.add(file);
841
        storedFiles.add(file);
813
        
842
843
        LOGGER.log(Level.WARNING, "lockRU: " + lockRU);
844
814
        if (lockRU > 0) {
845
        if (lockRU > 0) {
815
            compileWithDepsToBeScheduled = true;
846
            compileWithDepsToBeScheduled = true;
816
        } else {
847
        } else {
848
            LOGGER.log(Level.WARNING, "scheduling: " + System.identityHashCode(t));
849
            noSubmited++;
817
            t.schedule(DELAY);
850
            t.schedule(DELAY);
818
        }
851
        }
819
    }
852
    }
Lines 914-922 Link Here
914
                        public void run() {
947
                        public void run() {
915
                            submit(Work.compileWithDeps(root, storedFilesFin));
948
                            submit(Work.compileWithDeps(root, storedFilesFin));
916
                            noSubmited--;
949
                            noSubmited--;
950
                            LOGGER.log(Level.WARNING, "unlockRU-: " + noSubmited);
917
                        }
951
                        }
918
                    });
952
                    });
919
                    noSubmited++;
953
                    noSubmited++;
954
                    LOGGER.log(Level.WARNING, "unlockRU+: " + noSubmited);
920
                    url2CompileWithDepsTask.put(root, new WeakReference<Task>(t));
955
                    url2CompileWithDepsTask.put(root, new WeakReference<Task>(t));
921
                }
956
                }
922
957
Lines 1302-1308 Link Here
1302
                    boolean continuation = false;
1337
                    boolean continuation = false;
1303
                    try {
1338
                    try {
1304
                    final WorkType type = work.getType();                        
1339
                    final WorkType type = work.getType();                        
1305
                    LOGGER.finer ("Request for: " + type);      //NOI18N
1340
                    LOGGER.warning("Request for: " + type);      //NOI18N
1306
                    switch (type) {
1341
                    switch (type) {
1307
                        case FILTER_CHANGED:
1342
                        case FILTER_CHANGED:
1308
                        {
1343
                        {
Lines 1614-1619 Link Here
1614
                    if (!continuation) {
1649
                    if (!continuation) {
1615
                        synchronized (RepositoryUpdater.this) {
1650
                        synchronized (RepositoryUpdater.this) {
1616
                            RepositoryUpdater.this.noSubmited--;
1651
                            RepositoryUpdater.this.noSubmited--;
1652
                            LOGGER.log(Level.WARNING, "compileWorker.run()-: " + noSubmited);
1617
                            if (RepositoryUpdater.this.noSubmited == 0) {
1653
                            if (RepositoryUpdater.this.noSubmited == 0) {
1618
                                RepositoryUpdater.this.notifyAll();
1654
                                RepositoryUpdater.this.notifyAll();
1619
                            }
1655
                            }

Return to bug 151267