Synchronized methods are not working as expected when running using suitethreadpoolsize

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

Synchronized methods are not working as expected when running using suitethreadpoolsize

saravanan thanikasalam


Running multiple suites as "suite-xml" files in parallel using "suitethreadpoolsize"  option of surefire plugin

Got a condition where need to execute a  particular method using a single thread at a time.
So tried using synchronized method, to restrict the number to threads to access the method as one. But the synchronized method is of no effect, the method is accessed in parallel irrespective of using synchronized keyword.

Please let me know if there are any other options to restrict the method to use single thread or is there any better way to use synchronized keyword.

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

Re: Synchronized methods are not working as expected when running using suitethreadpoolsize

Todd Bradley-2
On Mon, Jan 22, 2018 at 10:13 AM, saravanan thanikasalam <[hidden email]> wrote:
So tried using synchronized method, to restrict the number to threads to access the method as one. But the synchronized method is of no effect, the method is accessed in parallel irrespective of using synchronized keyword.

That seems impossible. That's basic Java functionality, nothing to do with TestNG. I would look into that and make sure you're using the synchronized keyword correctly.


Todd.


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