The lock consultation screen is a dashboard which allows to have a quick and synthetic view on the whole features or entities used and locked within your WEDIA application.
The "locks" allow for other things:
to lock an instance when a user is editing the record, so that no other user can edit the master record until the first user is finished
lock a configuration screen, so that two users cannot change the configuration at the same time
lock a portion of code, so that the code runs at a time t only on one of the cluster’s servers
Screen
This screen shows all existing locks on all servers.
If the application is installed on a cluster, then this screen of any server has all the locks of all servers.
Unicity of a lock
The uniqueness of a lock is on the couple "Family"/"Sub-Family".
System families
The engine already manages some lock families:
ctobjectlock: used to lock a data instance during editing
httpservletsecurelock: used to lock certain administrative functions
wsnoheto.scheduler.scheduler: used by the "Task Scheduler" of the engine
ctobjectlock: Wedia instances locked
Each instance currently being edited (by BackOffice) or by using APIs appears in this table.
The instance is noted in the "SubFamily" with "[object name]/[instance identifier]".
For each lock, it is possible to see the creation date of the lock, the expiration date of the lock, and the user having locked this instance.
Api
API to create a new lock is: wsnoheto.cluster.lock.CommonLock
class MonRunnable implements Runnable { final CommonLock maintenanceLock = new CommonLock("Famille", "sous-faille", TEMPS_DE_CAPTURE_DU_LOCK, 0) { }; void run() { try { try { maintenanceLock.obtainLock(Startup.isClustered()?Startup.getNodeName():"local"); // Code à exécuter sur une seule instance en cluster ou pas } finally { // on ne libere que si on l'a eu maintenanceLock.freeLock(); } } catch (CommonLock.AlreadyLockedException e) { } catch (CommonLock.TimeoutLockedException e) { } } }