mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
No functional change - refactor internal toStream() to use closure rather than explicit Runnable type for closing the stream
Conceptually javac closure might be better than an extra explicit type here
This commit is contained in:
1 parent
f3af43a9ce
commit
c8345ce093
2 files changed
+10
-18
No files matched your search
@@ -39,9 +39,7 @@ public class TestQueryFindStream extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void findLargeStream_basic() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
try (Stream<Customer> stream = DB.find(Customer.class)
|
||||
.findLargeStream()) {
|
||||
|
||||
@@ -61,8 +59,16 @@ public class TestQueryFindStream extends BaseTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void manualTest_findSteam_when_streamNotClosed_connectionLeak() {
|
||||
public void manualTest_findSteam_when_closeWithResources() {
|
||||
// confirm manually the stream is closed via try with resources block
|
||||
try (Stream<Customer> stream = DB.find(Customer.class).findStream()) {
|
||||
// silly assert
|
||||
assertThat(stream.hashCode()).isNotZero();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void manualTest_findSteam_when_streamNotClosed_connectionLeak() {
|
||||
Stream<Customer> stream = DB.find(Customer.class).findStream();
|
||||
// remember a steam MUST be closed or we leak resources
|
||||
// comment out the close(); below to leak a connection
|
||||
|
||||
Reference in new issue
Block a user