MyBatis + TomEE + CDI + Mapper + Collection vs. List

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

MyBatis + TomEE + CDI + Mapper + Collection vs. List

Christian Kalkhoff-2

Hi,


today I encountered a very strange problem. I deploy an application from Netbeans to Apache TomEE 7.0.4. Netbeans always starts on Deployment the server including the previous deployments and then deploys the selected WAR again. That means, that at almost every start in develop, I get the app redeployed. I use MyBatis 3.4.5 with MyBatis CDI 1.0.0 (can't use a newer version because of the JNDI lookup of BeanManager in newer Versions).


With this in mind I had a hard time, to pin a bug with a Mapper. I created a Mapper-Method


Collection<Entity> foobar(Collection<String> filter, String filter2, String filter3);


It doesn't matter, if the method has a mapped statement (@Select) or not.


From then on, TomEE started to eat 100% of one CPU on the redeployment step. Deploying the first time worked perfectly well. As soon as I change the method to


Collection<Entity> foobar(List<String> filter, String filter2, String filter3);


everything goes smoothly.


Does anybody has any idea what's wrong here? Shall i file a bug or am I doing something wrong?


Best,

Christian


Christian Kalkhoff

Leiter Entwicklung


fundsaccess AG

Lyonel-Feininger-Str. 28 | D-80807 München

Tel.: 089-724497-0 | Fax: 089-724497-20

Email: [hidden email] | Homepage: www.fundsaccess.com

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: MyBatis + TomEE + CDI + Mapper + Collection vs. List

Guy Rouillier-2
I did a Google search on "java collection high cpu usage" and several hits pointed at garbage collection as the culprit.  That would fit your scenario, as GC would be done on the WAR being replaced.  Since you found that List doesn't appear to encounter this issue, can you simply continue to use List?

If you want to isolate the cause, you'll need to profile your app.  Here is a link that discusses measuring the impact of GC.


--
Guy Rouillier

------ Original Message ------
From: "Christian Kalkhoff" <[hidden email]>
To: "mybatis-user" <[hidden email]>
Sent: 1/11/2018 4:40:33 AM
Subject: MyBatis + TomEE + CDI + Mapper + Collection vs. List

Hi,


today I encountered a very strange problem. I deploy an application from Netbeans to Apache TomEE 7.0.4. Netbeans always starts on Deployment the server including the previous deployments and then deploys the selected WAR again. That means, that at almost every start in develop, I get the app redeployed. I use MyBatis 3.4.5 with MyBatis CDI 1.0.0 (can't use a newer version because of the JNDI lookup of BeanManager in newer Versions).


With this in mind I had a hard time, to pin a bug with a Mapper. I created a Mapper-Method


Collection<Entity> foobar(Collection<String> filter, String filter2, String filter3);


It doesn't matter, if the method has a mapped statement (@Select) or not.


From then on, TomEE started to eat 100% of one CPU on the redeployment step. Deploying the first time worked perfectly well. As soon as I change the method to


Collection<Entity> foobar(List<String> filter, String filter2, String filter3);


everything goes smoothly.


Does anybody has any idea what's wrong here? Shall i file a bug or am I doing something wrong?


Best,

Christian


Christian Kalkhoff

Leiter Entwicklung


fundsaccess AG

Lyonel-Feininger-Str. 28 | D-80807 München

Tel.: 089-724497-0 | Fax: 089-724497-20

Email: [hidden email] | Homepage: www.fundsaccess.com

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: MyBatis + TomEE + CDI + Mapper + Collection vs. List

Christian Kalkhoff-2

Yes, List is perfectly fine, yet I prefer Collection because i do not need a list there but a collection. :-)


I will have a look into this after our next release is out. Thanks for pointing out profiling. Log (even "FINEST") showed nothing, jvisualvm didn't show any GC activity either.


Best,

Christian


Am 11.01.2018 um 23:14 schrieb Guy Rouillier:
I did a Google search on "java collection high cpu usage" and several hits pointed at garbage collection as the culprit.  That would fit your scenario, as GC would be done on the WAR being replaced.  Since you found that List doesn't appear to encounter this issue, can you simply continue to use List?

If you want to isolate the cause, you'll need to profile your app.  Here is a link that discusses measuring the impact of GC.


--
Guy Rouillier

------ Original Message ------
From: "Christian Kalkhoff" <[hidden email]>
To: "mybatis-user" <[hidden email]>
Sent: 1/11/2018 4:40:33 AM
Subject: MyBatis + TomEE + CDI + Mapper + Collection vs. List

Hi,


today I encountered a very strange problem. I deploy an application from Netbeans to Apache TomEE 7.0.4. Netbeans always starts on Deployment the server including the previous deployments and then deploys the selected WAR again. That means, that at almost every start in develop, I get the app redeployed. I use MyBatis 3.4.5 with MyBatis CDI 1.0.0 (can't use a newer version because of the JNDI lookup of BeanManager in newer Versions).


With this in mind I had a hard time, to pin a bug with a Mapper. I created a Mapper-Method


Collection<Entity> foobar(Collection<String> filter, String filter2, String filter3);


It doesn't matter, if the method has a mapped statement (@Select) or not.


From then on, TomEE started to eat 100% of one CPU on the redeployment step. Deploying the first time worked perfectly well. As soon as I change the method to


Collection<Entity> foobar(List<String> filter, String filter2, String filter3);


everything goes smoothly.


Does anybody has any idea what's wrong here? Shall i file a bug or am I doing something wrong?


Best,

Christian


Christian Kalkhoff

Leiter Entwicklung


fundsaccess AG

Lyonel-Feininger-Str. 28 | D-80807 München

Tel.: 089-724497-0 | Fax: 089-724497-20

Email: [hidden email] | Homepage: www.fundsaccess.com

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

Christian Kalkhoff

Leiter Entwicklung


fundsaccess AG

Lyonel-Feininger-Str. 28 | D-80807 München

Tel.: 089-724497-0 | Fax: 089-724497-20

Email: [hidden email] | Homepage: www.fundsaccess.com

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.