The keywords of * * load-of-program “in ABAP help document are described as follows:
This event keyword defines the program constructor of an executable program, a module pool, a function group, or a subroutine pool. The program constructor is an event block whose event is raised by the ABAP-runtime environment when one of the executable programs mentioned above is loaded into the internal session.
Taking function group as an example, whenever any function module in a function group is called for the first time, the corresponding ABAP program is loaded into the internal session, and the ABAP runtime throws load-of-program to execute the event processing logic written by the application programmer.
Now I have a function group called ztomcat. Its load-of-program is responsible for popping the debugger.
I have two reports. Source code for report 2:
REPORT ZJERRY_RE2. call FUNCTION 'ZTEST_FM_1'.
CALL FUNCTION 'ZTEST_FM_1'. SUBMIT zjerry_re2 AND RETURN.
When I execute report1, will the breakpoint trigger once or twice?
The answer is twice.
The behavior of load-of-program in this scenario has been made clear by ABAP help:
When a program is called using SUBMIT or using a transaction code, a new internal session is opened in every call and the event block is executed once in every call.
Every time the program is called by the way of submit or transaction code, a new internal session will be started, in which load-of-program will be triggered once.
The following figure also visually shows that an internal session will be created every time the call to submit (calling programs).
Repeated loading of Tomcat library files
My pom.xml defines a gson dependency, which ABAPer can compare to calling the gson API provided by Google in my java code.
After the war package is printed, the library file is located in the WEB-INF / lib folder.
So if I have multiple web applications that use gson, there are jar files of gson under the web inflib folder of each application.
Question: will Tomcat load only one copy of gson. Jar into memory at runtime?
The answer is No. According to Tomcat’s official documents, Tomcat will create a special classloader instance for each web application. The resources under web-inflib of each application are invisible to other applications and isolated from each other.
Of course, if you want to use only one library file, you can put it under the directory [Tomcat installation directory] / common / lib. Refer to the discussion on stack overflow for more details
To get more original technical articles of Jerry, please pay attention to the public number “Wang Zixi” or scan the following two-dimensional code: