0
I need to block the access of 2 people on the same screen, example, two people try to access the registration of a particular product, the second person who tries to enter should receive a warning that someone is accessing this registration. Anybody got any ideas? Working with java, jsf, primefaces and Hibernate.
puts a "locked" field in the database and when the product is accessed changes that field to true and when it exits to false. E makes negotiations to only allow access if the field is false
– Lucas Brogni
Friend I even did this but I found some problems, example, the person entered and closed the browser, the status was as blocked.
– Leandro Santos
So you do a javascript ping by ajax saying "hey man, I’m still here". After a while without receiving these pings, it is because the person on the screen has gone away. If she comes back, the server says "it was already expensive, it took too long, lost".
– Victor Stafusa
hmm understood. Can’t put a timer maybe?
– Lucas Brogni
It would be a good idea this timer with ping, I will do a search because I am half illiterate in Java
– Leandro Santos
But you need to block for editing or viewing? If it’s for editing, then you need a more refined control. If it is just for viewing, could implement a websocket to see who is accessing the screen (I think it would be better than ping).
– Marcus Martins