/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { writeExternalMeta(out); out.writeObject(xidVer); out.writeBoolean(invalidate); out.writeLong(timeout); out.writeLong(threadId); out.writeLong(startTime); U.writeUuid(out, nodeId); out.write(isolation.ordinal()); out.write(concurrency.ordinal()); out.write(state().ordinal()); }
/** * Writes {@link TxRecord} to given buffer. * * @param rec TxRecord. * @param buf Byte buffer. */ public void write(TxRecord rec, ByteBuffer buf) { buf.put((byte)rec.state().ordinal()); RecordV1Serializer.putVersion(buf, rec.nearXidVersion(), true); RecordV1Serializer.putVersion(buf, rec.writeVersion(), true); Map<Short, Collection<Short>> participatingNodes = rec.participatingNodes(); if (participatingNodes != null && !participatingNodes.isEmpty()) { buf.putInt(participatingNodes.size()); for (Map.Entry<Short, Collection<Short>> e : participatingNodes.entrySet()) { buf.putShort(e.getKey()); Collection<Short> backupNodes = e.getValue(); buf.putInt(backupNodes.size()); for (short backupNode : backupNodes) buf.putShort(backupNode); } } else buf.putInt(0); // Put zero size of participating nodes. buf.putLong(rec.timestamp()); }
/** * Writes {@link MvccTxRecord} to given buffer. * * @param rec MvccTxRecord. * @param buf Byte buffer. * @throws IgniteCheckedException In case of fail. */ public void write(MvccTxRecord rec, ByteBuffer buf) throws IgniteCheckedException { buf.put((byte)rec.state().ordinal()); RecordV1Serializer.putVersion(buf, rec.nearXidVersion(), true); RecordV1Serializer.putVersion(buf, rec.writeVersion(), true); putMvccVersion(buf, rec.mvccVersion()); Map<Short, Collection<Short>> participatingNodes = rec.participatingNodes(); if (participatingNodes != null && !participatingNodes.isEmpty()) { buf.putInt(participatingNodes.size()); for (Map.Entry<Short, Collection<Short>> e : participatingNodes.entrySet()) { buf.putShort(e.getKey()); Collection<Short> backupNodes = e.getValue(); buf.putInt(backupNodes.size()); for (short backupNode : backupNodes) buf.putShort(backupNode); } } else buf.putInt(0); // Put zero size of participating nodes. buf.putLong(rec.timestamp()); }
/** * @param id Transaction ID. * @return Transaction state. */ private int txClose(long id) { Transaction tx = tx(id); try { tx.close(); return tx.state().ordinal(); } finally { unregisterTx(id); } }
/** {@inheritDoc} */ @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { case OP_PREPARE: ((TransactionProxyImpl)tx(val)).tx().prepare(true); return TRUE; case OP_COMMIT: tx(val).commit(); return txClose(val); case OP_ROLLBACK: tx(val).rollback(); return txClose(val); case OP_CLOSE: return txClose(val); case OP_SET_ROLLBACK_ONLY: return tx(val).setRollbackOnly() ? TRUE : FALSE; case OP_STATE: return tx(val).state().ordinal(); case OP_RESET_METRICS: txs.resetMetrics(); return TRUE; } return super.processInLongOutLong(type, val); }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { writeExternalMeta(out); out.writeObject(xidVer); out.writeBoolean(invalidate); out.writeLong(timeout); out.writeLong(threadId); out.writeLong(startTime); U.writeUuid(out, nodeId); out.write(isolation.ordinal()); out.write(concurrency.ordinal()); out.write(state().ordinal()); }
/** * Writes {@link TxRecord} to given buffer. * * @param rec TxRecord. * @param buf Byte buffer. */ public void write(TxRecord rec, ByteBuffer buf) { buf.put((byte)rec.state().ordinal()); RecordV1Serializer.putVersion(buf, rec.nearXidVersion(), true); RecordV1Serializer.putVersion(buf, rec.writeVersion(), true); Map<Short, Collection<Short>> participatingNodes = rec.participatingNodes(); if (participatingNodes != null && !participatingNodes.isEmpty()) { buf.putInt(participatingNodes.size()); for (Map.Entry<Short, Collection<Short>> e : participatingNodes.entrySet()) { buf.putShort(e.getKey()); Collection<Short> backupNodes = e.getValue(); buf.putInt(backupNodes.size()); for (short backupNode : backupNodes) buf.putShort(backupNode); } } else buf.putInt(0); // Put zero size of participating nodes. buf.putLong(rec.timestamp()); }
/** * Writes {@link MvccTxRecord} to given buffer. * * @param rec MvccTxRecord. * @param buf Byte buffer. * @throws IgniteCheckedException In case of fail. */ public void write(MvccTxRecord rec, ByteBuffer buf) throws IgniteCheckedException { buf.put((byte)rec.state().ordinal()); RecordV1Serializer.putVersion(buf, rec.nearXidVersion(), true); RecordV1Serializer.putVersion(buf, rec.writeVersion(), true); putMvccVersion(buf, rec.mvccVersion()); Map<Short, Collection<Short>> participatingNodes = rec.participatingNodes(); if (participatingNodes != null && !participatingNodes.isEmpty()) { buf.putInt(participatingNodes.size()); for (Map.Entry<Short, Collection<Short>> e : participatingNodes.entrySet()) { buf.putShort(e.getKey()); Collection<Short> backupNodes = e.getValue(); buf.putInt(backupNodes.size()); for (short backupNode : backupNodes) buf.putShort(backupNode); } } else buf.putInt(0); // Put zero size of participating nodes. buf.putLong(rec.timestamp()); }
/** * @param id Transaction ID. * @return Transaction state. */ private int txClose(long id) { Transaction tx = tx(id); try { tx.close(); return tx.state().ordinal(); } finally { unregisterTx(id); } }
/** {@inheritDoc} */ @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { case OP_PREPARE: ((TransactionProxyImpl)tx(val)).tx().prepare(true); return TRUE; case OP_COMMIT: tx(val).commit(); return txClose(val); case OP_ROLLBACK: tx(val).rollback(); return txClose(val); case OP_CLOSE: return txClose(val); case OP_SET_ROLLBACK_ONLY: return tx(val).setRollbackOnly() ? TRUE : FALSE; case OP_STATE: return tx(val).state().ordinal(); case OP_RESET_METRICS: txs.resetMetrics(); return TRUE; } return super.processInLongOutLong(type, val); }