How to block 2 users on the same screen - JAVA

Asked

Viewed 53 times

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

  • Friend I even did this but I found some problems, example, the person entered and closed the browser, the status was as blocked.

  • 1

    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".

  • 1

    hmm understood. Can’t put a timer maybe?

  • It would be a good idea this timer with ping, I will do a search because I am half illiterate in Java

  • 1

    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).

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.