I wondering what others do for pessimistic locking strategies.
D3's normal READU will lock a record for that PIB, and that execute level, which is good, and it is the behavior all D3 Basic programs probably use.
My character based apps allow a user to "push" a level, so if you were in a customer maintenance screen, for example, the customer record ABCD would be locked, and if you pushed a level in that screen and used a menu selection to open a new customer maintenance screen and tried to edit ABCD, it would locked via the normal READU behavior. This would work the same if some other user on another PIB had ABCD locked.
With a Java Swing app using MVSP, because it's a GUI, I can have multiple windows opened at the same time, so I could have 2 (or 200) customer maintenance screens open and clearly don't want to edit the same record on more than one screen. If I used one D3 connection per open window, I'd pretty soon run out of user licences, so I'm only using one D3 connection for the entire Swing app (I may change that to use 2 connections to take advantage of the 2-for-1 licencing). This approach works fine because Swing is single threaded, so only one window is active at a time. Unfortunately, this means I need to implement my own pessimistic locking scheme by writing a lock record to a file (since if I used READU, because the connection is the same PIB and same level, it will allow the record to be locked again) .
Because checking for locks needs to be synchronized and atomic, I'm using the "LOCK nn" / "UNLOCK nn" Basic statement to ensure only one process can update the lock file at a time.
Not too sure how this will scale.
For a web app, for which the connection to D3 is implicitly non-persistent (unless maybe if you're using web sockets) how do people handle READU style locking across requests ?
Any thoughts appreciated.
------------------------------
Bryan Buchanan
------------------------------


