gwt rpc - Waiting for more than one event (using GWT) -
i want fetch 2 xml documents server , resume processing when both have arrived. can fetch them in parallel, or have refrain issuing second request until first has completed?
make both requests, check when either 1 completes whether other done, , continue if is.
private string responseone; private string responsetwo; public startrequests() { makeasyncrequestone(new asynccallback<string>() { onsuccess(string response) { this.responseone = response; if (responsetwo != null) { proceed(); } } }); makeasyncrequesttwo(new asynccallback<string>() { onsuccess(string response) { this.responsetwo = response; if (responseone != null) { proceed(); } } }); }
as chris points out, may hit ceiling on maximum concurrent requests same hostname, if have lots of requests send @ once, keep queue of requests , call next 1 in proceed()
until queue exhausted.
but if plan on having lot of concurrent requests, need redesign service anyway, batch operations together.
Comments
Post a Comment