Mercurial > hg > Database > Alice
comparison src/main/java/alice/test/concurrent/SleepCodeSegment.java @ 419:aefbe41fcf12 dispose
change tab to space
author | sugi |
---|---|
date | Tue, 15 Jul 2014 16:00:22 +0900 |
parents | 8f71c3e6f11d |
children | 2fbd6ac705df |
comparison
equal
deleted
inserted
replaced
418:a269a019f5f8 | 419:aefbe41fcf12 |
---|---|
6 import alice.datasegment.CommandType; | 6 import alice.datasegment.CommandType; |
7 import alice.datasegment.Receiver; | 7 import alice.datasegment.Receiver; |
8 | 8 |
9 public class SleepCodeSegment extends CodeSegment { | 9 public class SleepCodeSegment extends CodeSegment { |
10 | 10 |
11 public Receiver ds1 = ids.create(CommandType.TAKE); | 11 public Receiver ds1 = ids.create(CommandType.TAKE); |
12 | |
13 private int num; | |
14 | |
15 public SleepCodeSegment(int i) { | |
16 this.num = i; | |
17 } | |
18 | 12 |
19 @Override | 13 private int num; |
20 public void run() { | 14 |
21 try { | 15 public SleepCodeSegment(int i) { |
22 Thread.sleep(1000); | 16 this.num = i; |
23 } catch (InterruptedException e) { | 17 } |
24 e.printStackTrace(); | 18 |
25 } | 19 @Override |
26 System.out.println("[CodeSegment-" + num + "] Hello, World!"); | 20 public void run() { |
27 | 21 try { |
28 ods.put("local", "finish", ValueFactory.createNilValue()); | 22 Thread.sleep(1000); |
29 } | 23 } catch (InterruptedException e) { |
24 e.printStackTrace(); | |
25 } | |
26 System.out.println("[CodeSegment-" + num + "] Hello, World!"); | |
27 | |
28 ods.put("local", "finish", ValueFactory.createNilValue()); | |
29 } | |
30 | 30 |
31 } | 31 } |