1 4 package com.tc.object.lockmanager.impl; 5 6 import com.tc.io.TCByteBufferInputStream; 7 import com.tc.io.TCDataOutput; 8 import com.tc.net.protocol.tcm.ChannelID; 9 import com.tc.object.lockmanager.api.LockID; 10 import com.tc.object.lockmanager.api.ThreadID; 11 12 import java.io.IOException ; 13 14 17 public class GlobalLockStateInfo { 18 private LockID lockID; 19 private ChannelID channelID; 20 private ThreadID threadID; 21 private long timeout; 22 private long timestamp; 23 private int lockLevel; 24 25 public GlobalLockStateInfo() { 26 super(); 27 } 28 29 public GlobalLockStateInfo(LockID lockID, ChannelID channelID, ThreadID threadID, long timestamp, long timeout, 30 int lockLevel) { 31 this.lockID = lockID; 32 this.channelID = channelID; 33 this.threadID = threadID; 34 this.timestamp = timestamp; 35 this.timeout = timeout; 36 this.lockLevel = lockLevel; 37 } 38 39 public ChannelID getChannelID() { 40 return channelID; 41 } 42 43 public LockID getLockID() { 44 return lockID; 45 } 46 47 public int getLockLevel() { 48 return lockLevel; 49 } 50 51 public long getTimeout() { 52 return timeout; 53 } 54 55 public long getTimestamp() { 56 return timestamp; 57 } 58 59 public ThreadID getThreadID() { 60 return threadID; 61 } 62 63 public void serializeTo(TCDataOutput serialOutput) { 64 serialOutput.writeLong(timestamp); 65 serialOutput.writeString(lockID.asString()); 66 serialOutput.writeLong(channelID.toLong()); 67 serialOutput.writeLong(threadID.toLong()); 68 serialOutput.writeLong(timeout); 69 serialOutput.writeInt(lockLevel); 70 } 71 72 public Object deserializeFrom(TCByteBufferInputStream serialInput) throws IOException { 73 this.timestamp = serialInput.readLong(); 74 this.lockID = new LockID(serialInput.readString()); 75 this.channelID = new ChannelID(serialInput.readLong()); 76 this.threadID = new ThreadID(serialInput.readLong()); 77 this.timeout = serialInput.readLong(); 78 this.lockLevel = serialInput.readInt(); 79 return this; 80 } 81 82 } | Popular Tags |