Java Reference
In-Depth Information
}
}
} else {
Runnable task = new GZipRunnable ( f );
pool . submit ( task );
}
}
}
pool . shutdown ();
}
}
Once you have added all the files to the pool, you call pool.shutdown() . Chances are
this happens while there's still work to be done. This method does not abort pending
jobs. It simply notifies the pool that no further tasks will be added to its internal queue
and that it should shut down once it has finished all pending work.
Shutting down like this is mostly atypical of the heavily threaded network programs
you'll write because it does have such a definite ending point: the point at which all files
are processed. Most network servers continue indefinitely until shut down through an
administration interface. In those cases, you may want to invoke shutdownNow() instead
to abort currently processing tasks and skip any pending tasks.
Search WWH ::




Custom Search