title: How to manage a separate thread/job within a eclipse job?
body: <p>Here is my question :-</p>
  
  <p>I am in the process of building a client-server application where I post the request to the server to generate 2 XML's for me (server fetches the information from the DB and generates XML based on this fetched info). Now, once the server has created these 2 XML's, server streams back these 2 files to the client so that client can save them on their machine. </p>
  
  <p>(POSTING + READING FROM THE STREAM) IS ONE JOB. Without 2nd operation i.e. reading from stream, Job is incomplete.</p>
  
  <p>I have created a Job in eclipse which posts the request to the server and takes the streamed files and save them on client machine. Posting the request to the server is a asynchronous call (it will return immediately). Once call is posted and returned immediately, I start polling on the Network Pipe for any data sever has sent(in this case it is the XML's data) &amp; write it into a file. </p>
  
  <p>As you can see here that reading the XML's from the stream and writing them into a file is part of the overall main Job but, still a separate job in itself (should be run in a separate thread). If User cancels the main job, reading from the network stream should also be cancelled. </p>
  
  <p>So, basically my requirement is a cacellable job which does this entire thing. Reading from the stream should be separate Thread/Job but should be inside the main Job. If user cancels the main Job, this innner Job (reading from the Job) should also get cancelled.</p>
  
  <p>Can you guys suggests a clean approach for doing this?</p>
  
  <p>-Ankit</p>