Executorservice

public interface ExecutorService extends Executor

An Executor that provides methods to manage termination and methods that can produce a Future for tracking progress of one or more asynchronous tasks.

The following example includes two classes. PrintTask.java creates threads that sleep for a random time (0-5 secs). RunnableTester.java executes the PrintTask threads using a fixed thread pool.

PrintTask.java

RunnableTester.java

Need More Help?

See also:

More Examples on Java

java

Special Discounts for Students

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.