Threads - An Example Of Thread Coordination In Java The...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
An Example Of Thread Coordination In Java The CreateReport Class package threading; /** * This main program instantiates CreatePartOfTheReport objects. * Creation date: (5/22/2001 7:51:29 PM) * @author: Bowman */ public class CreateReport { private int threadCount; // number of programs currently working on report parts. /** * CreateReport is the main controlling program. It prints the report. * Separate programs are started to complete each part of the report. * Each program "encapsulates" (contains) its own thread. * (The class CreatePartOfTheReport extends Thread, and its objects can * therefore be started() after they are instantiated.) * The CreateReport main thread, after initiating other programs to create * report parts, waits until all parts are ready before printing the report. */ public static void main(java.lang.String[] args) { CreateReport cr = new CreateReport(); CreatePartOfTheReport part1 = new CreatePartOfTheReport(cr, "Part 1"); cr.threadCount++; part1.start(); CreatePartOfTheReport part2 = new CreatePartOfTheReport(cr, "Part 2");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Threads - An Example Of Thread Coordination In Java The...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online