title: How application server handle multiple requests to save data into table
body: <p>I have created a web application in jsf and it has a button. 
  If the button is clicked then it will go to the server side and execute the below function to save the data in a table and I am using mybatis for this.</p>
  
  <pre><code>public void save(A a)
  {
  
  SqlSession session = null; 
  
  try{ 
  
  session = SqlConnection.getInstance().openSession(); 
  
  TestMapper testmap= session.getMapper(TestMapper.class); 
  
  testmap.insert(a); 
  
  session .commit(); 
  
  }
  catch(Exception e){
  }
  finally{
  session.close();
  }
  
  }
  </code></pre>
  
  <p>Now i have deployed this application in an application server JBoss(wildfly). </p>
  
  <p>As per my understanding, when multiple users try to access the application 
  by hitting the URL, the application server creates thread for each of the user request. 
  For example if 4 clients make request then 4 threads will be generated that is t1,t2,t3 and t4.</p>
  
  <p>If all the 4 users hit the save button at the same time, how save method will be executed, like if t1 access the method and execute insert statement
  to insert data into table, then t2,t3 and t4 or simultaneously all the 4 threads will execute the insert method and insert data?</p>