You might create an Application Scoped bean with a lock property. Setting
and releasing that lock will have to by synchronized.
For example, create a class as follows:
public class LockSet {
private boolean locked = false;
public LockSet() {
}
public synchronized void setLocked(boolean locked){
this.locked = locked;
}
public boolean isLocked(){
return locked;
}
}
And reference it in your faces-config.xml file as
<managed-bean>
<managed-bean-name>LockSet</managed-bean-name>
<managed-bean-class>com.myco.myapp.appbeans.LockSet</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
[EMAIL PROTECTED]
-----Original Message-----
From: ULA UVULA [mailto:[EMAIL PROTECTED]
Sent: Monday, October 29, 2007 2:03 PM
To: [email protected]
Subject: Locking a webapp against parallel using
Hi, I'm a newbie.
Can somebody can give me a hint?
I have written a jsf application which is maintaining a java data structure
(bean). (BTW: I never have written any jsp pages, I direct
starting with jsf).
Is there any way to inform the users that another user is already
manipulating this structure?
Workflow:
a user can add/delete/edit/copy items into the data structure. After the
work is finished, the user can
"activate/save" his settings. During this time span, I want to lock the page
for other users or at least I want to
inform the second user, that another user is already active.
The goal is to have consistency and not "last write wins".
Can you also consider: what happens, if the first user is closing the
web-browser without doing a "logoff" on the page?
Thanks
Uvula
--
This mailbox is not official and not checked regular. It's only
a workaround to have access through the web.
Please also reply to [EMAIL PROTECTED]
Uwe Langjahr / HP Service Consulting & Integration
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger