• Post Reply Bookmark Topic Watch Topic
  • New Topic

Struggling with Java Thread Pool

 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting confused with this thread pool concept. I do know where is the program starts and ends . will anyone help me with this issue? i am new to here






output



Please explain me how it works?
 
Henry Wong
author
Sheriff
Posts: 22532
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It would help if you explained what you are confused about... as "confused with this thread pool concept" doesn't really help much, and without context on what the confusion is, it is a pretty broad subject to explain.

Henry
 
Campbell Ritchie
Marshal
Posts: 52580
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
It would help if you explained what you are confused about... as "confused with this thread pool concept" doesn't really help much, and without context on what the confusion is, it is a pretty broad subject to explain.

Henry



Why we are using WorkerThread Constructor in program? in that we didn't pass any arguments right? then why we are creating "WorkerThread constructor with string s" ?




what is the use of this methods?
 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:And welcome to the Ranch

Thank you Can you please help me ?
 
Henry Wong
author
Sheriff
Posts: 22532
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vinoth vino wrote:

Why we are using WorkerThread Constructor in program? in that we didn't pass any arguments right? then why we are creating "WorkerThread constructor with string s" ?




what is the use of this methods?


Why don't you tell us? The threadpool is only concerned that the task is a runnable object (in your case). It doesn't really care what your run() method does, nor how the runnable object is instantiated.

So, you can instantiate it any way you want (it is your constructor) and use it any way you want (it is your run() method). Why don't you tell us, what you are trying to do?

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!