I am developing a web application using Struts and I want to show the website visitor counter to user.
I have implemented it using Cookie. When new user visit the cookie is added and the counter in the database is incremented.
As there simultaneous access to counter during visits...and to prevent from reset to counter to some wrong value during
multiple access, I have use the synchronized block for counter increment operation.
But because of synchronized...the website takes very long time to load.
I am quite confued now, so can you please help me in this regard ?
what should i use instead of synchronized block...or any other solution which solves the above problem ?