You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to schedule the start method before the end method by using Single Thread Executor.
Let's say we scheduled two threads first thread is calling start method and second thread is calling end method.
Now, OS may schedule the end thread to execute first (which we don't want).
Now, with the above approach the problem is still there because, we can't ensure which thread hits execute method
of Executor Service first.
My approach of solving the problem is,
In the end method start a new Thread which polls the ConcurrentMap if the process Id is added via the start method.
youtube-projects/java-projects/src/main/java/logger/LogClient.java
Lines 63 to 64 in 7e2275a
youtube-projects/java-projects/src/main/java/logger/LogClient.java
Lines 54 to 55 in 7e2275a
We are trying to schedule the start method before the end method by using Single Thread Executor.
Let's say we scheduled two threads first thread is calling start method and second thread is calling end method.
Now, OS may schedule the end thread to execute first (which we don't want).
Now, with the above approach the problem is still there because, we can't ensure which thread hits execute method
of Executor Service first.
My approach of solving the problem is,
In the end method start a new Thread which polls the ConcurrentMap if the process Id is added via the start method.
The text was updated successfully, but these errors were encountered: