Java Reference
In-Depth Information
for (Timer timer : timerService.getTimers()) {
timer.cancel();
}
}
}
Finally, we'll add a booking record, which will be bounded with the current view using the
view scope. Its role will be to count the number of bookings done by the user in the cur-
rent view (a single browser tab is considered a single view):
package com.packtpub.wflydevelopment.chapter4.controller;
import com.packtpub.wflydevelopment.chapter4.entity.Seat;
import java.io.Serializable;
import javax.enterprise.event.Observes;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
@Named
@ViewScoped
public class BookingRecord implements Serializable {
private int bookedCount = 0;
public int getBookedCount() {
return bookedCount;
}
public void bookEvent(@Observes Seat bookedSeat) {
bookedCount++;
}
}
You can experiment with the booked counter by trying to book tickets via two separate
tabs in your browser.
Search WWH ::




Custom Search