Mercurial > hg > Members > tatsuki > Alice
view src/alice/datasegment/Command.java @ 328:370a2f63944f
add ListManager Test
author | sugi |
---|---|
date | Tue, 11 Feb 2014 16:10:23 +0900 |
parents | b78f52865b8d |
children |
line wrap: on
line source
package alice.datasegment; import java.io.IOException; import java.util.concurrent.BlockingQueue; import org.msgpack.type.Value; import alice.codesegment.CodeSegment; import alice.codesegment.SingletonMessage; import alice.daemon.CommandMessage; import alice.daemon.Connection; public class Command { public CommandType type; public String key; public Receiver receiver; public Value val; public int index; public int seq; public Connection connection; // for remote public BlockingQueue<Command> replyQueue; public CodeSegment cs; public String reverseKey; public Object obj; public boolean flag; public Command(CommandType cmdType, Receiver receiver, String key, Value val, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey) { this.type = cmdType; this.receiver = receiver; this.key = key; this.val = val; this.index = index; this.seq = seq; this.replyQueue = replyQueue; this.cs = cs; this.reverseKey = reverseKey; this.flag = false; } public Command(CommandType cmdType, Receiver receiver, String key, Value val, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey, boolean flag) { this.type = cmdType; this.receiver = receiver; this.key = key; this.val = val; this.index = index; this.seq = seq; this.replyQueue = replyQueue; this.cs = cs; this.reverseKey = reverseKey; this.flag = flag; } public Command(CommandType cmdType, Receiver receiver, String key, Value val, int index, int seq, Connection connection, CodeSegment cs, String reverseKey, boolean flag) { this.type = cmdType; this.receiver = receiver; this.key = key; this.val = val; this.index = index; this.seq = seq; this.connection = connection; this.cs = cs; this.reverseKey = reverseKey; this.flag = flag; } public Command(CommandType cmdType, Receiver receiver, String key, Object obj, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey) { this.type = cmdType; this.receiver = receiver; this.key = key; this.obj = obj; this.index = index; this.seq = seq; this.replyQueue = replyQueue; this.cs = cs; this.reverseKey = reverseKey; this.flag = false; } public Command(CommandType cmdType, Receiver receiver, String key, Value val, Object obj, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey) { this.type = cmdType; this.receiver = receiver; this.key = key; this.val = val; this.obj = obj; this.index = index; this.seq = seq; this.replyQueue = replyQueue; this.cs = cs; this.reverseKey = reverseKey; this.flag = false; } public String getCommandString() { String csName = "null"; if (cs != null) { csName = cs.toString(); } return this.type + "\t" + key + "\t" + val + "\tindex=" + index + "\tcs=" + csName; } public CommandMessage convert() { if (val==null&&obj!=null){ try { this.val = SingletonMessage.getInstance().unconvert(obj); } catch (IOException e) { e.printStackTrace(); } } return new CommandMessage(type.id, index, seq, key, val, flag); } }