Scenario that triggered this issue:
We have a Objectify context properly initialized by ObjectifyFilter for the whole request. We are using a highly volatile entity. During that request after some execution and already having that entity in the objectify local Session cache we need the current global state of that entity from the datastore/memcache. Doesn't matter if it is memcached or not, we just want to skip the local cache. Also we don't need the overhead a transaction provides.
We solved this by using
try (Closeable closeable = ObjectifyService.begin()) {
return ofy().load().type(c).id(id).now();
}
The problem we faced is that during the close() method PendingFutures.completeAllPendingFutures(); is called which is a static class with a thread-local collection of pending futures. This call waits for a Future.get on all of them. It even waits for the requests started by the external Objectify context. I think it should only wait the requests launched with the "current" Objectify instance, and the futures should be collected to where they belong.
Am I missing a point here on the why?
Scenario that triggered this issue:
We have a
Objectifycontext properly initialized byObjectifyFilterfor the whole request. We are using a highly volatile entity. During that request after some execution and already having that entity in the objectify localSessioncache we need the current global state of that entity from the datastore/memcache. Doesn't matter if it is memcached or not, we just want to skip the local cache. Also we don't need the overhead a transaction provides.We solved this by using
The problem we faced is that during the
close()methodPendingFutures.completeAllPendingFutures();is called which is a static class with a thread-local collection of pending futures. This call waits for aFuture.geton all of them. It even waits for the requests started by the externalObjectifycontext. I think it should only wait the requests launched with the "current"Objectifyinstance, and the futures should be collected to where they belong.Am I missing a point here on the why?