當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。