Fix for Issue 35 Connection pool leak with findFutureRowCount(),

findFutureList() and findFutureIds()
This commit is contained in:
Robin Bygrave committed 2013-07-01 20:17:38 +12:00
1 parent c0b83b939d
commit 243864fef7
11 files changed
+216 -65

No files matched your search

@@ -3,9 +3,9 @@ package com.avaje.ebeaninternal.server.query;
import java.util.List;
import java.util.concurrent.Callable;
import com.avaje.ebean.Query;
import com.avaje.ebean.Transaction;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.api.SpiQuery;
/**
* Represent the fetch Id's query as a Callable.
@@ -15,7 +15,7 @@ import com.avaje.ebeaninternal.api.SpiEbeanServer;
public class CallableQueryIds<T> extends CallableQuery<T> implements Callable<List<Object>> {
public CallableQueryIds(SpiEbeanServer server, Query<T> query, Transaction t) {
public CallableQueryIds(SpiEbeanServer server, SpiQuery<T> query, Transaction t) {
super(server, query, t);
}
@@ -26,7 +26,11 @@ public class CallableQueryIds<T> extends CallableQuery<T> implements Callable<Li
// we have already made a copy of the query
// this way the same query instance is available to the
// QueryFutureIds (as so has access to the List before it is done)
return server.findIdsWithCopy(query, t);
try {
return server.findIdsWithCopy(query, transaction);
} finally {
transaction.end();
}
}
}