Java Reference
In-Depth Information
gets injected in the SFSB reference; otherwise, you will end up creating a new Stateful
Session Beans upon each request.
The following is an example of how to adapt your Ticket CDI application (described in
first, as we said, we need to include the distributable stanza in your
web.xml
file to trig-
ger clustering modules:
<web-app>
<distributable/>
</web-app>
Next, apply the same changes to the
TheatreBox
singleton that we described in the
Turning your cache into a distributed cache
section:
@Singleton
@Startup
public class TheatreBox {
@Resource(lookup="java:jboss/infinispan/container/
cluster")
private CacheContainer container;
// Apply the same changes described in
// "Turning your Cache into a distributed cache section
}
Since our controller component is bound to a
@SessionScoped
state, you don't need to
apply any changes in order to propagate your session across server nodes:
@Named
@SessionScoped
public class TheatreBooker implements Serializable {
}
Finally, remember to include the Infinispan dependency in your
META-INF/
MANIFEST.MF
:
Dependencies: org.infinispan export