bigjack
26th June 2007, 11:58
Hi,
I want to restrict the no. of users simultaneously running a customised session.
I'm thinking of achieving this by keeping track of users in a table or file and then checking this values before starting the session.
Is there any other direct way of achieving this?
Bye
giggig
26th June 2007, 12:37
Hi bigJack,
You can use the application lock.
functions appl.set(...) and app.delete(...)
(tables ttadv998, ttadv997)
GiG.
bigjack
26th June 2007, 12:47
Hi,
Thanks for your reply. However im looking for functionality wherein only a selected no. of users (> 1) can execute the session. In the appl.set() only one user will be allowed , im looking to restrict only 5 users from simultaneously running the session.(if sixth person tries to execute session he shouldnt be allowed to do so)
Bye
norwim
26th June 2007, 18:21
Hi Bigjack,
storing the user in a field of the table processed would only work if you cleared this filed whenever the user finishes the session - and if this table contains many records, you will have to read all of them to count the "uncleared" user fields (giving the number of sessions active atm).
If you have the date as a keyfield, this might be okay, but I tend to use a seperate "lock"-table in similar cases. When a user starts the session, you count the records here, if less than five, create a new record and allow further processing, otherwise exit (perhaps showing the active usernames).
On exit after processing delete the entry in the locktable.
hth
Norbert
bigjack
26th June 2007, 19:01
Hi Norwim,
This is precisely what i've done now and it works fine.
However in cases of network problems when the connection is lost the record is not flushed (similar to standard record locks - session ttstpdellocks)
I was wondering whether there is any direct method to find the no. of users actually using the session at any given time.
I have also tried bshcmd6.1 , but it is very slow (there are 100 users in my system an any given time) and also found out that it is unreliable.
Cya