You cannot enter code into the current thread if this thread is not actively interacting, such as Thread Dispatch Thread in AWT, which has a loop at the root that takes Runnables out of the queue and executes them.
Your design can inject data into code that was previously single-threaded and therefore had no concurrency problems.
Finally, the design spends a precious system resource (thread) to do nothing but wait for another thread to complete.
If you need this to fix any existing code from the outside, this may be the only option; if not, it would be better to provide an explicit mechanism for this that would be more efficient.
Marko topolnik
source share