Renana Heller wrote:
Hi,

How can I use the wait commend from the main method?

Renana

Hi Renana,
I think any thread can call wait(), including the thread that
is used to run the main() method.

My apologies if I have not understood your question.

  Simon

2009/8/9 Simon Nash <[email protected] <mailto:[email protected]>>

    Renana Heller wrote:

        hi,

        I have written a web service on tuscany and in the in the main
        function after SCADomain.newInstance it is waiting for "enter"
        input from user to exit
        (the same way it is done in the helloworld-ws-service example)

        main method in the sample:

          public static void main(String[] args) {

               SCADomain scaDomain =
        
SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite");

        *        try {*
        *            System.out.println("HelloWorld server started
        (press enter to shutdown)");*
        *            System.in.read();*
        *        } catch (IOException e) {*
        *            e.printStackTrace();*
        *        }*

               scaDomain.close();
               System.out.println("HelloWorld server stopped");
}
        The problem is that I can't run the problem in background in
        centOS (it has to be in the foreground for the System.in.read line).

        how can I run the webservice in the background?
        can I change the bolded part to wait for kill signal or
        something like that?

        Thanks.

-- Best,
        Renana.

     >
    Hi Renana,
    Running it in the background and using a kill signal to stop it
    should be fine.  Another option is to block a Java thread using wait()
    and have a "stop" operation on the Web service that can be called
    remotely and unblocks the waiting thread using a Java notify() call.

     Simon



--
Best,
Renana.

Reply via email to