erratic navigation destroys functionality

I have a button that generates lottery numbers, wich i immediately set to a List and some NativeButton’s captions.
If you click the generate button that does this really fast, repeatedly, many times, for 5 seconds, the buttons that increment and decrement by 1 these numbers stop working, at first click either jumping by 20 at a time or so, doing nothing, but finally losing all functionality. EDIT: and it also loses the ability to throw errors such as Out of sync (the multiple tabs problem).

i also attached a test war for your convenience to import into eclipse as a project or deploy.
To get there, click “New Prognosis” > “Hybrid”, then click on “Generate” button fast for like 5 seconds.
The buttons that increment and decrement are above and below the numbers.

entry point:

public class OosApplication extends Application{
	public void init() {
		setMainWindow(new Window("Realloto Application"));
		getMainWindow().getContent().addComponent(new LotoMainMenu());


everything else is in ExtractionHorizontalLayout
generate button code:

generateButton.addListener(new ClickListener() {

			public void buttonClick(ClickEvent event) {
				Random r = new Random(System.currentTimeMillis());
				Set<Integer> set = new HashSet<Integer>();
				while (set.size() < 6)
					set.add(r.nextInt(48) + 1);
				int i = 0;
				for (Integer integer : set) {

an increment button’s code:

if (nativeButton == incrementNrs.get(0)) {
					getNextValid(nrs.get(0) + 1, 0);

algorythm that increments the values:

	 * Saves the next valid number in the extraction number list.
	private void getNextValid(Integer next, Integer index){
		boolean increasing = false;
		// Determines if it's increasing by comparing i > nrs(index)-i
		if (next > nrs.get(index))
			increasing = true;
		next = getNextValidWorker(next, increasing);
		if (next < 50 && next > 0) {
			nrs.set(index, next);

	private Integer getNextValidWorker(Integer i, boolean increasing) {		
		if (i < 50 && i > 0) {		
			for(Integer nr: nrs) {
				// if like another in the extraction
				if(nr == i) {
					// get next probable valid number
					if (increasing)
					// recurse to check new number validity
					i = getNextValidWorker(i, increasing);
		return i;

11323.war (3.4 MB)

This is definitely related to Vaadin. After i put the application in the messed up state, it doesn’t even throw out of sync errors if i open it in another tab, modify something then go back to first tab and try to do something with the control i changed in the other tab.

EDIT: so far my guess is that Vaadin gets mangled because my functionality takes longer to process than receiving the next request or something. I still don’t see what the solution would be (other than putting a crazy-guy-fast-button-pushing-safety-lock on the button).


I tested the application (WAR) and could see no problem even when clicking like crazy (maybe I’m just not crazy enough). Tested using Firefox 3.6, Chrome 5 and IE8

Thank you, i’m glad. My browsers are FF3.59, IE7. Could be you’re not clicking fast enough :grin:. I can probably click 10 times a second (don’t ask, long gaming experience in youth), untested. I’ll try to test from someone else’s computer outside my network when i get the chance and postback.

I sometime get weird errors when testing my stuff with my equipment, like beeing able to only download twice from a link on an aspx page of my own, before the link stops working, and need to clear cache, or probably restart the browser, can’t remember, while it works for anybody else on the other side of my d-link router.

Respect! :grin:

Well perhaps 7, 8 times a second most :grin:
Either way, it’s very reliable, even i go at a temperate pace, 4 times per second, like an annoyed user who has nothing better to do than to click my button several times in a row, it mangles the application.

Again, you have to push one of the increment / decrement buttons to see it. It starts even after pushing 4 times fast.

I’m suspecting it might mess the order of the list i’m using to store the values in, i might need to use a data structure that guarantees the order of elements. Even so, there’s no connection to the fact that the app loses ability to throw out of sync error.

Other than that, i’m on Tomcat 6.0.2, i don’t see why should it mess anything up.

Bah, proves where starting from wrong premises gets you.
Observing that each generation of numbers rather gives numbers from the previous, it struck me that there’s something wrong in my algorythm. And of course, i was adding to a list each generation of numbers instead of setting the first 6 numbers, while i was indexing only the first 6 as well. Because the list shifts the rest of the indexes while adding, it looked rather random. That was ugly… and wasteful.