本文整理汇总了Java中org.apache.ignite.cache.store.CacheStoreSession.isWithinTransaction方法的典型用法代码示例。如果您正苦于以下问题:Java CacheStoreSession.isWithinTransaction方法的具体用法?Java CacheStoreSession.isWithinTransaction怎么用?Java CacheStoreSession.isWithinTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.cache.store.CacheStoreSession
的用法示例。
在下文中一共展示了CacheStoreSession.isWithinTransaction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSessionEnd
import org.apache.ignite.cache.store.CacheStoreSession; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void onSessionEnd(CacheStoreSession ses, boolean commit) {
if (ses.isWithinTransaction()) {
TransactionStatus tx = ses.attach(null);
if (tx != null) {
try {
if (commit)
txMgr.commit(tx);
else
txMgr.rollback(tx);
}
catch (TransactionException e) {
throw new CacheWriterException("Failed to end store session [tx=" + ses.transaction() + ']', e);
}
}
}
}
示例2: onSessionStart
import org.apache.ignite.cache.store.CacheStoreSession; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void onSessionStart(CacheStoreSession ses) {
if (ses.attachment() == null) {
try {
Session hibSes = sesFactory.openSession();
ses.attach(hibSes);
if (ses.isWithinTransaction())
hibSes.beginTransaction();
}
catch (HibernateException e) {
throw new CacheWriterException("Failed to start store session [tx=" + ses.transaction() + ']', e);
}
}
}
示例3: onSessionStart
import org.apache.ignite.cache.store.CacheStoreSession; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void onSessionStart(CacheStoreSession ses) {
if (ses.isWithinTransaction() && ses.attachment() == null) {
try {
TransactionDefinition def = definition(ses.transaction(), ses.cacheName());
ses.attach(txMgr.getTransaction(def));
}
catch (TransactionException e) {
throw new CacheWriterException("Failed to start store session [tx=" + ses.transaction() + ']', e);
}
}
}