Mercurial > hg > Members > tatsuki > Alice
changeset 220:9fe7afd7d292 working
merge
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 27 Mar 2013 21:14:59 +0900 |
parents | 665ccc899b3b (current diff) d50cddf64396 (diff) |
children | c1ce849e6417 c2bf9a71005e |
files | |
diffstat | 45 files changed, 345 insertions(+), 330 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/codesegment/InputDataSegment.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/codesegment/InputDataSegment.java Wed Mar 27 21:14:59 2013 +0900 @@ -5,6 +5,7 @@ import alice.datasegment.Command; import alice.datasegment.CommandType; import alice.datasegment.DataSegment; +import alice.datasegment.ReceiveRemoteData; import alice.datasegment.Receiver; /** @@ -54,17 +55,17 @@ public void take(Receiver receiver, String key, int index) { DataSegment.getLocal().take(receiver, key, index, cs); } - - public void flip(Command cmd) { - DataSegment.getLocal().flip(cmd); - } public void reply(Receiver receiver, Command reply) { receiver.index = reply.index; - receiver.val = reply.val; receiver.from = reply.reverseKey; - receiver.obj = reply.obj; - receiver.setCommand(reply); + if (reply.reverseKey==null){ + receiver.setData(new ReceiveRemoteData(reply.val)); + } else if (!reply.reverseKey.equals("local")) { + receiver.setData(new ReceiveRemoteData(reply.val)); + } else { + receiver.setData(new ReceiveLocalData(reply.obj)); + } receive(); }
--- a/src/alice/codesegment/OutputDataSegment.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/codesegment/OutputDataSegment.java Wed Mar 27 21:14:59 2013 +0900 @@ -6,158 +6,143 @@ import org.msgpack.type.Value; import org.msgpack.type.ValueFactory; -import alice.datasegment.Command; -import alice.datasegment.CommandType; import alice.datasegment.DataSegment; -import alice.datasegment.DataSegmentKey; import alice.datasegment.Receiver; -import alice.test.codesegment.local.bitonicsort.DataList; public class OutputDataSegment { - + /** * for local */ - public <T> void put(String key, T val,Boolean covertFlag) { - if (covertFlag){ - put(key, val); - } else { - DataSegment.getLocal().put(key, val); - } - } - - public <T> void update(String key, T val,Boolean covertFlag) { - if (covertFlag){ - update(key, val); - } else { - DataSegment.getLocal().update(key, val); - } - } - + public void flip(Receiver receiver) { - //DataSegment.getLocal().put(receiver.key, receiver.val,receiver.obj); - DataSegmentKey key = DataSegment.getLocal().getDataSegmentKey(receiver.key); - key.runCommand(new Command(CommandType.PUT,null,null, receiver.val,receiver.obj, 0,0,null,null, "local")); + DataSegment.getLocal().putObject(receiver.key, receiver.getObj()); } - - public void put(String key, Value val) { - DataSegment.getLocal().put(key, val); - } - + public void put(String key, String val) { - DataSegment.getLocal().put(key, ValueFactory.createRawValue(val)); + DataSegment.getLocal().putObject(key, val); } - + public void put(String key, byte[] val) { - DataSegment.getLocal().put(key, ValueFactory.createRawValue(val, true)); + DataSegment.getLocal().putObject(key, val); } - + public void put(String key, int val) { - DataSegment.getLocal().put(key, ValueFactory.createIntegerValue(val)); + DataSegment.getLocal().putObject(key, val); } - + public <T> void put(String key, T val) { - try { - DataSegment.getLocal().put(key, SingletonMessage.getInstance().unconvert(val)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public void put(Receiver receiver, String key, Object obj, boolean flag) { - DataSegment.getLocal().put(receiver, key, obj); + DataSegment.getLocal().putObject(key, val); } - - public void update(Receiver receiver, String key, Object obj, boolean flag) { - DataSegment.getLocal().update(receiver, key, obj); - } - - - public void update(String key, Value val) { - DataSegment.getLocal().update(key, val); - } - + public void update(String key, String val) { - DataSegment.getLocal().update(key, ValueFactory.createRawValue(val)); + DataSegment.getLocal().updateObject(key, val); } - + public void update(String key, byte[] val) { - DataSegment.getLocal().update(key, ValueFactory.createRawValue(val, true)); - } - - public void update(String key, int val) { - DataSegment.getLocal().update(key, ValueFactory.createIntegerValue(val)); + DataSegment.getLocal().updateObject(key, val); } - + + public void update(String key, int val) { + DataSegment.getLocal().updateObject(key, val); + } + public <T> void update(String key, T val) { - try { - long t = System.currentTimeMillis(); - DataSegment.getLocal().update(key, SingletonMessage.getInstance().unconvert(val)); - System.out.println(System.currentTimeMillis() - t); - } catch (IOException e) { - e.printStackTrace(); - } + DataSegment.getLocal().updateObject(key, val); } - - + + /** * for remote */ - + public void put(String managerKey, String key, Value val) { DataSegment.get(managerKey).put(key, val); } - + public void put(String managerKey, String key, String val) { - DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val)); - } - - public void put(String managerKey, String key, byte[] val) { - DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val, true)); + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val)); + } else { + put(key, val); + } + } - - public void put(String managerKey, String key, int val) { - DataSegment.get(managerKey).put(key, ValueFactory.createIntegerValue(val)); - } - - public <T> void put(String managerKey, String key, T val) { - try { - DataSegment.get(managerKey).put(key, SingletonMessage.getInstance().unconvert(val)); - } catch (IOException e) { - e.printStackTrace(); + + public void put(String managerKey, String key, byte[] val) { + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val, true)); + } else { + put(key, val); } } - + + public void put(String managerKey, String key, int val) { + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).put(key, ValueFactory.createIntegerValue(val)); + } else { + put(key, val); + } + } + + public <T> void put(String managerKey, String key, T val) { + if (!managerKey.equals("local")){ + try { + DataSegment.get(managerKey).put(key, SingletonMessage.getInstance().unconvert(val)); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + put(key, val); + } + } + public void update(String managerKey, String key, Value val) { DataSegment.get(managerKey).update(key, val); } - + public void update(String managerKey, String key, String val) { - DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val)); - } - - public void update(String managerKey, String key, byte[] val) { - DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val, true)); + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val)); + } else { + update(key, val); + } } - - public void update(String managerKey, String key, int val) { - DataSegment.get(managerKey).update(key, ValueFactory.createIntegerValue(val)); - } - - public <T> void update(String managerKey, String key, T val) { - try { - DataSegment.get(managerKey).update(key, SingletonMessage.getInstance().unconvert(val)); - } catch (IOException e) { - e.printStackTrace(); + + public void update(String managerKey, String key, byte[] val) { + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val, true)); + } else { + update(key, val); } } - + + public void update(String managerKey, String key, int val) { + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).update(key, ValueFactory.createIntegerValue(val)); + } else { + update(key, val); + } + } + + public <T> void update(String managerKey, String key, T val) { + if (!managerKey.equals("local")){ + try { + DataSegment.get(managerKey).update(key, SingletonMessage.getInstance().unconvert(val)); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + update(key, val); + } + } + /** * kill the Alice process after send other messages. * * @param managerKey */ - + public void finish(String managerKey) { DataSegment.get(managerKey).finish(); } @@ -167,13 +152,13 @@ * * @param managerKey */ - + public void close(String managerKey) { DataSegment.get(managerKey).close(); } - + - + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/codesegment/ReceiveLocalData.java Wed Mar 27 21:14:59 2013 +0900 @@ -0,0 +1,54 @@ +package alice.codesegment; + +import java.io.IOException; + +import org.msgpack.type.ArrayValue; +import org.msgpack.type.Value; + +import alice.datasegment.ReceiverData; + +public class ReceiveLocalData implements ReceiverData { + private Object obj; + + public ReceiveLocalData(Object obj2) { + this.obj = obj2; + } + + public String asString() { + return (String) obj; + } + + public int asInteger() { + return (Integer) obj; + } + + public Float asFloat() { + return (Float) obj; + } + + public ArrayValue asArray(){ + return (ArrayValue) obj; + } + + @SuppressWarnings("unchecked") + public <T> T asClass(Class<T> clazz) { + return (T) obj; + + } + + @Override + public Value getVal() { + try { + return SingletonMessage.getInstance().unconvert(obj); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + @Override + public Object getObj() { + return obj; + } + +}
--- a/src/alice/daemon/AliceDaemon.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/daemon/AliceDaemon.java Wed Mar 27 21:14:59 2013 +0900 @@ -53,7 +53,6 @@ ss.bind(a); acceptThread = new AcceptThread(ss, "ACCEPT" + conf.localPort); acceptThread.start(); - } catch (IOException e) { e.printStackTrace(); }
--- a/src/alice/daemon/OutboundTcpConnection.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/daemon/OutboundTcpConnection.java Wed Mar 27 21:14:59 2013 +0900 @@ -15,6 +15,13 @@ } public CommandMessage convert(Command cmd) { + if (cmd.val==null&&cmd.obj!=null){ + try { + cmd.val = SingletonMessage.getInstance().unconvert(cmd.obj); + } catch (IOException e) { + e.printStackTrace(); + } + } return new CommandMessage(cmd.type.id, cmd.index, cmd.seq, cmd.key, cmd.val); }
--- a/src/alice/datasegment/Command.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/datasegment/Command.java Wed Mar 27 21:14:59 2013 +0900 @@ -61,12 +61,4 @@ return this.type + "\t" + key + "\t" + val + "\tindex=" + index + "\tcs=" + csName; } - public void setElement(CommandType cmdType, String key, Value val, Object obj){ - this.type = cmdType; - this.key = key; - this.val = val; - this.obj = obj; - this.reverseKey = "local"; - } - }
--- a/src/alice/datasegment/LocalDataSegmentManager.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/datasegment/LocalDataSegmentManager.java Wed Mar 27 21:14:59 2013 +0900 @@ -68,7 +68,7 @@ logger.debug(cmd.getCommandString()); } - public void put(String key, Object obj) { + public void putObject(String key, Object obj) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); Command cmd = new Command(CommandType.PUT, null, key, obj, 0, 0, null, null, reverseKey); addCommand(dataSegmentKey, cmd); @@ -88,7 +88,7 @@ logger.debug(cmd.getCommandString()); } - public void update(String key, Object val) { + public void updateObject(String key, Object val) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, reverseKey); addCommand(dataSegmentKey, cmd); @@ -135,49 +135,6 @@ public void close() { } - - public void flip(Command cmd){ - DataSegmentKey dataSegmentKey = getDataSegmentKey(cmd.key); - addCommand(dataSegmentKey, cmd); - if (logger.isDebugEnabled()) - logger.debug(cmd.getCommandString()); - } - - public void put(Command cmd){ - DataSegmentKey dataSegmentKey = getDataSegmentKey(cmd.key); - addCommand(dataSegmentKey, cmd); - if (logger.isDebugEnabled()) - logger.debug(cmd.getCommandString()); - } - - public void update(Command cmd){ - DataSegmentKey dataSegmentKey = getDataSegmentKey(cmd.key); - addCommand(dataSegmentKey, cmd); - if (logger.isDebugEnabled()) - logger.debug(cmd.getCommandString()); - } - - - - public void put(Receiver receiver, String key, Object obj) { - DataSegmentKey dataSegmentKey = getDataSegmentKey(key); - Command cmd = receiver.getCommand(); - cmd.setElement(CommandType.PUT, key, null, obj); - addCommand(dataSegmentKey, cmd); - if (logger.isDebugEnabled()) - logger.debug(cmd.getCommandString()); - - } - - public void update(Receiver receiver, String key, Object obj) { - DataSegmentKey dataSegmentKey = getDataSegmentKey(key); - Command cmd = receiver.getCommand(); - cmd.setElement(CommandType.UPDATE, key, null, obj); - addCommand(dataSegmentKey, cmd); - if (logger.isDebugEnabled()) - logger.debug(cmd.getCommandString()); - - } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/datasegment/ReceiveRemoteData.java Wed Mar 27 21:14:59 2013 +0900 @@ -0,0 +1,69 @@ +package alice.datasegment; + +import java.io.IOException; + +import org.msgpack.type.ArrayValue; +import org.msgpack.type.Value; +import org.msgpack.type.ValueType; + +import alice.codesegment.SingletonMessage; + +public class ReceiveRemoteData implements ReceiverData { + public Value val; + + public ReceiveRemoteData() { + } + + public ReceiveRemoteData(Value val2) { + this.val = val2; + } + + public String asString() { + if (val.getType() == ValueType.RAW) { + return val.asRawValue().getString(); + } + return null; + } + + public int asInteger() { + if (val.getType() == ValueType.INTEGER) { + return val.asIntegerValue().getInt(); + } + return 0; + } + + public Float asFloat() { + if (val.getType() == ValueType.FLOAT) { + return val.asFloatValue().getFloat(); + } + return 0.0f; + } + + public ArrayValue asArray(){ + if (val.getType() == ValueType.ARRAY){ + return val.asArrayValue(); + } + return null; + } + + public <T> T asClass(Class<T> clazz) { + try { + return SingletonMessage.getInstance().convert(val, clazz); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + + } + + @Override + public Value getVal() { + return val; + } + + @Override + public Object getObj() { + return val; + } + +} \ No newline at end of file
--- a/src/alice/datasegment/Receiver.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/datasegment/Receiver.java Wed Mar 27 21:14:59 2013 +0900 @@ -1,14 +1,7 @@ package alice.datasegment; -import java.io.IOException; - -import org.msgpack.type.ArrayValue; -import org.msgpack.type.Value; -import org.msgpack.type.ValueFactory; -import org.msgpack.type.ValueType; import alice.codesegment.InputDataSegment; -import alice.codesegment.SingletonMessage; /** * MessagePack implementation and DataSegment Receiver @@ -16,51 +9,21 @@ * */ public class Receiver { + public ReceiverData data = new ReceiveRemoteData(); public InputDataSegment ids; public int index; - public Value val; - public Object obj; public String from; public CommandType type; - - public String managerKey; // for debugging - public String key; // for debugging - private Command cmd; // for flip - + public String managerKey; + public String key; + public Receiver(InputDataSegment ids, CommandType type) { this.ids = ids; this.type = type; ids.regist(); - } - - public void setCommand(Command cmd) { - this.cmd = cmd; } - public void flip(CommandType type, String key, int val){ - flip(type, key, ValueFactory.createIntegerValue(val)); - } - - public void flip(CommandType type, String key, String val){ - flip(type, key, ValueFactory.createRawValue(val)); - } - - public void flip(CommandType type, String key, byte[] val){ - flip(type, key, ValueFactory.createRawValue(val, true)); - } - - public void flip(CommandType type, String key, Object obj, Boolean covertFlag){ - cmd.setElement(type, key, null, obj); - ids.flip(cmd); - } - - - public void flip(CommandType type, String key, Value val){ - cmd.setElement(type, key, val, null); - ids.flip(cmd); - } - public void setKey(String managerKey, String key) { this.managerKey = managerKey; setKey(managerKey, key, 0); @@ -99,46 +62,30 @@ } ids.setKey(); } - - public String asString() { - if (val.getType() == ValueType.RAW) { - return val.asRawValue().getString(); - } - return null; + + public void setData(ReceiverData r) { + data = r; + } public int asInteger() { - if (val.getType() == ValueType.INTEGER) { - return val.asIntegerValue().getInt(); - } - return 0; + return data.asInteger(); } - - public Float asFloat() { - if (val.getType() == ValueType.FLOAT) { - return val.asFloatValue().getFloat(); - } - return 0.0f; - } - - public ArrayValue asArray(){ - if (val.getType() == ValueType.ARRAY){ - return val.asArrayValue(); - } - return null; + + public String asString() { + return data.asString(); } public <T> T asClass(Class<T> clazz) { - try { - return SingletonMessage.getInstance().convert(val, clazz); - } catch (IOException e) { - e.printStackTrace(); - } - return null; + return data.asClass(clazz); + } + + public Object getObj() { + return data.getObj(); } - public Command getCommand() { - return this.cmd; + public Object getVal() { + return data.getVal(); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/datasegment/ReceiverData.java Wed Mar 27 21:14:59 2013 +0900 @@ -0,0 +1,16 @@ +package alice.datasegment; + +import org.msgpack.type.ArrayValue; +import org.msgpack.type.Value; + +public interface ReceiverData { + + public String asString(); + public int asInteger(); + public Float asFloat() ; + public ArrayValue asArray(); + public <T> T asClass(Class<T> clazz); + public Value getVal(); + public Object getObj(); + +} \ No newline at end of file
--- a/src/alice/test/codesegment/api/FlipCodeSegment.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/codesegment/api/FlipCodeSegment.java Wed Mar 27 21:14:59 2013 +0900 @@ -12,7 +12,7 @@ @Override public void run() { Integer num = new Integer(0); - ods.put(key, num, false); + ods.put(key, num); //System.out.println("Key is " +key); new FlipTest(key);
--- a/src/alice/test/codesegment/api/FlipTest.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/codesegment/api/FlipTest.java Wed Mar 27 21:14:59 2013 +0900 @@ -22,19 +22,6 @@ @Override public void run() { - System.out.println(arg1.obj); - - - Integer num = (Integer) arg1.obj; - - num++; - //System.out.println(arg1.obj); - //arg1.flip(CommandType.UPDATE, arg1.key, num, false); - ods.update(arg1.key, num, false); - - //System.out.println(arg1.obj); - //flag = true; - new FlipTest(arg1.key,arg1.index); }
--- a/src/alice/test/codesegment/api/UpdateCodeSegment.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/codesegment/api/UpdateCodeSegment.java Wed Mar 27 21:14:59 2013 +0900 @@ -14,7 +14,7 @@ public void run() { UpdateCodeSegment cs1 = new UpdateCodeSegment(); cs1.ds1.setKey("key", ds1.index); - Value[] array = ds1.val.asArrayValue().getElementArray(); + Value[] array = ((Value)ds1.getVal()).asArrayValue().getElementArray(); int val = array[0].asIntegerValue().getInt(); if (val % 10 == 0) System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024 + "MB");
--- a/src/alice/test/codesegment/local/TestCodeSegment.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/codesegment/local/TestCodeSegment.java Wed Mar 27 21:14:59 2013 +0900 @@ -3,6 +3,7 @@ import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; +import org.msgpack.type.Value; public class TestCodeSegment extends CodeSegment { @@ -12,8 +13,8 @@ @Override public void run() { System.out.println("index = " + arg1.index); - System.out.println("data = " + arg1.val); - System.out.println(arg1.val.getType()); + System.out.println("data = " + arg1.getVal()); + System.out.println(((Value)arg1.getVal()).getType()); if (arg1.index == 10) { System.exit(0);
--- a/src/alice/test/codesegment/local/bitonicsort/MakeData.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/MakeData.java Wed Mar 27 21:14:59 2013 +0900 @@ -20,12 +20,12 @@ public void run() { // This conversion over head should be remove. SortConfig conf = info1.asClass(SortConfig.class); - DataList list = (DataList)info2.obj; + DataList list = info2.asClass(DataList.class); int size = conf.getLength(); Random rnd = new Random(); for (int i = 0; i < size; i++){ list.table[i] = rnd.nextInt(100000); } - ods.update("list", list, false); + ods.update("list", list); } }
--- a/src/alice/test/codesegment/local/bitonicsort/OddPhase.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/OddPhase.java Wed Mar 27 21:14:59 2013 +0900 @@ -33,9 +33,9 @@ //System.out.println("count is " +count); int i = info.range; - if (count<sort_count){ - DataList list1 = (DataList)info1.obj; - DataList list2 = (DataList)info2.obj; + if (count<sort_count){ + DataList list1 = info1.asClass(DataList.class); + DataList list2 = info2.asClass(DataList.class); Sort.quickSort(list1,0,list1.table.length-1); Sort.quickSort(list2,0,list2.table.length-1);
--- a/src/alice/test/codesegment/local/bitonicsort/SetInfo.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/SetInfo.java Wed Mar 27 21:14:59 2013 +0900 @@ -16,7 +16,7 @@ @Override public void run() { ods.put("sortconf", conf); - ods.put("data", new DataList(conf.length), false); + ods.put("data", new DataList(conf.length)); // sortconf and datasegments should be passed directory. create_keys();
--- a/src/alice/test/codesegment/local/bitonicsort/SetTask.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/SetTask.java Wed Mar 27 21:14:59 2013 +0900 @@ -17,7 +17,7 @@ @Override public void run() { SortConfig conf = info1.asClass(SortConfig.class); - DataList list = (DataList)info2.obj; + DataList list = info2.asClass(DataList.class); int sort_count = conf.getSplitNum()*2; ods.put("sort_count", sort_count*2); @@ -35,8 +35,8 @@ for (i = 0;i< sort_count/2; i++){ // anonymas datasegmaents should be used. ods.put(SetInfo.range[i], new RangeInfo(i,i==sort_count-1)); - ods.update(SetInfo.array[i*2], list.createDataList(i*2*block_num, block_num) ,false); - ods.update(SetInfo.array[i*2+1], list.createDataList((i*2+1)*block_num, block_num) ,false); + ods.update(SetInfo.array[i*2], list.createDataList(i*2*block_num, block_num)); + ods.update(SetInfo.array[i*2+1], list.createDataList((i*2+1)*block_num, block_num)); ods.update(SetInfo.count[i], 0); new OddPhase(SetInfo.range[i],SetInfo.array[i*2],SetInfo.array[i*2+1],0,SetInfo.count[i]); }
--- a/src/alice/test/codesegment/local/bitonicsort/ShowData.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/ShowData.java Wed Mar 27 21:14:59 2013 +0900 @@ -26,7 +26,7 @@ int size = 0; for (int i= 0;i < cnt; i++){ - DataList dlist = (DataList)info[i].obj; + DataList dlist = info[i].asClass(DataList.class); size += dlist.table.length; } @@ -34,7 +34,7 @@ int start = 0; for (int i= 0;i < cnt; i++){ - DataList dlist = (DataList)info[i].obj; + DataList dlist = info[i].asClass(DataList.class); System.arraycopy(dlist.table, 0, list.table, start, dlist.table.length); start += dlist.table.length; }
--- a/src/alice/test/codesegment/remote/TestRemoteAlice.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/codesegment/remote/TestRemoteAlice.java Wed Mar 27 21:14:59 2013 +0900 @@ -10,7 +10,6 @@ new AliceDaemon(conf).listen(); DataSegment.connect(conf.key, "", conf.hostname, conf.connectPort); - new RemoteStartCodeSegment().execute(); }
--- a/src/alice/test/topology/aquarium/AddRoutingTable.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/aquarium/AddRoutingTable.java Wed Mar 27 21:14:59 2013 +0900 @@ -11,7 +11,7 @@ public AddRoutingTable(RoutingTable routing,int index){ this.routing = routing; - this.mail.setKey("local", "member", index); + this.mail.setKey("member", index); } @@ -20,7 +20,7 @@ //System.out.println("add "+this.mail.from); routing.table.add(new Routing(this.mail.from)); - ods.update("local", "list", this.routing); + ods.update("list", this.routing); new AddRoutingTable(this.routing, this.mail.index); }
--- a/src/alice/test/topology/aquarium/AutoIncrement.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/aquarium/AutoIncrement.java Wed Mar 27 21:14:59 2013 +0900 @@ -12,8 +12,8 @@ private float max; public AutoIncrement(String key,int index){ - this.number.setKey("local", "maxsize"); - this.position.setKey("local", key, index); + this.number.setKey("maxsize"); + this.position.setKey(key, index); } @Override @@ -29,7 +29,7 @@ fp.setXYZ(fp.getX()+0.01f, fp.getY(), fp.getZ()); } - ods.update("local", position.key, fp); + ods.update(position.key, fp); synchronized(this){ try { // TODO
--- a/src/alice/test/topology/aquarium/CheckLocalIndex.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/aquarium/CheckLocalIndex.java Wed Mar 27 21:14:59 2013 +0900 @@ -11,8 +11,8 @@ public CheckLocalIndex(String key, int index){ - this.list.setKey("local", "list"); - this.data.setKey("local", key, index); + this.list.setKey("list"); + this.data.setKey(key, index); } @Override @@ -20,11 +20,11 @@ RoutingTable rt = this.list.asClass(RoutingTable.class); for (Routing r : rt.table) { if (!r.name.equals(this.data.from)){ - ods.update(r.name, data.key, this.data.val); + ods.update(r.name, data.key, this.data.getVal()); } } - new CheckLocalIndex(data.key, this.data.index); + new CheckLocalIndex(this.data.key, this.data.index); }
--- a/src/alice/test/topology/aquarium/CheckMyName.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/aquarium/CheckMyName.java Wed Mar 27 21:14:59 2013 +0900 @@ -15,7 +15,7 @@ private String key = "fish"; public CheckMyName(){ - host.setKey("local","host"); + host.setKey("host"); } @Override @@ -27,15 +27,15 @@ matcher.find(); String type = matcher.group(1); int num = new Integer(matcher.group(2)); - ods.put("local", "host_num", num*2); + ods.put("host_num", num*2); MakeFrame frame = new MakeFrame(name,num*2); RoutingTable routing = new RoutingTable(); - ods.put("local", "num", 1); + ods.put("num", 1); if (type.equals("cli")){ System.out.println("cli"+num); routing.table.add(new Routing("parent")); - ods.put("local", "list", routing); + ods.put("list", routing); new AddRoutingTable(routing,0); ods.put("parent", "member", name); @@ -51,19 +51,19 @@ } else { new SendMaxsize(0); } - ods.put("local", "list", routing); + ods.put("list", routing); new AddRoutingTable(routing,0); } new CheckLocalIndex("maxsize",0); - ods.update("local", key, new FishPoint(-0.1f,-0.1f)); + ods.update(key, new FishPoint(-0.1f,-0.1f)); new SetLocation(new MakeObject(frame), key, 0, num); new CheckLocalIndex(key,1); for (int i = 0; i < 3 ; i++){ key = "fish"+i; if (num == 0) new AutoIncrement(key,0); - ods.update("local", key, new FishPoint((float)Math.random(), + ods.update(key, new FishPoint((float)Math.random(), (float)Math.random(), (float)Math.random())); new SetLocation(new MakeObject(frame), key, 0, num); new CheckLocalIndex(key,1); @@ -75,7 +75,7 @@ Random rnd = new Random(); int tmp = rnd.nextInt(3); int rand = tmp + 1; - ods.update("local", key, new FishPoint( (float)rand, + ods.update(key, new FishPoint( (float)rand, -(float)Math.random(), -(float)Math.random())); new SetLocation(new MakeObject(frame), key, 0, num); new CheckLocalIndex(key,1); @@ -87,7 +87,7 @@ Random rnd = new Random(); int tmp = rnd.nextInt(3); int rand = tmp + 3; - ods.update("local", key, new FishPoint( (float)rand, + ods.update(key, new FishPoint( (float)rand, (float)Math.random(), -(float)Math.random())); new SetLocation(new MakeObject(frame), key, 0, num); new CheckLocalIndex(key,1); @@ -101,7 +101,7 @@ int tmp = rnd.nextInt(3); int rand = tmp + 5; - ods.update("local", key, new FishPoint( (float)rand, + ods.update(key, new FishPoint( (float)rand, -(float)Math.random(), (float)Math.random())); new SetLocation(new MakeObject(frame), key, 0, num); new CheckLocalIndex(key,1);
--- a/src/alice/test/topology/aquarium/RefreshWindow.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/aquarium/RefreshWindow.java Wed Mar 27 21:14:59 2013 +0900 @@ -8,7 +8,7 @@ private MakeFrame frame; public RefreshWindow(MakeFrame frame){ - this.host.setKey("local","host_num"); + this.host.setKey("host_num"); this.frame = frame; }
--- a/src/alice/test/topology/aquarium/ResetFish.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/aquarium/ResetFish.java Wed Mar 27 21:14:59 2013 +0900 @@ -9,7 +9,7 @@ @Override public void run() { FishPoint fp = new FishPoint(0.0f,0.0f,0.0f); - ods.update("local", "fish", fp); + ods.update("fish", fp); }
--- a/src/alice/test/topology/aquarium/SendLocation.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/aquarium/SendLocation.java Wed Mar 27 21:14:59 2013 +0900 @@ -16,14 +16,14 @@ this.x = x; this.y = y; this.z = z; - position.setKey("local", "fish"); + position.setKey("fish"); } @Override public void run() { FishPoint fp = this.position.asClass(FishPoint.class); fp.setXYZ(fp.getX()+x, fp.getY()+y, fp.getZ()+z); - ods.update("local", "fish", fp); + ods.update("fish", fp); }
--- a/src/alice/test/topology/aquarium/SendMaxsize.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/aquarium/SendMaxsize.java Wed Mar 27 21:14:59 2013 +0900 @@ -9,13 +9,13 @@ private Receiver max = ids.create(CommandType.PEEK); public SendMaxsize(int index){ - this.max.setKey("local", "num", index); + this.max.setKey("num", index); } @Override public void run() { int size = max.asInteger(); - ods.update("local","maxsize",size); + ods.update("maxsize",size); new SendMaxsize(this.max.index); }
--- a/src/alice/test/topology/aquarium/SetLocation.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/aquarium/SetLocation.java Wed Mar 27 21:14:59 2013 +0900 @@ -14,7 +14,7 @@ public SetLocation(MakeObject obj ,String key, int index, int range){ this.obj = obj; this.range = range; - this.position.setKey("local",key,index); + this.position.setKey(key,index); } @Override
--- a/src/alice/test/topology/aquarium/TakeMynum.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/aquarium/TakeMynum.java Wed Mar 27 21:14:59 2013 +0900 @@ -9,17 +9,17 @@ private Receiver mynum = ids.create(CommandType.TAKE); public TakeMynum(){ - this.mynum.setKey("local", "num"); + this.mynum.setKey("num"); } public TakeMynum(int index){ - this.mynum.setKey("local", "num", index); + this.mynum.setKey("num", index); } @Override public void run() { new TakePnum(this.mynum); - ods.put("local", "num", 0); + ods.put("num", 0); new TakeMynum(this.mynum.index+1); }
--- a/src/alice/test/topology/fish/AsignStartX.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/fish/AsignStartX.java Wed Mar 27 21:14:59 2013 +0900 @@ -21,7 +21,7 @@ RoutingTable routing = this.routing.asClass(RoutingTable.class); int x = startX; - System.out.println("RoutingTable: " + this.routing.val); + System.out.println("RoutingTable: " + this.routing.getVal()); if (this.index >= this.routing.index) { AsignStartX cs = new AsignStartX(startX, index); cs.routing.setKey("local", "routing", this.routing.index);
--- a/src/alice/test/topology/fish/CheckMyName.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/fish/CheckMyName.java Wed Mar 27 21:14:59 2013 +0900 @@ -12,7 +12,7 @@ private Receiver host = ids.create(CommandType.PEEK); public CheckMyName(){ - host.setKey("local", "host"); + host.setKey("host"); } @Override
--- a/src/alice/test/topology/fish/PeekStartX.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/fish/PeekStartX.java Wed Mar 27 21:14:59 2013 +0900 @@ -17,7 +17,7 @@ public void run() { int startX = this.startX.asInteger(); AsignStartX cs = new AsignStartX(startX, this.startX.index); - cs.routing.setKey("local", "routing", this.startX.index); + cs.routing.setKey("routing", this.startX.index); } }
--- a/src/alice/test/topology/fish/SendWidth.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/fish/SendWidth.java Wed Mar 27 21:14:59 2013 +0900 @@ -16,7 +16,7 @@ System.out.println("send widths: " + width); SendWidth cs = new SendWidth(); - cs.width.setKey("local", "width", this.width.index); + cs.width.setKey("width", this.width.index); } }
--- a/src/alice/test/topology/fish/WidthReceiver.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/fish/WidthReceiver.java Wed Mar 27 21:14:59 2013 +0900 @@ -43,13 +43,13 @@ System.out.println("NODE NUM: " + routing.table.size()); - ods.update("local", "width", routing.sumWidth); - ods.update("local", "routing", routing); + ods.update("width", routing.sumWidth); + ods.update("routing", routing); WidthReceiver cs = new WidthReceiver(); - cs.widths.setKey("local", "widths", this.widths.index); - cs.routing.setKey("local", "routing"); - //cs.routing.setKey("local", "routing", this.routing.index); + cs.widths.setKey("widths", this.widths.index); + cs.routing.setKey("routing"); + //cs.routing.setKey("routing", this.routing.index); } }
--- a/src/alice/test/topology/ring/FirstRingMessagePassing.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/ring/FirstRingMessagePassing.java Wed Mar 27 21:14:59 2013 +0900 @@ -27,7 +27,7 @@ @Override public void run() { - ods.put("right", "c", ds1.val); // copy whole DataSegment to the right + ods.put("right", "c", ds1.getVal()); // copy whole DataSegment to the right if (ds1.index > count) { // after count time update of ds1 ods.put("right", "finish", ValueFactory.createNilValue()); long endTime = System.nanoTime();
--- a/src/alice/test/topology/ring/RingMessagePassing.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/ring/RingMessagePassing.java Wed Mar 27 21:14:59 2013 +0900 @@ -10,7 +10,7 @@ @Override public void run() { - ods.put("right", "c", this.ds1.val); + ods.put("right", "c", this.ds1.getVal()); RingMessagePassing cs = new RingMessagePassing(); cs.ds1.setKey("c"); }
--- a/src/alice/test/topology/share/AutoIncrement.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/share/AutoIncrement.java Wed Mar 27 21:14:59 2013 +0900 @@ -11,7 +11,7 @@ public AutoIncrement(String key,int index){ this.key = key; - this.position.setKey("local", key, index); + this.position.setKey(key, index); } @Override @@ -23,7 +23,7 @@ e.printStackTrace(); } } - ods.update("local", key, new DataInfo(System.nanoTime())); + ods.update(key, new DataInfo(System.nanoTime())); new AutoIncrement(this.key ,this.position.index); }
--- a/src/alice/test/topology/share/CheckLocalIndex.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/share/CheckLocalIndex.java Wed Mar 27 21:14:59 2013 +0900 @@ -15,9 +15,9 @@ public CheckLocalIndex(String key, int index){ this.key = key; - this.host.setKey("local","host"); - this.list.setKey("local", "list"); - this.data.setKey("local", this.key, index); + this.host.setKey("host"); + this.list.setKey("list"); + this.data.setKey(this.key, index); } @Override @@ -28,13 +28,13 @@ for (Routing r : rt.table) { if (r.name.equals("parent"))flag=true; if (!r.name.equals(this.data.from)){ - ods.update(r.name, this.key, this.data.val); + ods.update(r.name, this.key, this.data.getVal()); count++; } } if (count==0&&flag){ - ods.put("parent", "data", this.data.val); + ods.put("parent", "data", this.data.getVal()); } new CheckLocalIndex(this.key, this.data.index);
--- a/src/alice/test/topology/share/CheckMyName.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/share/CheckMyName.java Wed Mar 27 21:14:59 2013 +0900 @@ -17,7 +17,7 @@ String key = "fish"; public CheckMyName(){ - this.host.setKey("local","host"); + this.host.setKey("host"); } @Override @@ -35,7 +35,7 @@ if (type.equals("cli")){ System.out.println("cli"+num); routing.table.add(new Routing("parent")); - ods.put("local", "list", routing); + ods.put("list", routing); new AddRoutingTable(routing,0); ods.put("parent", "member", name); @@ -49,12 +49,12 @@ }else{ new LookUpData("data",0); } - ods.put("local", "list", routing); + ods.put("list", routing); new AddRoutingTable(routing,0); } for (int i =0 ;i<1000000;i++){} - ods.update("local", key, new DataInfo()); + ods.update(key, new DataInfo()); if (num == 0) new AutoIncrement(key,0); new CheckLocalIndex(key,1);
--- a/src/alice/test/topology/share/LookUpData.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/share/LookUpData.java Wed Mar 27 21:14:59 2013 +0900 @@ -12,13 +12,13 @@ public LookUpData(String key,int index){ this.key = key; - this.data.setKey("local", key, index); + this.data.setKey(key, index); } public LookUpData(String key,int index, int depth){ this.key = key; this.depth = depth; - this.data.setKey("local", key, index); + this.data.setKey(key, index); } @Override
--- a/src/alice/test/topology/share/SendData.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/test/topology/share/SendData.java Wed Mar 27 21:14:59 2013 +0900 @@ -8,13 +8,13 @@ private Receiver data = ids.create(CommandType.PEEK); public SendData(int index){ - this.data.setKey("local", "data", index); + this.data.setKey("data", index); } @Override public void run(){ new SendData(this.data.index); - ods.put("parent", "data", this.data.val); + ods.put("parent", "data", this.data.getVal()); } } \ No newline at end of file
--- a/src/alice/topology/node/ConfigurationFinish.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/topology/node/ConfigurationFinish.java Wed Mar 27 21:14:59 2013 +0900 @@ -18,7 +18,7 @@ @Override public void run() { - if (reverseCount.val.equals(configNodeNum.val)) { + if (reverseCount.getVal().equals(configNodeNum.getVal())) { ods.put("manager", "done", ValueFactory.createNilValue()); Start cs = new Start(startCS);
--- a/src/alice/topology/node/IncomingConnectionInfo.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/topology/node/IncomingConnectionInfo.java Wed Mar 27 21:14:59 2013 +0900 @@ -19,7 +19,7 @@ @Override public void run() { - if (this.hostInfo.val == null) { + if (this.hostInfo.getVal() == null) { ods.put("local", "configNodeNum", count); return; }
--- a/src/alice/topology/node/IncomingReverseKey.java Wed Mar 27 21:13:38 2013 +0900 +++ b/src/alice/topology/node/IncomingReverseKey.java Wed Mar 27 21:14:59 2013 +0900 @@ -4,6 +4,7 @@ import alice.datasegment.CommandType; import alice.datasegment.DataSegment; import alice.datasegment.Receiver; +import org.msgpack.type.Value; public class IncomingReverseKey extends CodeSegment { @@ -12,7 +13,7 @@ @Override public void run() { - String reverseKey = this.reverseKey.val.asRawValue().getString(); + String reverseKey = ((Value)this.reverseKey.getVal()).asRawValue().getString(); String from = this.reverseKey.from; DataSegment.getAccept(from).reverseKey = reverseKey;