Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multi-threading in Spring

 
Khuma Chhakchhuak
Ranch Hand
Posts: 37
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone point me to multithreading/ multi-running of programs in java/Spring?

Thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you elaborate on what you are looking for? Spring doesn't prevent multi-threading. In web apps, it is common for many users to come into the application at once.
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring does provide the Task executor abstraction layer that allows you to run tasks in the background. You can configure them to run in threadpool. It also allows you to integrate with quartz which allows you to run your tasks periodically.

What you use, and how you use it depends on what you need to do. If you can elaborate, we can help you point in the right direction.
 
Khuma Chhakchhuak
Ranch Hand
Posts: 37
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Jayesh's answers partly suffice my needs.

My need being running multiple junit tests on different browser/devices so I want them to run at the same time.

It would be great if you all can elaborate more on how to go about this.

Thanks,

Lalkhum
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to provide more details. Is the application being tested built using Spring, or are you planning to leverage Spring to do your testing? Are you concerned how your Spring managed components will behave in a multi threaded test environment? Are you trying to test concurrency, or are your just trying to speed up your testing by parallelizing it?

If all you want to run your tests in parallel, you really don;t need Spring. You just divide up your tests into Suites, and make sure each suite can be tested independently. Then all you do is kick off multiple JUnit tests, one for each suite. Boom, parallelized!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic