-
-
Save kasramp/8e9f4399e032e77d1b0209042c63b4fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Mail { | |
public void doSendMails() { | |
//Creating ArrayList of the ThreadClass to hold reference of the threads | |
ArrayList<ThreadClass> mailManThreads = new ArrayList(); | |
for (int cnt = 0; cnt < mailManThreads.size(); cnt++) { | |
Vector oneMailQueue = new Vector(); | |
oneMailQueue = allMails.get(cnt); | |
ThreadClass oneMailManThread = new ThreadClass(); | |
oneMailManThread.start(oneMailQueue); | |
mailManThreads.add(oneDealerThread); | |
} | |
// Joins all threads to main thread to avoid main thread to continue without finishing the rest of threads | |
for (int cnt = 0; cnt < mailManThreads.size(); cnt++) { | |
mailManThreads.get(cnt).join(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment