title: If I use Executors.newFixedThreadPool, can the executor call an active threads run method while the thread is waiting on a network operation?
body: <p>If I use Executors.newFixedThreadPool, can the executor call an active thread's Run method while the thread is waiting on a network operation?</p>
  <p><strong>Sample Code:</strong></p>
  <pre><code>public class RequestProcessor implements Runnable{
      private String parsedData,data1,data2;
      
      public void init(DataObject data){
          //add DataObject to queue
      }
      
      private void parseData(){ //THIS SHOULD BE CALLED ONLY BY RUN METHOD
          
          this.parsedData = //take DataObject from queue, parse it and assign 
      }
  
      @Override
      public void run() {
          this.parseData();
          processParsedData(); //TAKES AROUND 200 MILLISECONDS TO COMPLETE USUALLY - WAITS FOR a N/W OPERATION        
      }   
  }
  </code></pre>
  <pre><code>public class test {
  
      public static void main(String[] args) {
          int i;
          int thread_pool_size=10;
  
          RequestProcessor[] processorPool = new RequestProcessor[thread_pool_size];
          ExecutorService taskPool = Executors.newFixedThreadPool(thread_pool_size);
          
          for (i = 0; i &lt; thread_pool_size; i++) {
              processorPool[i] = new RequestProcessor();
          }
          
          i=0;
  
          while (true) {
              if (i &gt;= thread_pool_size) {
                  i = 0;
              }
  
              this.getData(data); //blocks until data is available
  
              processorPool[i].init(data);
              taskPool.execute((Runnable) processorPool[i]);
  
              i++;
          }
      }
  }
  </code></pre>
  <p>If the application gets lots of request, the while loop above gets very active. The executorservice is supposed to create new threads - that is call Run method of a thread from pool whenever a new request comes.</p>
  <p>Is it possible that while a thread is waiting on the n/w operation (200 ms), the executorservice can invoke the same thread's Run() method (mistaking it to be free or inactive) thus changing the data of the thread before it completes processing?</p>