Mercurial > hg > Database > Alice
view src/alice/codesegment/OutputDataSegment.java @ 182:52a1fa5ba38b working
add filp api
author | e095732 |
---|---|
date | Tue, 26 Feb 2013 13:46:18 +0900 |
parents | 8d3cb7e5fa57 |
children | 75150396681c |
line wrap: on
line source
package alice.codesegment; import java.io.IOException; import org.msgpack.type.Value; import org.msgpack.type.ValueFactory; import alice.datasegment.DataSegment; import alice.datasegment.Receiver; public class OutputDataSegment { public void flip(Receiver receiver, Value val) { DataSegment.getLocal().flip(receiver, val); } public void flip(Receiver receiver, String val) { DataSegment.getLocal().flip(receiver, ValueFactory.createRawValue(val)); } public void flip(Receiver receiver, int val) { DataSegment.getLocal().flip(receiver, ValueFactory.createIntegerValue(val)); } public void flip(Receiver receiver, byte[] val) { DataSegment.getLocal().flip(receiver, ValueFactory.createRawValue(val)); } public <T> void filp(Receiver receiver, T val) { try { DataSegment.getLocal().flip(receiver, SingletonMessage.getInstance().unconvert(val)); } catch (IOException e) { e.printStackTrace(); } } public void put(String managerKey, String key, Value val) { DataSegment.get(managerKey).put(key, val); } public void update(String managerKey, String key, Value val) { DataSegment.get(managerKey).update(key, val); } public void put(String managerKey, String key, String val) { DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val)); } public void update(String managerKey, String key, String val) { DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val)); } public void put(String managerKey, String key, byte[] val) { DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val, true)); } public void update(String managerKey, String key, byte[] val) { DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val, true)); } public void put(String managerKey, String key, int val) { DataSegment.get(managerKey).put(key, ValueFactory.createIntegerValue(val)); } public void update(String managerKey, String key, int val) { DataSegment.get(managerKey).update(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 <T> void update(String managerKey, String key, T val) { try { DataSegment.get(managerKey).update(key, SingletonMessage.getInstance().unconvert(val)); } catch (IOException e) { e.printStackTrace(); } } /** * kill the Alice process after send other messages. * * @param managerKey */ public void finish(String managerKey) { DataSegment.get(managerKey).finish(); } /** * close socket for RemoteDataSegment after send other messages. * * @param managerKey */ public void close(String managerKey) { DataSegment.get(managerKey).close(); } }