#(Java) Learning how to manage multiple Threads
1 messages · Page 1 of 1 (latest)
executorservice ftw
anyone who have some books or links
import java.util.ArrayList;
import java.util.List;
public class ThreadManager {
private List<Thread> threads;
public ThreadManager() {
threads = new ArrayList<>();
}
public void startThread(Runnable runnable) {
Thread thread = new Thread(runnable);
threads.add(thread);
thread.start();
}
public void stopThreads() {
for (Thread thread : threads) {
thread.interrupt();
}
for (Thread thread : threads) {
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
(Java) Learning how to manage multiple Threads
but is it thread safe? 
oh feck i forgot to ask chat gpt that
i just learned that you get run code inside or outside using thread

what
Java Multithreading - This Java tutorial covers basic to advanced concepts related to Java Programming including What is Java, Java Environment Setup, Java Objects and Classes, Datatypes, Variable Types, Modifiers, Operators, Loops, Decision Making Statements, Date, Time, Regular Expressions, Files, I/O, Exceptions, Inheritance, Overriding, Poly...
ty for commenting and sharing
probably want to learn about:
threads and how they work internally
threadpools
synchronisation
synchronised collections
and theres so much more :)
just start looking at some basic things
