eclipse - How to wait the p2 profile gets completed -


we using p2 update our rcp application, , worked far quite until today realized in case p2 iprofile emty (not null empty) , of course return emty result queries.

this happend when launching application only, meaning if request same profile later in time, complete profile.

the javadoc of iprofile mention fact profile snapshot of particular state. seems querying profileregistry , profile not yet complete. not find way on javadoc wait profile filled properly.

i grateful me solve problem nicely, because using sleep (which works) not acceptable solution. thanks.

here ugly solution implemented, testing time stam sure profile has been loaded

// there seems bug because if agent created profile empty. // loop until proper profile {     try {        thread.sleep(50);     } catch (interruptedexception e) {        interrupted = true;     }     if (agent != null) {        agent.stop();     }     agent = agentprovider.createagent(getp2agenturi());     iprofileregistry profregistry = (iprofileregistry) agent.getservice(iprofileregistry.service_name);     profile = profregistry.getprofile(getp2profileid()); } while (profile != null && profile.gettimestamp() == 0 && !interrupted && !progress.iscanceled()); 

the profile use self use method profileid because have junit tests base on external p2 profile.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -