Package com.taobao.metamorphosis.client.transaction

Examples of com.taobao.metamorphosis.client.transaction.TransactionContext$EndXATransactionListener


    }


    @Override
    public XAResource getXAResource() throws MetaClientException {
        TransactionContext xares = this.transactionContext.get();
        if (xares != null) {
            return xares;
        }
        else {
            this.beginTransaction();
            xares = this.transactionContext.get();
            // ��������ѡ����broker
            String selectedServer = this.selectTransactionBrokerURL();
            xares.setServerUrl(selectedServer);
            xares.setUniqueQualifier(this.uniqueQualifier);
            xares.setXareresourceURLs(this.urls);
            // ָ�����͵�url
            this.logLastSentInfo(selectedServer);
            return xares;
        }
    }
View Full Code Here


    }


    private TransactionContext getTx() throws MetaClientException {
        final TransactionContext ctx = this.transactionContext.get();
        if (ctx == null) {
            throw new MetaClientException("There is no transaction begun");
        }
        return ctx;
    }
View Full Code Here

     *             ����Ѿ����������У����׳�TransactionInProgressException�쳣
     */
    @Override
    public void beginTransaction() throws MetaClientException {
        // û���ڴ˷��������begin�����ǵȵ���һ�η�����Ϣǰ�ŵ���
        TransactionContext ctx = this.transactionContext.get();
        if (ctx == null) {
            ctx =
                    new TransactionContext(this.remotingClient, null, this, this.localTxIdGenerator,
                        this.transactionTimeout, this.transactionRequestTimeoutInMills);
            this.transactionContext.set(ctx);
        }
        else {
            throw new TransactionInProgressException("A transaction has begun");
View Full Code Here

     *
     * @param serverUrl
     * @throws MetaClientException
     */
    protected void beforeSendMessageFirstTime(final String serverUrl) throws MetaClientException, XAException {
        final TransactionContext tx = this.getTx();
        // ������������Ҫ����serverUrl��begin
        if (tx.getTransactionId() == null) {
            tx.setServerUrl(serverUrl);
            tx.begin();
        }
    }
View Full Code Here

     * @throws MetaClientException
     */
    @Override
    public void commit() throws MetaClientException {
        try {
            final TransactionContext ctx = this.getTx();
            ctx.commit();
        }
        finally {
            this.resetLastSentInfo();
            this.transactionContext.remove();
        }
View Full Code Here

     * @see #beginTransaction()
     */
    @Override
    public void rollback() throws MetaClientException {
        try {
            final TransactionContext ctx = this.getTx();
            ctx.rollback();
        }
        finally {
            this.resetLastSentInfo();
            this.transactionContext.remove();
        }
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.client.transaction.TransactionContext$EndXATransactionListener

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.