1 8 9 package com.sleepycat.je.txn; 10 11 import java.nio.ByteBuffer ; 12 13 import javax.transaction.xa.Xid ; 14 15 import com.sleepycat.je.log.LogEntryType; 16 import com.sleepycat.je.log.LogReadable; 17 import com.sleepycat.je.log.LogUtils; 18 import com.sleepycat.je.log.LoggableObject; 19 import com.sleepycat.je.utilint.DbLsn; 20 21 24 public class TxnPrepare extends TxnEnd { 25 26 private Xid xid; 27 28 public TxnPrepare(long id, Xid xid) { 29 30 super(id, DbLsn.NULL_LSN); 31 this.xid = xid; 32 } 33 34 37 public TxnPrepare() { 38 } 39 40 public Xid getXid() { 41 return xid; 42 } 43 44 47 48 51 public LogEntryType getLogType() { 52 return LogEntryType.LOG_TXN_PREPARE; 53 } 54 55 protected String getTagName() { 56 return "TxnPrepare"; 57 } 58 59 62 public int getLogSize() { 63 return LogUtils.LONG_BYTES + LogUtils.getTimestampLogSize() + LogUtils.getXidSize(xid); } 67 68 71 public void writeToLog(ByteBuffer logBuffer) { 72 LogUtils.writeLong(logBuffer, id); 73 LogUtils.writeTimestamp(logBuffer, time); 74 LogUtils.writeXid(logBuffer, xid); 75 } 76 77 80 public void readFromLog(ByteBuffer logBuffer, byte entryTypeVersion) { 81 id = LogUtils.readLong(logBuffer); 82 time = LogUtils.readTimestamp(logBuffer); 83 xid = LogUtils.readXid(logBuffer); 84 } 85 86 89 public void dumpLog(StringBuffer sb, boolean verbose) { 90 sb.append("<").append(getTagName()); 91 sb.append(" id=\"").append(id); 92 sb.append("\" xid=\"").append(xid); 93 sb.append("\" time=\"").append(time); 94 sb.append("\">"); 95 sb.append("</").append(getTagName()).append(">"); 96 } 97 } 98 | Popular Tags |