Package com.taobao.metamorphosis.transaction

Examples of com.taobao.metamorphosis.transaction.LocalTransactionId


        assertEquals("unique-qualifier", cmd.getTransactionInfo().getUniqueQualifier());
        final TransactionInfo info = cmd.getTransactionInfo();
        assertNotNull(info);
        assertNotNull(info.getTransactionId());
        assertTrue(info.getTransactionId().isLocalTransaction());
        final LocalTransactionId id = (LocalTransactionId) info.getTransactionId();
        assertEquals("sessionId", id.getSessionId());
        assertEquals(99, id.getValue());
    }
View Full Code Here


        assertEquals("unique-qualifier", cmd.getTransactionInfo().getUniqueQualifier());
        final TransactionInfo info = cmd.getTransactionInfo();
        assertNotNull(info);
        assertNotNull(info.getTransactionId());
        assertTrue(info.getTransactionId().isLocalTransaction());
        final LocalTransactionId id = (LocalTransactionId) info.getTransactionId();
        assertEquals("sessionId", id.getSessionId());
        assertEquals(99, id.getValue());
    }
View Full Code Here

    public static SessionContext getOrCreateSessionContext(final Connection conn, final TransactionId xid) {
        SessionContext context = null;
        if (xid != null && xid.isLocalTransaction()) {
            // �����������session id�������sessionId��key�洢
            final LocalTransactionId id = (LocalTransactionId) xid;
            context = (SessionContext) conn.getAttribute(id.getSessionId());
            if (context == null) {
                context = new SessionContextImpl(id.getSessionId(), conn);
                final SessionContext old = (SessionContext) conn.setAttributeIfAbsent(id.getSessionId(), context);
                if (old != null) {
                    context = old;
                }
            }
        }
View Full Code Here

public class TransactionCommandUnitTest {

    @Test
    public void testEncode() {
        final TransactionId id = new LocalTransactionId("sessionId", 99);
        final TransactionInfo info = new TransactionInfo(id, "sessionId", TransactionType.COMMIT_ONE_PHASE, null);

        final TransactionCommand cmd = new TransactionCommand(info, 100);
        final IoBuffer buf = cmd.encode();
        assertEquals("transaction TX:sessionId:99 sessionId COMMIT_ONE_PHASE 100\r\n", new String(buf.array()));
View Full Code Here


    @Test
    public void testBeginPutCommitOnePhase() throws Exception {
        final SessionContext context = new SessionContextImpl("test", this.conn);
        final TransactionId xid = new LocalTransactionId("test", 100);
        assertNull(context.getTransactions().get(xid));
        this.processor.beginTransaction(context, xid, 0);
        final Transaction tx = context.getTransactions().get(xid);
        assertNotNull(tx);
        assertSame(xid, tx.getTransactionId());
View Full Code Here


    @Test
    public void testBeginPutRollback() throws Exception {
        final SessionContext context = new SessionContextImpl("test", this.conn);
        final TransactionId xid = new LocalTransactionId("test", 100);
        assertNull(context.getTransactions().get(xid));
        this.processor.beginTransaction(context, xid, 0);
        final Transaction tx = context.getTransactions().get(xid);
        assertNotNull(tx);
        assertSame(xid, tx.getTransactionId());
View Full Code Here

        }

        if (this.transactionId == null) {
            MetaStatLog.addStat(null, StatConstants.TX_BEGIN);
            this.transactionId =
                    new LocalTransactionId(this.sessionId, this.localTransactionIdGenerator.getNextSequenceId());
            // Local transaction doesn't need unique qualifier.
            final TransactionInfo info =
                    new TransactionInfo(this.transactionId, this.sessionId, TransactionInfo.TransactionType.BEGIN,
                        this.uniqueQualifier, this.transactionTimeout);
            try {
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.transaction.LocalTransactionId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.