write phase one - Invalidation reply
This commit is contained in:
parent
013f08e7e3
commit
8c929769b8
|
@ -383,6 +383,38 @@ public class memSession implements Runnable
|
|||
}
|
||||
}
|
||||
break;
|
||||
case nm_write_1:
|
||||
{
|
||||
nm_write_1 msgLite = msg.getMessageLite();
|
||||
|
||||
Integer state = getLockState(msgLite.getKey());
|
||||
if (state == LockKey.waitLock)
|
||||
{
|
||||
System.err.println("write_1 error wait lock state");
|
||||
return ;
|
||||
}
|
||||
else if(state == LockKey.badLock)
|
||||
{
|
||||
removeLock(msgLite.getKey());
|
||||
}
|
||||
|
||||
nm_write_1_res.Builder builder = nm_write_1_res.newBuilder();
|
||||
builder.setKey(msgLite.getKey());
|
||||
builder.setValue(msgLite.getValue());
|
||||
builder.setTime(msgLite.getTime());
|
||||
|
||||
NetMsg send = NetMsg.newMessage();
|
||||
send.setMessageLite(builder);
|
||||
send.setMsgID(EMSGID.nm_write_1_res);
|
||||
getClientChannel(msgLite.getMemID()).write(send);
|
||||
|
||||
LockKey lockKey = new LockKey(ClientMgr.getInstance().mClientNumber, 0,System.currentTimeMillis(),LockKey.waitLock);
|
||||
if(lockKey(msgLite.getKey(), lockKey)==false)
|
||||
{
|
||||
System.out.println("nm_write_1 Lock fail");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
System.err.println(msg.getMsgID().toString());
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue