0 Replies Latest reply on May 22, 2011 5:29 AM by John Doe

    Web-service freezes for all other calls if waitFor() is used in its method

    John Doe Newbie

      Hi guys. I have the following problem.

      I have this code inside my web-service's method. This method is not synchronized so it should run normally in parallel.


      StringBuffer cmd = new StringBuffer();
      cmd.append(muProps.m_qemuExec + " ");
      cmd.append("-snapshot" + " ");
      cmd.append("-vnc :0" + " ");
      cmd.append(scenario.m_image + " ");
      if(muProps.m_qemuBios != null) cmd.append("-bios " + muProps.m_qemuBios + " ");
      cmd.append("-hdb " + muProps.m_hddDisk + " ");
      Process qemu = Runtime.getRuntime().exec(cmd.toString());


      When I invoke the service it works as it should but freezes any other calls until previous waitFor() returns. I don't get it. The waitFor() function is supposed to make the current thread wait for the process to finish. The same happens if I start a new thread inside start this process and join() to the newly created thread with a process inside. Why a new call to the service, which is run in a separate thread starts to wait? It can't be that all invocations of the service are handled by the same thread. O_o I'm using Jboss 4.2.3. (its old but I need to use it)