title: How are the publish() and process() methods on SwingWorker properly used?
body: <p>These two methods in  <a href="http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingWorker.html#process%28java.util.List%29" rel="noreferrer">SwingWorker</a> are confusing me at the moment, and it seems like it is very easy to use them incorrectly.</p>
  
  <p>The method <a href="http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingWorker.html#publish%28V...%29" rel="noreferrer">publish()</a> describes the following:</p>
  
  <blockquote>
    <p>Sends data chunks to the process(java.util.List) method. This method is to be used from inside the doInBackground method to deliver intermediate results for processing on the Event Dispatch Thread inside the process method.</p>
  </blockquote>
  
  <p>What this means to me is that while my worker thread is executing its <a href="http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingWorker.html#doInBackground%28%29" rel="noreferrer">doInBackground()</a> method, I am able to create "chunks" (should these be anything specific or is this just a way to refer to message objects?), then publish them for processing on my Swing GUI. </p>
  
  <p>That leads me to <a href="http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingWorker.html#process%28java.util.List%29" rel="noreferrer">process()</a>. The javadoc outlines the following:</p>
  
  <blockquote>
    <p>Receives data chunks from the publish method asynchronously on the Event Dispatch Thread. </p>
  </blockquote>
  
  <p>Having looked over the documentation for both methods, could anybody clarify what the mechanism is behind how this is taking place? I understand that it is an asynchronous process as per the documentation but since it is taking place on the EDT I am picturing there being some predictability to it.</p>
  
  <p>The <code>publish()</code> documentation states this:</p>
  
  <blockquote>
    <p>Because the process method is invoked asynchronously on the Event Dispatch Thread multiple invocations to the publish method might occur before the process method is executed. For performance purposes all these invocations are coalesced into one invocation with concatenated arguments. </p>
  </blockquote>
  
  <p>To summarize, my question is two fold:</p>
  
  <ul>
  <li>Who should be calling <code>process()</code>?</li>
  <li>What is the workflow for <code>process()</code> in the context of the SwingWorker and the EDT?</li>
  </ul>
  
  <p>Please let me know if any clarification is needed.</p>