本文整理匯總了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() + '"');
}
示例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);
}
}
}
示例3: getExceptionTransformer
import com.amazon.carbonado.spi.ExceptionTransformer; //導入依賴的package包/類
public ExceptionTransformer getExceptionTransformer() {
return mExTransformer;
}
示例4: BDBTransactionManager
import com.amazon.carbonado.spi.ExceptionTransformer; //導入依賴的package包/類
BDBTransactionManager(ExceptionTransformer exTransformer, BDBRepository<Txn> repository) {
mExTransformer = exTransformer;
mRepositoryRef = new WeakReference<BDBRepository<Txn>>(repository);
}
示例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();
}
}