GWT synchronization

Posted by hdantas on Stack Overflow See other posts from Stack Overflow or by hdantas
Published on 2010-04-15T10:57:28Z Indexed on 2010/04/15 11:03 UTC
Read the original article Hit count: 249

Filed under:
|

i'm doing a function in gwt
it sends an IQ stanza into a server and has to wait for the server answer
in the function i make the handler that waits for the answer from the server to that IQ stanza

so what i need is for the function to wait until i get the response from the server and after that do other stuff
i'm a beginner in gwt so any thoughts would be great
thanks

public void getServices()
    {
        IQ iq = new IQ(IQ.Type.get);
        iq.setAttribute("to", session.getDomainName());
        iq.addChild("query", "http://jabber.org/protocol/disco#items");

        session.addResponseHandler(iq, new ResponseHandler() 
        {
            public void onError(IQ iq, ErrorType errorType, ErrorCondition errorCondition, String text) 
            {
                <do stuff>
            }
            public void onResult(IQ iq) 
            {
                <do stuff>
            }
        });

        session.send(iq);

        <after receiving answer do stuff>   
    }

© Stack Overflow or respective owner

Related posts about gwt

Related posts about synchronization