PageRenderTime 27ms CodeModel.GetById 17ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/kilim/examples/Group.java

http://github.com/kilim/kilim
Java | 29 lines | 20 code | 4 blank | 5 comment | 0 complexity | dd482aca3cf6f0380e5f453c82f8660f MD5 | raw file
 1/* Copyright (c) 2006, Sriram Srinivasan
 2 *
 3 * You may distribute this software under the terms of the license 
 4 * specified in the file "License"
 5 */
 6
 7package kilim.examples;
 8
 9import kilim.Pausable;
10import kilim.Task;
11import kilim.TaskGroup;
12
13public class Group {
14    public static void main(String[] args) {
15        TaskGroup tg = new TaskGroup();
16        tg.add(new GroupTask().start());
17        tg.add(new GroupTask().start());
18        tg.joinb();
19        System.exit(0);
20    }
21    
22    static class GroupTask extends Task {
23        public void execute() throws Pausable {
24            System.out.println("Task #" + id + "sleeping");
25            Task.sleep(1000);
26            System.out.println("Task #" + id + "done");
27        }
28    }
29}