Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » P2 checks repository once
P2 checks repository once [message #1744234] Fri, 23 September 2016 13:47 Go to next message
Jean-Pascal Laux is currently offline Jean-Pascal LauxFriend
Messages: 38
Registered: December 2011
Member
Hello,

I have an application that :
- Do check for updates at startup and display a message if updates are available
- Has a menu handler that check for updates and if updates are available, install them
- a timer job that check the repository every hour

1)
at startup, if updates are available, the message is displayed. When the user selects the menu handler, a check and an update hare done

2)
at startup, if no updates are available,no message is displayed. When the user selects the menu handler, a check should be done but that does not work. With a sniffer, I can see the first connection (startup) to the repository. After the fist check with no update, no new connection to the repository has been done.

I have checked many things but found nothing.

Jean-Pascal
Re: P2 checks repository once [message #1744267 is a reply to message #1744234] Fri, 23 September 2016 19:06 Go to previous messageGo to next message
Dmitry Perl is currently offline Dmitry PerlFriend
Messages: 13
Registered: September 2016
Junior Member
I can confirm the same behavior, once checked for updates, the attempts to check again never made.
It has some kind of caching there..
Restarting the application makes it detect changes again.
Re: P2 checks repository once [message #1744353 is a reply to message #1744267] Mon, 26 September 2016 09:24 Go to previous messageGo to next message
ALex W is currently offline ALex WFriend
Messages: 56
Registered: July 2012
Member
P2 uses some caching mechanisms.
I solved this in my app by forcing a refresh in the update sequence. Not sure it's the right way to do it, but it seems to do the job.

Simplified version of the code
URI[] lstMetadataRepositories = metadataManager.getKnownRepositories(IMetadataRepositoryManager.REPOSITORIES_ALL);		
URI[] lstArtifactRepositories = artifactManager.getKnownRepositories(IMetadataRepositoryManager.REPOSITORIES_ALL);

for (URI uri : lstMetadataRepositories) {						
	metadataManager.refreshRepository(uri, monitor);						
} 

for (URI uri : lstArtifactRepositories) {
	artifactManager.refreshRepository(uri, monitor);
}			
}


Complete code : https://github.com/cncgoko/Goko/blob/dev/Goko/src/goko/GokoUpdateCheckRunnable.java

[Updated on: Mon, 26 September 2016 09:26]

Report message to a moderator

Re: P2 checks repository once [message #1744361 is a reply to message #1744353] Mon, 26 September 2016 10:23 Go to previous messageGo to next message
Jean-Pascal Laux is currently offline Jean-Pascal LauxFriend
Messages: 38
Registered: December 2011
Member
Thanks Alex,

I have worked this week-end on this problem and I found the same solution.

In my code, I only refresh MetadataRepository. It seems to works.
My main problem was to find all the required plugins.

Does I add the refresh of ArtifactRepository ?

Jean-Pascal
Re: P2 checks repository once [message #1744378 is a reply to message #1744361] Mon, 26 September 2016 12:16 Go to previous messageGo to next message
ALex W is currently offline ALex WFriend
Messages: 56
Registered: July 2012
Member
I think it might be a good idea to refresh the ArtifactRepository as well. To make sure it works, you should try to run the application, update your source and publish your update site, and check for an update again.
The Metadata and Artifact repositories will be out of sync, and I guess the update will fail.

But it's really a test that should be done, since I'm not familiar enough with what's under the hood.

Please, let me know about the results.
Re: P2 checks repository once [message #1744384 is a reply to message #1744378] Mon, 26 September 2016 12:43 Go to previous message
Jean-Pascal Laux is currently offline Jean-Pascal LauxFriend
Messages: 38
Registered: December 2011
Member
I have done the test this morning, just refresh the metadata and I will be able to update my application and see the changes after the restart.

Previous Topic:Neon: leak in menus ActionContributionItem
Next Topic:Using EventBroker in composites
Goto Forum:
  


Current Time: Wed Sep 19 05:52:10 GMT 2018

Powered by FUDForum. Page generated in 0.01821 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top