2010/5/26 sebb <seb...@gmail.com>: >> - private int removed = 0; >> + private volatile int removed = 0; > > Volatile ensures correct publication across threads, but does not > solve the lost-update problem. > >> removed++; > The above line can suffer from a lost update as the increment is not atomic. >
The "removed" variable is only checked whether it is zero or some positive value. So, the actual value of the variable before the increment operation is irrelevant. It could be written as "removed = 1;" and assignment is atomic. Are there any observable consequences? If they are, you may file an issue. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org