3 Replies Latest reply on Mar 6, 2011 11:42 AM by salaboy21

    MinaTaskServer - why to start in a thread?

    odelyaholiday

      Hi!

       

      I saw in the documentation to start MinaTaskServer in a thread:

       

       

      server = new MinaTaskServer(taskService);
      
        Thread thread = new Thread(server);
        thread.start();
      
      

       

       

      Why not simply

       

       

      server = new MinaTaskServer(taskService);
      server.start();
      
      
        • 1. MinaTaskServer - why to start in a thread?
          salaboy21

          For testing purposes we start the MinaTaskServer in a different thread. If you want to create a different java app that starts the server directly (the simple option) you can do it. But if you want to start the MinaTaskServer inside the thred that start the process, if that thread dies the task server that should remain up will be stopped automatically.

           

          Your processes and the human task server have different lifecycles. It's up to you where and how to start them.

          Greetings.

          • 2. MinaTaskServer - why to start in a thread?
            odelyaholiday

            I start it in the like in Emergeny Demo - not inside the process - out of the process. - why there it was started in a different thread?

            • 3. MinaTaskServer - why to start in a thread?
              salaboy21

              It depends on your architecture. For simplicity you can start it in the same thread of your application. But if for some reason you have multiple applications using the same MinaTaskServer, you will need to start it separately or in another thread to be able to kill your application without killing the TaskServer.