本文整理汇总了Java中org.apache.ignite.cache.store.CacheStoreSession.properties方法的典型用法代码示例。如果您正苦于以下问题:Java CacheStoreSession.properties方法的具体用法?Java CacheStoreSession.properties怎么用?Java CacheStoreSession.properties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.cache.store.CacheStoreSession
的用法示例。
在下文中一共展示了CacheStoreSession.properties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connection
import org.apache.ignite.cache.store.CacheStoreSession; //导入方法依赖的package包/类
/**
* @return Connection.
* @throws SQLException In case of error.
*/
protected Connection connection() throws SQLException {
CacheStoreSession ses = session();
if (ses.transaction() != null) {
Map<String, Connection> prop = ses.properties();
Connection conn = prop.get(ATTR_CONN_PROP);
if (conn == null) {
conn = openConnection(false);
// Store connection in session to used it for other operations in the same session.
prop.put(ATTR_CONN_PROP, conn);
}
return conn;
}
// Transaction can be null in case of simple load operation.
else
return openConnection(true);
}
示例2: sessionEnd
import org.apache.ignite.cache.store.CacheStoreSession; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void sessionEnd(boolean commit) throws CacheWriterException {
CacheStoreSession ses = session();
Transaction tx = ses.transaction();
if (tx != null) {
Map<String, Connection> sesProps = ses.properties();
Connection conn = sesProps.get(ATTR_CONN_PROP);
if (conn != null) {
sesProps.remove(ATTR_CONN_PROP);
try {
if (commit)
conn.commit();
else
conn.rollback();
}
catch (SQLException e) {
throw new CacheWriterException(
"Failed to end transaction [xid=" + tx.xid() + ", commit=" + commit + ']', e);
}
finally {
U.closeQuiet(conn);
}
}
if (log.isDebugEnabled())
log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
}
}
示例3: checkSession
import org.apache.ignite.cache.store.CacheStoreSession; //导入方法依赖的package包/类
/**
* @param mtd Called stored method.
*/
private void checkSession(String mtd) {
assertNotNull(ignite);
assertFalse(expData.isEmpty());
ExpectedData exp = expData.remove(0);
assertEquals(exp.expMtd, mtd);
CacheStoreSession ses = session();
assertNotNull(ses);
assertSame(ses, sesInParent);
if (exp.tx)
assertNotNull(ses.transaction());
else
assertNull(ses.transaction());
Map<Object, Object> props = ses.properties();
assertNotNull(props);
assertEquals(exp.expProps, props);
props.put(props.size(), mtd);
assertEquals(exp.expCacheName, ses.cacheName());
}