1 4 package com.tc.object.lockmanager.api; 5 6 import com.tc.io.TCByteBufferInputStream; 7 import com.tc.io.TCByteBufferOutput; 8 import com.tc.net.protocol.tcm.ChannelID; 9 import com.tc.object.tx.WaitInvocation; 10 import com.tc.object.tx.WaitInvocationFactory; 11 12 import java.io.IOException ; 13 14 17 public class WaitContext extends LockContext { 18 19 private static final WaitInvocationFactory waitInvocationFactory = new WaitInvocationFactory(); 20 21 private WaitInvocation waitInvocation; 22 23 public WaitContext(LockID lockID, ChannelID channelID, ThreadID threadID, int lockLevel, WaitInvocation waitInvocation) { 24 super(lockID, channelID, threadID, lockLevel); 25 this.waitInvocation = waitInvocation; 26 } 27 28 public WaitContext() { 29 return; 30 } 31 32 public WaitInvocation getWaitInvocation() { 33 return waitInvocation; 34 } 35 36 public void serializeTo(TCByteBufferOutput output) { 37 super.serializeTo(output); 38 output.writeByte(waitInvocation.getSignature().getArgCount()); 39 output.writeLong(waitInvocation.getMillis()); 40 output.writeInt(waitInvocation.getNanos()); 41 } 42 43 public Object deserializeFrom(TCByteBufferInputStream input) throws IOException { 44 super.deserializeFrom(input); 45 waitInvocation = waitInvocationFactory.newWaitInvocation(input.readByte(), input.readLong(), input.readInt()); 46 return this; 47 } 48 } 49 | Popular Tags |