title: Is there a way to communicate between two completely independent threads?
body: <p>I am trying to communicate between two threads which do not share any object in Java (I am building a Java agent). What I need is something like the following :</p>
  <pre><code>Thread agentattachThread = ...;
  otherThread.send(&quot;Hello&quot;);
  </code></pre>
  <p>And this would be handled like an interrupt in the Agent Attach thread, like so :</p>
  <pre><code>public void msgHandler(String msg) {
      ...
  }
  
  Thread.onMessageReceived(msgHandler);
  </code></pre>
  <p><strong>EDIT</strong> - Considering the answers to my original post, my question becomes : does the JVM offer by default a synchronized object to which all threads could get a reference to ?</p>