project BLF > class Session > method IsTimedOut
Parameters
olIsTimedOut | output | logical | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/session.p)
assign olIsTimedOut = false.
<M-56 run StartCacher
(output vhFcComponent (ohCacher),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-41 run GetSessionTimeout
(input viSessionID (iiSessionId),
output vcThisGlobalSessionId (ocGlobalSessionId),
output vtThisGlobalLastCheckDate (otGlobalLastCheckDate),
output viThisGlobalLastCheckTime (oiGlobalLastCheckTime),
output vtThisLastCheckDate (otLastCheckDate),
output viThisLastCheckTime (oiLastCheckTime),
output viThisTimeout (oiTimeout),
output viDummy (oiGlobalSessionDebugLevel)) in Cacher>
if vcThisGlobalSessionId = ?
then do:
assign olIsTimedOut = true.
return.
end.
/* Skip check if SessionTiomeOut = 0 */
if viThisTimeout <> 0
then do:
/* Use date and time in UTC */
assign session:timezone = 0.
if ((today - vtThisLastCheckDate) * 24 * 60) + ((time - viThisLastCheckTime) / 60) > viThisTimeout
then do:
if com.qad.qra.config.QraConfig:IsEnabled
then do:
<I-96 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "PAuthenticationQRA"}>
<M-15 run KeepAlive
(input vcThisGlobalSessionId (icGlobalSessionId),
input yes (ilUpdateSession),
output vlIsAlive (olIsActive),
output viFcReturnSuper (oiReturnStatus)) in PAuthenticationQRA>
<I-21 {bFcCloseAndStopInstance
&CLASS = "PAuthenticationQRA"}>
end.
else do:
<I-98 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "PAuthentication"}>
<M-6 run KeepAlive
(input vcThisGlobalSessionId (icGlobalSessionId),
input yes (ilUpdateSession),
output vlIsAlive (olIsActive),
output viFcReturnSuper (oiReturnStatus)) in PAuthentication>
<I-11 {bFcCloseAndStopInstance
&CLASS = "PAuthentication"}>
end.
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
if vlIsAlive
then do:
<M-26 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
assign vcQuery = "for each fcSession where fcSession.SessionInstance_ID = " + string(viSessionID).
<M-93 run WriteDirect
(input 'fcSession' (icTableName),
input vcQuery (icPrepare),
input 'GlobalSessionNeedsUpdate,SessionLastCheckTime,SessionLastCheckDate,GlobalSessionLastCheckTime,GlobalSessionLastCheckDate' (icFieldList),
input 'l,i,t,i,t' (icFieldListDataTypes),
input 'false' + chr(2) + string(time) + chr(2) + string(today) + chr(2) + string(time) + chr(2) + string(today) (icAbsolute),
input '' (icIncremental),
input {&TARGETPROCEDURE} (ihClass),
input vcUserLogin (icUserLogin),
output viFcReturnSuper (oiReturnStatus)) in persistence>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
else do:
<M-90 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
/* Delete the record */
assign vcQuery = "for each fcSession where fcSession.SessionInstance_ID = " + string(viSessionID).
<M-87 run WriteDirect
(input 'fcSession' (icTableName),
input vcQuery (icPrepare),
input '' (icFieldList),
input '' (icFieldListDataTypes),
input '' (icAbsolute),
input '' (icIncremental),
input {&TARGETPROCEDURE} (ihClass),
input vcUserLogin (icUserLogin),
output viFcReturnSuper (oiReturnStatus)) in persistence>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
assign olIsTimedOut = true.
return.
end.
end.
else
if today <> vtThisLastCheckDate or
(time - viThisLastCheckTime) > 60
then do:
assign vlGlobalSessionNeedsUpdate = ((today - vtThisGlobalLastCheckDate) * 24 * 60) + ((time - viThisGlobalLastCheckTime) / 60) > (viThisTimeout / 2).
<M-71 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
assign vcQuery = "for each fcSession where fcSession.SessionInstance_ID = " + string(viSessionID).
<M-40 run WriteDirect
(input 'fcSession' (icTableName),
input vcQuery (icPrepare),
input 'GlobalSessionNeedsUpdate,SessionLastCheckTime,SessionLastCheckDate' (icFieldList),
input 'l,i,t' (icFieldListDataTypes),
input string(vlGlobalSessionNeedsUpdate, 'true/false') + chr(2) + string(time) + chr(2) + string(today) (icAbsolute),
input '' (icIncremental),
input {&TARGETPROCEDURE} (ihClass),
input vcUserLogin (icUserLogin),
output viFcReturnSuper (oiReturnStatus)) in persistence>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
end.
finally:
assign session:timezone = viTimeOffset.
end finally.