.ad 8
.bm 8
.fm 4
.bt $Copyright by SAP AG, 2002$$Page %$
.tm 12
.hm 6
.hs 3
.tt 1 $SQL$Project Distributed Database System$VAK95$
.tt 2 $$$
.tt 3 $ElkeZ$Timeoutprocess$2000-11-10$
***********************************************************
.nf
 
 
    ========== licence begin  GPL
    Copyright (C) 2000 SAP AG
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    ========== licence end
 
.fo
.nf
.sp
Module  : Timeoutprocess
=========
.sp
Purpose : This module controls the request- and lock timeout
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :
 
        PROCEDURE
              a95_timeout_process (VAR t : tgg00_TransContext);
 
.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :
 
        FROM
              Kernel_Sink_1 : VAK341;
 
        PROCEDURE
              ak341OmsInspectTimeout;
 
      ------------------------------ 
 
        FROM
              Utilityprocess : VAK94;
 
        VAR
              a94mode : tgg_usemode;
 
      ------------------------------ 
 
        FROM
              pagestore : VBD10;
 
        PROCEDURE
              bd10CheckAndStartSavepoint( VAR Trans : tgg00_TransContext );
 
      ------------------------------ 
 
        FROM
              object_garbage_collection : VBD91;
 
        PROCEDURE (* PTS 1116157 FF 2002-06-07 *)
              bd91StartOMSGarbageCollectionIfRequired (VAR Trans : tgg00_TransContext);
 
      ------------------------------ 
 
        FROM
              KB_locklist : VKB51;
 
        PROCEDURE
              k51clear_locklist (VAR t : tgg00_TransContext);
 
      ------------------------------ 
 
        FROM
              KB_Logging : VKB560;
 
        PROCEDURE
              kb560CheckForLogSaveAndSavepoint (VAR trans : tgg00_TransContext);
 
      ------------------------------ 
 
        FROM
              KB_sender_receiver : VKB90;
 
        PROCEDURE
              k90clear_netserver (VAR t : tgg00_TransContext);
 
      ------------------------------ 
 
        FROM
              Configuration_Parameter : VGG01;
 
        VAR
              g01stand_alone : boolean;
 
        FUNCTION
              g01is_livecache : boolean;
 
      ------------------------------ 
 
        FROM
              RTE_kernel : VEN101;
 
        PROCEDURE
              vclock (VAR sec : tsp_int4;
                    VAR microsec : tsp_int4);
 
        PROCEDURE
              vsleep (pid : tsp_process_id;
                    limit : tsp_int2);
 
.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :
 
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : ElkeZ
.sp
.cp 3
Created : 1983-07-29
.sp
.cp 3
Version : 2002-10-21
.sp
.cp 3
Release :      Date : 2000-11-10
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:
.CM *-END-* specification -------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:
.sp 2
TIMEOUT_HANDLING
.sp
The control of the two timeout values
takes place in this procedure with the aid of
two KB procedures. Timeout control need only operate during warm operation;
during cold operation, it is possible at most for the utility process to be in
the Lock/Request list anyway.
.br;It is essential for the Lock list to be checked first before the Request
list is checked, so that a process does not perform a rollback for itself
(thrown out of the Request list) and so that the timeout process performs the
rollback for the same process, because it threw it out of the Lock list.
.br;The Lock list timeout and the Request list timeout run independently of one
another in time.
.sp 2;A95_TIMEOUT_PROCESS
.sp
Only the Trans_no is initialized for the timeout process, with the process
requiring this entry when it performs rollbacks for other processes.
.br;Then the process sleeps in a loop until one of the two timeout values has
to be controlled and TIMEOUT_HANDLING is called.
It is then determined how long the
process again has to sleep for until the next timeout value has to be
controlled.
.br;The loop is endless.
.CM *-END-* description ---------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.nf
.oc _/1
Structure:
 
.CM *-END-* structure -----------------------------------
.sp 2
**********************************************************
.sp
.cp 10
.nf
.oc _/1
.CM -lll-
Code    :
 
 
(*------------------------------*) 
 
PROCEDURE
      ak95timeout_handling (VAR t : tgg00_TransContext);
 
BEGIN
IF  a94mode = umUser_egg00
THEN
    BEGIN
    k51clear_locklist (t);
    IF  (t.trError_gg00 = e_ok) AND g01is_livecache
    THEN
        ak341OmsInspectTimeout; (* PTS 1110287 *)
    (*ENDIF*) 
    IF  t.trError_gg00 = e_ok
    THEN
        kb560CheckForLogSaveAndSavepoint (t);
    (*ENDIF*) 
    END;
(*ENDIF*) 
IF  (t.trError_gg00 = e_ok) AND g01is_livecache
THEN
    bd91StartOMSGarbageCollectionIfRequired (t); (* PTS 1116157 FF 2002-06-07 *)
(*ENDIF*) 
IF  (t.trError_gg00 = e_ok)
THEN
    bd10CheckAndStartSavepoint(t);
(*ENDIF*) 
IF  NOT g01stand_alone
THEN
    k90clear_netserver (t)
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a95_timeout_process (VAR t : tgg00_TransContext);
 
VAR
      do_forever      : boolean;
      timeout_value   : tsp_int4;
      timeout_interval: tsp_int4;
      start_time      : tsp_int4;
      stop_time       : tsp_int4;
      microsec        : tsp_int4;
 
BEGIN
do_forever := true;
(* "&ifdef NOTUSED" removed: PTS 1108234 JA 2000-11-08 *)
IF  g01is_livecache (* PTS 1110314 *)
THEN
    timeout_interval := cgg_lc_timeout_interval
ELSE
    timeout_interval := cgg_timeout_interval;
(*ENDIF*) 
timeout_value := timeout_interval;
WHILE do_forever DO
    BEGIN
    WITH t DO
        BEGIN
        trIndex_gg00     := cgg_nil_transindex;
        trTempCount_gg00 := 0;
        trError_gg00     := e_ok;
        trState_gg00     := [ ];
        trWarning_gg00   := [ ]
        END;
    (*ENDWITH*) 
    vsleep (t.trTaskId_gg00, timeout_value);
    vclock (start_time, microsec);
    ak95timeout_handling (t);
    vclock (stop_time, microsec);
    timeout_value := timeout_interval - (stop_time - start_time);
    IF  timeout_value < 0
    THEN
        timeout_value := 0; (* reschedule *)
    (* just to make aix-kompilation warning-free *)
    (*ENDIF*) 
    do_forever := (timeout_value >= 0);
    END
(*ENDWHILE*) 
END;
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
*-PRETTY-*  statements    :         32
*-PRETTY-*  lines of code :         82        PRETTYX 3.10 
*-PRETTY-*  lines in file :        294         1997-12-10 
.PA 
