当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionTransformer类代码示例

本文整理汇总了Java中com.amazon.carbonado.spi.ExceptionTransformer的典型用法代码示例。如果您正苦于以下问题:Java ExceptionTransformer类的具体用法?Java ExceptionTransformer怎么用?Java ExceptionTransformer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExceptionTransformer类属于com.amazon.carbonado.spi包,在下文中一共展示了ExceptionTransformer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BDBRepository

import com.amazon.carbonado.spi.ExceptionTransformer; //导入依赖的package包/类
/**
 * Subclass must call protected start method to fully initialize
 * BDBRepository.
 *
 * @param builder repository configuration
 * @param exTransformer transformer for exceptions
 * @throws IllegalArgumentException if name or environment home is null
 */
@SuppressWarnings("unchecked")
BDBRepository(AtomicReference<Repository> rootRef,
              BDBRepositoryBuilder builder,
              ExceptionTransformer exTransformer)
    throws ConfigurationException
{
    super(builder.getName());

    builder.assertReady();

    if (exTransformer == null) {
        throw new IllegalArgumentException("Exception transformer must not be null");
    }

    mIsMaster = builder.isMaster();
    mTriggerFactories = builder.getTriggerFactories();
    mRootRef = rootRef;
    mExTransformer = exTransformer;
    mTxnMgr = new BDBTransactionManager<Txn>(mExTransformer, this);

    mRunCheckpointer = !builder.getReadOnly() && builder.getRunCheckpointer();
    mKeepOldLogFiles = builder.getKeepOldLogFiles();
    mLogInMemory = builder.getLogInMemory();
    mRunDeadlockDetector = builder.getRunDeadlockDetector();
    mStorableCodecFactory = builder.getStorableCodecFactory();
    mPreShutdownHook = builder.getPreShutdownHook();
    mPostShutdownHook = builder.getShutdownHook();
    mInitialDBConfig = builder.getInitialDatabaseConfig();
    mDatabaseHook = builder.getDatabaseHook();
    mDatabasePageSizes = builder.getDatabasePagesMap();
    mDataHome = builder.getDataHomeFile();
    mEnvHome = builder.getEnvironmentHomeFile();
    mSingleFileName = builder.getSingleFileName();
    mFileNameMap = builder.getFileNameMap();

    getLog().info("Opening repository \"" + getName() + '"');
}
 
开发者ID:Carbonado,项目名称:Carbonado,代码行数:46,代码来源:BDBRepository.java

示例2: preCommit

import com.amazon.carbonado.spi.ExceptionTransformer; //导入依赖的package包/类
public boolean preCommit() throws PersistException {
    mScope.mLock.lock();

    switch (mState) {
    case EXITED:
        mScope.mLock.unlock();
        return false;

    case PRE_COMMITED:
        // Release extra lock, and then fallthrough to next case.
        mScope.mLock.unlock();

    case READY: default:
        // Perform pre-commit actions and return with lock held.
        try {
            if (mChild != null) {
                mChild.commit();
            }
            closeCursors();
            mState = PRE_COMMITED;
            return true;
        } catch (Throwable e) {
            // Restore state if any exception.
            mState = READY;
            mScope.mLock.unlock();
            throw ExceptionTransformer.getInstance().toPersistException(e);
        }
    }
}
 
开发者ID:Carbonado,项目名称:Carbonado,代码行数:30,代码来源:TransactionScope.java

示例3: getExceptionTransformer

import com.amazon.carbonado.spi.ExceptionTransformer; //导入依赖的package包/类
public ExceptionTransformer getExceptionTransformer() {
    return mExTransformer;
}
 
开发者ID:Carbonado,项目名称:Carbonado,代码行数:4,代码来源:BDBRepository.java

示例4: BDBTransactionManager

import com.amazon.carbonado.spi.ExceptionTransformer; //导入依赖的package包/类
BDBTransactionManager(ExceptionTransformer exTransformer, BDBRepository<Txn> repository) {
    mExTransformer = exTransformer;
    mRepositoryRef = new WeakReference<BDBRepository<Txn>>(repository);
}
 
开发者ID:Carbonado,项目名称:Carbonado,代码行数:5,代码来源:BDBTransactionManager.java

示例5: commit

import com.amazon.carbonado.spi.ExceptionTransformer; //导入依赖的package包/类
public void commit() throws PersistException {
    TransactionScope<Txn> scope = mScope;
    scope.mLock.lock();
    try {
        switch (mState) {
        case EXITED:
            return;

        case PRE_COMMITED:
            // Restore state and release extra lock.
            mState = READY;
            scope.mLock.unlock();
            break;

        case READY: default:
            // Perform pre-commit actions.
            if (mChild != null) {
                mChild.commit();
            }
            closeCursors();
            break;
        }

        if (mTxn != null) {
            if (mParent == null || mParent.mTxn != mTxn) {
                try {
                    if (!scope.mTxnMgr.commitTxn(mTxn)) {
                        mTxn = null;
                    }
                } catch (Throwable e) {
                    try {
                        scope.mTxnMgr.abortTxn(mTxn);
                    } catch (Throwable e2) {
                        // Ignore. At least we tried to clean up.
                    }
                    mTxn = null;
                    throw ExceptionTransformer.getInstance().toPersistException(e);
                }
            } else {
                // Indicate fake nested transaction committed.
                mTxn = null;
            }
        }
    } finally {
        scope.mLock.unlock();
    }
}
 
开发者ID:Carbonado,项目名称:Carbonado,代码行数:48,代码来源:TransactionScope.java


注:本文中的com.amazon.carbonado.spi.ExceptionTransformer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。