Hi folks,

Just wanted to do a quick "heads-up" that Isis now supports request-scoped
services [1].

These are injected into entities and services just like any other service;
in fact the implementation [2] is that the service is wrapped in a
singleton proxy, and the per (thread) request switching is performed within
the proxy itself.

Anyway, to indicate that a service is request scoped, just annotate it with
javax.enterprise.context.RequestScoped.    This is an annotation from the
CDI spec, of Java EE 6. I hope that one day Isis will support all of the
CDI annotations; but @RequestScoped is probably the most important one that
we haven't to date.

A couple of notes on dependencies: first, that the CDI library is now a
dependency of Isis' applib, and also that javassist is a dependency of the
Isis runtime (for that clever proxy support).

In addition, there are a number of new request-scoped services, part of the
applib.

The Scratchpad service [3] provides a way for passing arbitrary data
between actions; primarily of use for bulk actions.  There's an example
showing its usage in the todo app [4].

The QueryResultsCache [5] is a mechanism for performance tuning, something
that we'll be using in Estatio.  The idea is that, if there's a repository
query (typically against immutable reference data) tha will be called many
times within a tight loop), then the repository can use the
QueryResultsCache to hold onto the repository query results for subsequent
calls within the same request.

Finally, the Bulk.InteractionContext [6], a class that was shipped in 1.3.1
and which provides a mechanism for bulk actions to access the "iterator"
(getIndex(), isFirst(), isLast() etc), has now been refactored to be a
request scoped service (previously it was a thread local).

Ta
Dan


[1] https://issues.apache.org/jira/browse/ISIS-652
[2]
https://github.com/apache/isis/blob/e7f97df59ccbb0c996dcd53e5626f67a53a0b0a5/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServiceInstantiator.java
[3] https://issues.apache.org/jira/browse/ISIS-654
[4]
https://github.com/apache/isis/blob/e7f97df59ccbb0c996dcd53e5626f67a53a0b0a5/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java#L591
[5] https://issues.apache.org/jira/browse/ISIS-655
[6] https://issues.apache.org/jira/browse/ISIS-653

Reply via email to