Java Reference
In-Depth Information
If a suitable node is found, the JBoss EJB client implementation creates a connec-
tion to that node (in our case NodeB ) and creates an EJB receiver out of it. At the
end of this process, the invocation has now been effectively failed over to a different
node within the cluster.
Clustering the Ticket example
In Chapter 3 , Beginning Java EE 6 - EJBs , we have shown our Ticket System ex-
ample, which was built around the following:
• A stateful EJB to hold the session data
• A singleton EJB to store the cache of data
• A stateless EJB to perform some business methods
Let's see how to apply the necessary changes to move our application in a cluster
context.
So let's start from our stateful EJB:
@Stateful
@Remote(TheatreBooker.class)
@Clustered
public class TheatreBookerBean implements
TheatreBooker {
private static final Logger logger =
Logger.getLogger(TheatreBookerBean.class);
int money;
@EJB TheatreBox theatreBox;
@PostConstruct
public void createCustomer() {
this.money=100;
}
public String bookSeat(int seatId) throws
Search WWH ::




Custom Search