Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JBIDE-20366: Check for missing m2e connectors after import #38

Closed
wants to merge 1 commit into from
Closed

JBIDE-20366: Check for missing m2e connectors after import #38

wants to merge 1 commit into from

Conversation

mickaelistria
Copy link
Contributor

No description provided.

@alexeykazakov
Copy link

needs @fbricon rivew

import org.eclipse.ui.wizards.datatransfer.ProjectConfigurator;

public class MavenProjectConfigurator implements ProjectConfigurator {

private static class CumulativeMappingDiscoveryJob extends MappingDiscoveryJob {
private static CumulativeMappingDiscoveryJob INSTANCE;
private Set<IProject> toProcess;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memory leak: toProcess keeps project references in job instance, after import, and keeps on piling new projects

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing it. I'll fix it as part of next iteration.
More than the small memory leak (which is actually size of a pointer * max number of projects in workspace), I believe this can have an important impact on the performance of the connector discovery operations.

@mickaelistria
Copy link
Contributor Author

Updated patch to clear the toProcess set.

return Status.OK_STATUS;
}

public void addProjects(Collection<IProject> projects) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is a public method, I'd recommend to check for null input

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done.

@mickaelistria
Copy link
Contributor Author

The latest version of this patch adds a null check.

@mickaelistria
Copy link
Contributor Author

@fbricon : could you please merge it if it's fine for you (both branch and master) ?

@mickaelistria
Copy link
Contributor Author

@fbricon Any objection to merge it in both branch and master (I can do it by myself, but would like someone to +1 )

}

public void addProjects(Collection<IProject> projects) {
if (projects != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method should check the job status before adding new projects. If the instance is already running, gets past openProposalWizard(), projects will be added to the set that'll be cleared right after.
So basically you should throw an IllegalStateException if the job is running while you're adding projects

@mickaelistria
Copy link
Contributor Author

Updated change as advised.

@mickaelistria
Copy link
Contributor Author

@fbricon can you please review and merge before code freeze?

if (this.started) {
throw new IllegalStateException("Cannot add projects when processing is started");
}
if (projects != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

projects can't be null, it's instantiated in the constructor of this singleton

@fbricon
Copy link
Member

fbricon commented Nov 20, 2015

Ok to apply once toProcess.clear() is moved to a try{} finally{} block

@mickaelistria
Copy link
Contributor Author

Done and merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants