Mercurial > hg > Members > tatsuki > Alice
annotate src/alice/codesegment/OutputDataSegment.java @ 176:4658bf530834 working
remove ant warning
author | e095732 |
---|---|
date | Tue, 29 Jan 2013 10:30:41 +0900 |
parents | 1044a79ce4ef |
children | 8d3cb7e5fa57 |
rev | line source |
---|---|
11 | 1 package alice.codesegment; |
2 | |
34
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
3 import java.io.IOException; |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
4 |
126 | 5 |
11 | 6 import org.msgpack.type.Value; |
30 | 7 import org.msgpack.type.ValueFactory; |
11 | 8 |
9 import alice.datasegment.DataSegment; | |
10 | |
11 public class OutputDataSegment { | |
12 | |
13 public void put(String managerKey, String key, Value val) { | |
132 | 14 DataSegment.get(managerKey).put(key, val); |
11 | 15 } |
16 | |
17 public void update(String managerKey, String key, Value val) { | |
132 | 18 DataSegment.get(managerKey).update(key, val); |
11 | 19 } |
20 | |
30 | 21 public void put(String managerKey, String key, String val) { |
132 | 22 DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val)); |
30 | 23 } |
24 | |
25 public void update(String managerKey, String key, String val) { | |
132 | 26 DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val)); |
30 | 27 } |
28 | |
60 | 29 public void put(String managerKey, String key, byte[] val) { |
132 | 30 DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val, true)); |
60 | 31 } |
32 | |
33 public void update(String managerKey, String key, byte[] val) { | |
132 | 34 DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val, true)); |
60 | 35 } |
36 | |
30 | 37 public void put(String managerKey, String key, int val) { |
132 | 38 DataSegment.get(managerKey).put(key, ValueFactory.createIntegerValue(val)); |
30 | 39 } |
40 | |
41 public void update(String managerKey, String key, int val) { | |
132 | 42 DataSegment.get(managerKey).update(key, ValueFactory.createIntegerValue(val)); |
30 | 43 } |
44 | |
34
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
45 public <T> void put(String managerKey, String key, T val) { |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
46 try { |
132 | 47 DataSegment.get(managerKey).put(key, SingletonMessage.getInstance().unconvert(val)); |
34
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
48 } catch (IOException e) { |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
49 e.printStackTrace(); |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
50 } |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
51 } |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
52 |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
53 public <T> void update(String managerKey, String key, T val) { |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
54 try { |
132 | 55 DataSegment.get(managerKey).update(key, SingletonMessage.getInstance().unconvert(val)); |
34
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
56 } catch (IOException e) { |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
57 e.printStackTrace(); |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
58 } |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
59 } |
ca079a730d0b
added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
30
diff
changeset
|
60 |
76
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
61 /** |
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
62 * kill the Alice process after send other messages. |
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
63 * |
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
64 * @param managerKey |
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
65 */ |
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
66 |
30 | 67 public void finish(String managerKey) { |
68 DataSegment.get(managerKey).finish(); | |
69 } | |
70 | |
76
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
71 /** |
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
72 * close socket for RemoteDataSegment after send other messages. |
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
73 * |
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
74 * @param managerKey |
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
75 */ |
4a2ecd0a5e8f
refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
76 |
41 | 77 public void close(String managerKey) { |
78 DataSegment.get(managerKey).close(); | |
79 } | |
30 | 80 |
11 | 81 } |