ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ThreadPoolExecutor.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ThreadPoolExecutor.java (file contents):
Revision 1.6 by dl, Fri Jun 6 18:42:18 2003 UTC vs.
Revision 1.7 by dl, Wed Jun 11 13:17:21 2003 UTC

# Line 776 | Line 776 | public class ThreadPoolExecutor implemen
776  
777  
778      /**
779 +     * Removes from the work queue all {@ link Cancellable} tasks
780 +     * that have been cancelled. This method can be useful as a
781 +     * storage reclamation operation, that has no other impact
782 +     * on functionality. Cancelled tasks are never executed, but
783 +     * may accumulate in work queues until worker threads can
784 +     * actively remove them. Invoking this method ensures that they
785 +     * are instead removed now.
786 +     */
787 +
788 +    public void purge() {
789 +        Iterator<Runnable> it = getQueue().iterator();
790 +        while (it.hasNext()) {
791 +            Runnable r = it.next();
792 +            if (r instanceof Cancellable) {
793 +                Cancellable c = (Cancellable)r;
794 +                if (c.isCancelled())
795 +                    it.remove();
796 +            }
797 +        }
798 +    }
799 +
800 +    /**
801       * Sets the core number of threads.  This overrides any value set
802       * in the constructor.  If the new value is smaller than the
803       * current value, excess existing threads will be terminated when

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines