cancel
Showing results for 
Search instead for 
Did you mean: 

global variable

Former Member
0 Kudos

Hi,

I'm in PI 7.0 PS12 and I have a strange behaviour with a global variable.

I defined a Global Variable like "String gv_datetime = new String();", and then, thanks to a UdF, I fill this variable with a random value concatenated to the numbers of milliseconds since 1970.01.01... So normally for two runs of the same mapping at the same time, this value should be different !

well.. in fact it's not the case ! it seems that the value is used across multi-run of this mapping.

For instance, image that we have two source files in the source directory. When PI picks up these files, the same mapping is run twice (one per file) ... like a parallel treatment. And so normally, I should have two different values for this global variable... but it's not the case, a same value is used for the two mapping runs. Same milliseconds and same random value... that's why I think that there is something bad with the Global variation definition and/or its behavior.

does someone know this behaviour ?

Maybe my global variation is badly defined, do I have to do something in "Initialization Section" or "Clean-up Section" ?

I know how to solved this issue in PI 7.1.... but we are only in PI 7.0 - SP12.

Many thanks for your feedback... coz it's difficult to reproduce the case...

Mickael

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

Mapping runs as EJB.

EJBs have following issues: When an EJB is not used, it remains active. The next session reuses that EJB so the server needs not load it again.

In this case it can happen that the static variables are filled.

You can do a UDF which you apply on root -> root.

As the root node is the first which is created, this UDF can serve for initializing.

Former Member
0 Kudos

Hi Stefan,

thanks for the EJB explanation, yes that could be the reason.

about the UdF on root, yes, I agree with you. I beleived that I did that.... but not this time ! (stupid I am), and as inside my UdF I have something like

if (gv_datetime.equals("")) { then fill it } else { use the current value}

yes that could explained the behaviour.

Sorry I did not yet a research... but do you know where I can have a confirmation of this EJB behavior.

coz as this problem appear in production (not everytime)... I have to be sure about the correction... even if I think that root without my "if" control is THE solution.

Many thanks to open me my eyes.

Regards

Mickael

stefan_grube
Active Contributor
0 Kudos

> Sorry I did not yet a research... but do you know where I can have a confirmation of this EJB behavior.

I learned this in EJB training which was years ago. Maybe you find something in java.sun.com

I had encountered issues with synchronous Java proxy outbound beans. Whenever I called the beans from an external program the second time, sender and receiver busniness system was changed, therefor routing in PI failed. I discussed the issue with the developer of Java proxies and the solution was: I had to initialise a class, which i did not use in my program to make it work.

So from my experience I can assure you, that an EJB which is used the second time from a different call will have still the parameters from first run.

Former Member
0 Kudos

Thanks Stefan

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

just a quick suggestion, reset the global variable after every use.

e.g.

a = time;

xyz = a;

a = null;

I hope that should resovle.