Skip to content

Commit

Permalink
Merge pull request #3212 from ebean-orm/15x/remove-future-queries
Browse files Browse the repository at this point in the history
[15x] Remove "Future queries" findFutureList, findFutureIds, findFutureCount
  • Loading branch information
rbygrave authored Aug 30, 2023
2 parents 914e211 + 9e814fc commit 6f39efd
Show file tree
Hide file tree
Showing 20 changed files with 0 additions and 680 deletions.
36 changes: 0 additions & 36 deletions ebean-api/src/main/java/io/ebean/ExpressionList.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,42 +412,6 @@ default <A> A findSingleAttribute() {
*/
Optional<T> findOneOrEmpty();

/**
* Execute find row count query in a background thread.
* <p>
* This returns a Future object which can be used to cancel, check the
* execution status (isDone etc) and get the value (with or without a
* timeout).
* </p>
*
* @return a Future object for the row count query
*/
FutureRowCount<T> findFutureCount();

/**
* Execute find Id's query in a background thread.
* <p>
* This returns a Future object which can be used to cancel, check the
* execution status (isDone etc) and get the value (with or without a
* timeout).
* </p>
*
* @return a Future object for the list of Id's
*/
FutureIds<T> findFutureIds();

/**
* Execute find list query in a background thread.
* <p>
* This returns a Future object which can be used to cancel, check the
* execution status (isDone etc) and get the value (with or without a
* timeout).
* </p>
*
* @return a Future object for the list result of the query
*/
FutureList<T> findFutureList();

/**
* Return a PagedList for this query using firstRow and maxRows.
* <p>
Expand Down
20 changes: 0 additions & 20 deletions ebean-api/src/main/java/io/ebean/FutureIds.java

This file was deleted.

35 changes: 0 additions & 35 deletions ebean-api/src/main/java/io/ebean/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -1068,41 +1068,6 @@ enum LockWait {
*/
int findCount();

/**
* Execute find row count query in a background thread.
* <p>
* This returns a Future object which can be used to cancel, check the
* execution status (isDone etc) and get the value (with or without a
* timeout).
* </p>
*
* @return a Future object for the row count query
*/
FutureRowCount<T> findFutureCount();

/**
* Execute find Id's query in a background thread.
* <p>
* This returns a Future object which can be used to cancel, check the
* execution status (isDone etc) and get the value (with or without a
* timeout).
* </p>
*
* @return a Future object for the list of Id's
*/
FutureIds<T> findFutureIds();

/**
* Execute find list query in a background thread.
* <p>
* This query will execute in it's own PersistenceContext and using its own transaction.
* What that means is that it will not share any bean instances with other queries.
* </p>
*
* @return a Future object for the list result of the query
*/
FutureList<T> findFutureList();

/**
* Return a PagedList for this query using firstRow and maxRows.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,6 @@ public interface SpiEbeanServer extends SpiServer, ExtendedServer, BeanCollectio

<T> FutureRowCount<T> findFutureCount(SpiQuery<T> query);

<T> FutureIds<T> findFutureIds(SpiQuery<T> query);

<T> FutureList<T> findFutureList(SpiQuery<T> query);

<T> PagedList<T> findPagedList(SpiQuery<T> query);

<T> Set<T> findSet(SpiQuery<T> query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1228,45 +1228,6 @@ public <T> FutureRowCount<T> findFutureCount(SpiQuery<T> query) {
return queryFuture;
}

@Override
public <T> FutureIds<T> findFutureIds(SpiQuery<T> query) {
SpiQuery<T> copy = query.copy();
boolean createdTransaction = false;
SpiTransaction transaction = query.transaction();
if (transaction == null) {
transaction = currentServerTransaction();
if (transaction == null) {
transaction = (SpiTransaction) createTransaction();
createdTransaction = true;
}
copy.usingTransaction(transaction);
}
QueryFutureIds<T> queryFuture = new QueryFutureIds<>(new CallableQueryIds<>(this, copy, createdTransaction));
backgroundExecutor.execute(queryFuture.futureTask());
return queryFuture;
}

@Override
public <T> FutureList<T> findFutureList(SpiQuery<T> query) {
SpiQuery<T> spiQuery = query.copy();
// FutureList query always run in it's own persistence content
spiQuery.setPersistenceContext(new DefaultPersistenceContext());
// Create a new transaction solely to execute the findList() at some future time
boolean createdTransaction = false;
SpiTransaction transaction = query.transaction();
if (transaction == null) {
transaction = currentServerTransaction();
if (transaction == null) {
transaction = (SpiTransaction) createTransaction();
createdTransaction = true;
}
spiQuery.usingTransaction(transaction);
}
QueryFutureList<T> queryFuture = new QueryFutureList<>(new CallableQueryList<>(this, spiQuery, createdTransaction));
backgroundExecutor.execute(queryFuture.futureTask());
return queryFuture;
}

@Override
public <T> PagedList<T> findPagedList(SpiQuery<T> query) {
int maxRows = query.getMaxRows();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,21 +218,6 @@ public int update(Transaction transaction) {
return query.update(transaction);
}

@Override
public FutureIds<T> findFutureIds() {
return query.findFutureIds();
}

@Override
public FutureRowCount<T> findFutureCount() {
return query.findFutureCount();
}

@Override
public FutureList<T> findFutureList() {
return query.findFutureList();
}

@Override
public PagedList<T> findPagedList() {
return query.findPagedList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,6 @@ public ExpressionList<T> filterMany(String prop) {
return rootQuery.filterMany(prop);
}

@Override
public FutureIds<T> findFutureIds() {
return rootQuery.findFutureIds();
}

@Override
public FutureList<T> findFutureList() {
return rootQuery.findFutureList();
}

@Override
public FutureRowCount<T> findFutureCount() {
return rootQuery.findFutureCount();
}

@Override
public List<T> findList() {
return rootQuery.findList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,21 +328,6 @@ public boolean exists() {
return exprList.exists();
}

@Override
public FutureIds<T> findFutureIds() {
return exprList.findFutureIds();
}

@Override
public FutureList<T> findFutureList() {
return exprList.findFutureList();
}

@Override
public FutureRowCount<T> findFutureCount() {
return exprList.findFutureCount();
}

@Override
public <A> List<A> findIds() {
return exprList.findIds();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
import io.ebean.FetchConfig;
import io.ebean.FetchGroup;
import io.ebean.FetchPath;
import io.ebean.FutureIds;
import io.ebean.FutureList;
import io.ebean.FutureRowCount;
import io.ebean.OrderBy;
import io.ebean.PagedList;
import io.ebean.PersistenceContextScope;
Expand Down Expand Up @@ -346,21 +343,6 @@ public int findCount() {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
}

@Override
public FutureRowCount<T> findFutureCount() {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
}

@Override
public FutureIds<T> findFutureIds() {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
}

@Override
public FutureList<T> findFutureList() {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
}

@Override
public PagedList<T> findPagedList() {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6f39efd

Please sign in to comment.