Repeated loading of ABAP function group and Tomcat Library



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 1:



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:

Recommended Today

The use of progressbarcontrol, a progress bar control of devexpress – Taking ZedGraph as an example to add curve progress

scene WinForm control – devexpress18 download installation registration and use in vs: When using ZedGraph to add curves, the number of curves is slower if there are many cases. So in the process of adding curve, the progress needs to be displayed, and the effect is as follows     Note: Blog home page: […]