1 49 package org.exolab.jms.tranlog; 50 51 52 import java.io.Externalizable ; 53 import java.io.IOException ; 54 import java.io.ObjectInput ; 55 import java.io.ObjectOutput ; 56 57 58 public class StateTransactionLogEntry 59 extends BaseTransactionLogEntry 60 implements Externalizable { 61 62 66 static final long serialVersionUID = 1; 67 68 71 private TransactionState _state; 72 73 74 77 public StateTransactionLogEntry() { 78 } 79 80 89 StateTransactionLogEntry(ExternalXid txid, String rid) { 90 this(txid, rid, System.currentTimeMillis()); 91 } 92 93 103 StateTransactionLogEntry(ExternalXid txid, String rid, long created) { 104 super(txid, rid, created); 105 } 106 107 112 public void setState(TransactionState state) { 113 _state = state; 114 } 115 116 121 public TransactionState getState() { 122 return _state; 123 } 124 125 public void writeExternal(ObjectOutput stream) 127 throws IOException { 128 stream.writeLong(serialVersionUID); 129 stream.writeObject(_state); 130 super.writeExternal(stream); 131 } 132 133 public void readExternal(ObjectInput stream) 135 throws IOException , ClassNotFoundException { 136 long version = stream.readLong(); 137 if (version == serialVersionUID) { 138 _state = (TransactionState) stream.readObject(); 139 super.readExternal(stream); 140 } else { 141 throw new IOException ("No support for StateTransactionLogEntry " + 142 "with version " + version); 143 } 144 } 145 } 146 | Popular Tags |