Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is thread wrapper class in java

I am new to java. My question is what is thread wrapper class for a class. For example I have written an class 'someClass'. Now if I need to break my program in multiple threads, then how to write thread wrapper class for this class. (I know what threads are and how to break a program in multiple threads and run, but I am not understanding meaning of thread wrapper class.) thankx

like image 564
Harshveer Singh Avatar asked Jun 05 '26 04:06

Harshveer Singh


1 Answers

There is class Thread, which represents a single thread. There an interface Runnable, which can be accepted by a Thread instance for executions.

IMO a good advice is to consult Java Concurrency in Practice book -- the definitive guide to Java concurrency. Really helpful.

like image 137
01es Avatar answered Jun 07 '26 17:06

01es