本文整理了Java中com.j256.ormlite.dao.Dao.closeLastIterator()
方法的一些代码示例,展示了Dao.closeLastIterator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dao.closeLastIterator()
方法的具体详情如下:
包路径:com.j256.ormlite.dao.Dao
类名称:Dao
方法名:closeLastIterator
[英]This closes the last iterator returned by the #iterator() method.
NOTE: This is not reentrant. If multiple threads are getting iterators from this DAO then you should use the #getWrappedIterable() method to get a wrapped iterable for each thread instead.
[中]这将关闭#iterator()方法返回的最后一个迭代器。
注意:这不是可重入的。如果多个线程从这个DAO获取迭代器,那么应该使用#getwrappedeterable()方法为每个线程获取一个包装的iterable。
代码示例来源:origin: j256/ormlite-core
/**
* @see Dao#closeLastIterator()
*/
@Override
public void closeLastIterator() {
try {
dao.closeLastIterator();
} catch (IOException e) {
logMessage(e, "closeLastIterator threw exception");
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.j256.ormlite/ormlite-core
/**
* @see Dao#closeLastIterator()
*/
@Override
public void closeLastIterator() {
try {
dao.closeLastIterator();
} catch (IOException e) {
logMessage(e, "closeLastIterator threw exception");
throw new RuntimeException(e);
}
}
代码示例来源:origin: j256/ormlite-core
@Test(expected = RuntimeException.class)
public void testCloseLastIteratorThrow() throws Exception {
@SuppressWarnings("unchecked")
Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class);
RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao);
dao.closeLastIterator();
expectLastCall().andThrow(new SQLException("Testing catch"));
replay(dao);
rtDao.closeLastIterator();
verify(dao);
}
代码示例来源:origin: j256/ormlite-core
@Test
public void testIteratorLastClose() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
Foo foo1 = new Foo();
assertEquals(1, dao.create(foo1));
CloseableIterator<Foo> iterator = dao.iterator();
assertTrue(iterator.hasNext());
Foo foo3 = iterator.next();
assertEquals(foo1.id, foo3.id);
assertFalse(iterator.hasNext());
dao.closeLastIterator();
}
代码示例来源:origin: j256/ormlite-core
@Test
public void testWrappedIterator() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
Foo foo1 = new Foo();
assertEquals(1, dao.create(foo1));
CloseableWrappedIterable<Foo> wrapped = dao.getWrappedIterable();
CloseableIterator<Foo> iterator = wrapped.closeableIterator();
// this shouldn't close anything
dao.closeLastIterator();
assertTrue(iterator.hasNext());
Foo foo3 = iterator.next();
assertEquals(foo1.id, foo3.id);
assertFalse(iterator.hasNext());
wrapped.close();
}
内容来源于网络,如有侵权,请联系作者删除!