本文整理汇总了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();
}
}