ABAP function group和Tomcat library重复加载问题
ABAP
ABAP help文档里对**LOAD-OF-PROGRAM"的关键字是这样描述的:
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.
以Function group为例,每当一个function group里的任意一个function module第一次被调用时,对应的ABAP program被加载到internal session里,同时ABAP运行时抛出LOAD-OF-PROGRAM, 执行应用程序员编写的事件处理逻辑。
现在我有一个名为ZTOMCAT的function group。其LOAD-OF-PROGRAM就负责弹出调试器。

我有两个report。Report 2的源代码:
REPORT ZJERRY_RE2.
call FUNCTION 'ZTEST_FM_1'.
Report 1:
CALL FUNCTION 'ZTEST_FM_1'.
SUBMIT zjerry_re2 AND RETURN.
那么我执行report1,断点会触发一次还是两次?
答案是两次。


LOAD-OF-PROGRAM在这种场景下的行为,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.
每次program通过SUBMIT或者事务码的方式调用时,会起一个新的internal session,在此新的session里LOAD-OF-PROGRAM会触发一次。
下图也直观表明了每次调用SUBMIT( calling programs)时会新起一个Internal Session。

Tomcat 库文件的重复加载问题
我的pom.xml里定义了一个gson的依赖关系,ABAPer可以把其类比成在我的Java代码里调用Google提供的gson API。

打成war包之后,该库文件位于WEB-INF/lib文件夹下。

那么如果我有多个Web应用都用到了gson, 则每个应用的WEB-INF\lib文件夹下面都有gson的jar文件。
问题:在运行时,Tomcat只会将一份gson.jar的内容加载到内存么?
答案是不会。根据Tomcat的官方文档,Tomcat会为每个Web应用创建一个专属的ClassLoader实例,每个应用的WEB-INF\lib下的资源,对于其他应用来说不可见,彼此隔离。

当然如果想只用一份库文件,可以把它放到目录 [tomcat-installation-directory]/common/lib下面。更多细节参考stackoverflow上的讨论.
要获取更多Jerry的原创技术文章,请关注公众号"汪子熙"或者扫描下面二维码:


ABAP function group和Tomcat library重复加载问题的更多相关文章
- Global variable in ABAP function group
Function group is loaded into runtime memory by the FIRST call of a function module inside this func ...
- ABAP术语-Function Group
Function Group 原文:http://www.cnblogs.com/qiangsheng/archive/2008/02/13/1067699.html Group of logical ...
- tomcat项目重复加载问题
主要是通过配置<Tomcat安装目录>/conf/server.xml文件 步骤: 1.打开server.xml,在</Host>的上一行添加内容格式如下 <Contex ...
- abap function module中的异常处理
1: 定义一个有异常抛出的function module. (zfm_moudle6), 该函数中有符合exceptions中的异常,将会自动将exceptions中的异常抛出. FUNCTION ...
- [SAP ABAP开发技术总结]Form(subroutine)、Function参数传值传址
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- abap 常用 function
ABAP常用函数总结 alv .smartform. excel .text.邮件 .远程访问,FTP服务器... **********常用功能function REUSE_ALV_GRID_DI ...
- SAP ABAP: Error Message "Statement already exist" when creating a function module.
https://archive.sap.com/discussions/thread/1089149 First check above link where my problem is so ...
- python bug the C library strftime function.
import timedef date2mktime(date, format_='%Y-%m-%d'): return int(time.mktime(time.strptime(date, for ...
- ABAP程序互调用:SUBMIT、CALL TRANSACTION、LEAVE TO TRANSACTION
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
随机推荐
- c# 库间关系
- BOM核心API
前言 我觉得前端中最难的不是业务逻辑,而是API太多,知道的太少. BOM是什么? BOM是Browser Object Model的缩写,即浏览器对象模型.浏览器对象模型提供了可以与浏览器窗口进行互 ...
- EOS 主节点同步
一.从github克隆主网代码仓库 git clone https://github.com/EOSIO/eos --recursive 二.编译与安装EOS环境 cd ~/eos ./eosio_b ...
- PAT甲级——1105 Spiral Matrix (螺旋矩阵)
此文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90484058 1105 Spiral Matrix (25 分) ...
- openstack安装newton版本创建虚拟机(五)
一.创建网络: 1.在控制节点上创建一个单一扁平网络(名字:flat),网络类型为flat,网络适共享的(share),网络提供者:physnet1,它是和eth0关联起来的 [root@linux- ...
- ssis-oracle 数据流任务
[OLE DB 源 1 [16]] 错误: SSIS 错误代码 DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.对连接管理器“F360DB”的 A ...
- 如何使用Spring Security手动验证用户
1.概述 在这篇快速文章中,我们将重点介绍如何以编程方式在Spring Security和Spring MVC中设置经过身份验证的用户. 2. Spring Security 简而言之,Spring ...
- 开园了,将以此记录个人web前端之路
记录.分享与学习 2015年5月中旬开始学习web前端到2015年6月底找到第一份相关工作,在学习与工作过程中通过网络获益良多,在此写下个人学习与工作过程中的总结与思考,记录个人成长,同时也希望能够帮 ...
- Aspose.word直接转pdf
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- java获取服务器一些信息的方法
request.getServletContext().getRealPath("/") 获取项目所在服务器的全路径,如:D:\Program Files\apache-tomca ...