All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.atomikos.datasource.xa.AcceptAllXATransactionalResource Maven / Gradle / Ivy

There is a newer version: 6.0.0
Show newest version
/**
 * Copyright (C) 2000-2016 Atomikos 
 *
 * LICENSE CONDITIONS
 *
 * See http://www.atomikos.com/Main/WhichLicenseApplies for details.
 */

package com.atomikos.datasource.xa;

import javax.transaction.xa.XAResource;

import com.atomikos.datasource.ResourceException;

/**
 *
 * This class is useful only for enlist via the JTA API. In particular, this class
 * is a 'workaround' for buggy XAResource implementations where isSameRM returns false
 * even if it should not. With the default automatic resource registration mode,
 * this situation would lead to another XATransactionalResource being added to the
 * configuration for each such enlist. As an alternative, this class pretends to
 * recognize any XAResource and can be used to avoid problems when
 * automatic registration is disabled: instead of reporting errors
 * claiming that the XAResource is unknown for faulty isSameRM cases,
 * this class will silently accept them.
 *
 *
 */
public class AcceptAllXATransactionalResource extends XATransactionalResource
{

    /**
     * @param servername
     */
    public AcceptAllXATransactionalResource ( String servername )
    {
        super ( servername );
        super.setAcceptAllXAResources ( true );
    }

    /**
     * @param servername
     * @param factory
     */
    public AcceptAllXATransactionalResource ( String servername ,
            XidFactory factory )
    {
        super ( servername , factory );
        super.setAcceptAllXAResources ( true );
    }

    /**
     * @see com.atomikos.datasource.xa.XATransactionalResource#refreshXAConnection()
     */
    protected XAResource refreshXAConnection () throws ResourceException
    {

        return null;
    }

    /**
     * Always returns true.
     */
    public boolean usesXAResource ( XAResource res )
    {
        // this is essential for XID mapping
        return true;
    }

    protected void recoverTheDeprecatedWay ()
    {
        // nothing to do
    }

    public void endRecovery ()
    {
        // nothing to do
    }



}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy