I create an enhancement in this function module to print out current session id:
![](https://img.haomeiwen.com/i2085791/cd5d964f11a867b0.png)
As long as I do not close browser, no matter what operation I perform in WebUI, the session id remains the same, proving that all my operations are done in the same session:
![](https://img.haomeiwen.com/i2085791/938ed437d8daa328.png)
always this guid: 00015255FA163EE40FA21ED6A898F0FA67B01B77
![](https://img.haomeiwen.com/i2085791/d5a8b758c1d0a282.png)
Function group is loaded into runtime memory by the FIRST call of a function module inside this function group.
See example below:
I have a global variable defined in function group in X3C/504:
![](https://img.haomeiwen.com/i2085791/ccd3790d8ea6b662.png)
Before I call any of the function module in this function group, this global variable is not available - this make senses because the whole function group is NOT loaded into memory.
![](https://img.haomeiwen.com/i2085791/3b7ab93c30445e5f.png)
When the first function module is called, the function group is loaded into memory - global variable available:
![](https://img.haomeiwen.com/i2085791/61b6171ddec4c9a5.png)
I insert one entry to this table:
![](https://img.haomeiwen.com/i2085791/7053096918135512.png)
Now function1 execution is finished, when I entry function module2, this global variable is still available, because the lifetime scope of function group is application level - which means it will always stay in the memory until the application terminates.
![](https://img.haomeiwen.com/i2085791/36ac9b680588eace.png)
概括成一句话:function module里定义的局部变量,作用域是function module scope,即module执行完变量就失效,但定义在function group级别的全局变量,生命周期是整个应用,即应用不关闭之前,一直有效。
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
![](https://img.haomeiwen.com/i2085791/fc7ecd97deb67090.png)
网友评论