• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Prevent Multiple Submits

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I have an application, where in I have multipler servers (used for load-balancing). And the data is maintained in oracle and is pretty huge. As the application is vast, there are many performance-intensive transactions that take even 10 minutes to complete. Recently, we have been having issues where the same operation has been committed by multiple-users. Example,

a.) First user logs in and submits the process
b.) while the transaction is running, another user trys to do the same thing unknowing the fact that it is already running.

I can try preventing this submit, using javascript or even session. But, this being a multi-server architecture, session variable that is present in one server is not visible to the other one.

Can you please suggest me one best way to prevent this problem?

Thanks
Bala
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



I can try preventing this submit, using javascript or even session. But, this being a multi-server architecture, session variable that is present in one server is not visible to the other one.



Bala,

I dont understand how one user is so tightly coupled to the other user. Is it clustered servers ? in that case session migration is there and session variable is visible to other servers , but its costly and hence you got to minimize the variables in session.

Javascript ? Do you mean disabling submit . thats not the proper solution for this.



Is that expected behavior ? Check if you use any instance variables , which is shared among threads , hence needs to be synchronized.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it takes that long to complete request, better use a queue for the requests and process each one as they complete.
Hope it helps.
 
Balakrishnan Viswanathan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.

Actually yes, some times even the user who submitted first assumes that the process is not running correctly and re-submits it again. Or some other user submits the process.
Am not sure whether usage of synchronized will help here and nor the synchronized threads.

Actually, am thinking about a way to load the first user submit details in a xml and when second user submits, use JAXB to identify whether it is present and if present do not do it again.

Any suggestions or improvements?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic