2 Replies Latest reply on Jan 17, 2007 7:11 AM by jimknopf

    Thread.wait() in an Action

    jimknopf

      Hi all,

      i want to wait (this.wait()) in an action if there is no Data from my Database and notify this Thread after the database is filled with this data.

      Example:

      myAction{
       while( noDataInDB() ){
       this.wait();
       }
      }
      


      The Problem is, if i do this and call token.signal(); the whole Programme freez.

      signal Example:
      onButtonAction( ... ){
       System.err.println("befor Signal");
       getSelectedNode().getToken().signal();
       System.err.println("after Signal");
      }
      

      This print only "befor Signal" and after that it will freez.
      So the signal won't return and my UI-Applikation will stop :( .

      Could some one help me? Is there no way to make a wait in an action?


        • 1. Re: Thread.wait() in an Action
          kukeltje

          simply because it is not good practice to use thread.waits in jbpm actionhandlers. jBPM core is (afaik) single threaded (but performant) because there is the possibility for async actions..

          The reason a wait is not good in an action is that you e.g. introduce a waitstate in a state/node/task/...

          • 2. Re: Thread.wait() in an Action
            jimknopf

            I see.
            Thank u Kukeltje for ur fast answer, then i will try to solve my problem without using wait in a node.