-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
CHE-5350: rework Maven plugin to avoid using Everrest Websocket #5527
Conversation
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/2984/ |
} | ||
|
||
@Inject | ||
private void configureSubscribeHandler(RequestHandlerConfigurator configurator) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we could have also a method to cancel subscription here, what do you think?
|
||
@Override | ||
public void onEvent(ArchetypeOutput event) { | ||
sendArchetypeNotification(event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that we don't need to have one more method here, we probably can just move
ArchetypeOutput archetypeOutput = DtoFactory.newDto(ArchetypeOutput.class);
archetypeOutput.setOutput(event.getOutput());
archetypeOutput.setState(event.getState());
endpointIds.forEach(it -> transmitter.newRequest()
.endpointId(it)
.methodName(MAVEN_ARCHETYPE_CHANEL_OUTPUT)
.paramsAsDto(archetypeOutput)
.sendAndSkipResult());
here or did I miss the reason that stands by this decision?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. I've removed the excessive method.
@@ -110,9 +110,16 @@ public void projectUpdated(Map<MavenProject, MavenProjectModifications> updated, | |||
List<MavenProject> needResolve = manager.findDependentProjects(allChangedProjects); | |||
needResolve.addAll(updated.keySet()); | |||
|
|||
List<String> updatedPaths = updated.keySet().stream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be compliant to streaming ideology I think it would be nice if we could have here something like this:
updated.keySet().stream()
.map(project -> project.getProject())
.map(project -> project.getFullPath())
.map(fullPath -> fullPath.toOSString())
.collect(Collectors.toList());
Don't you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but since when did "streaming ideology" become an argument for code quality? The version you propose has the advantage that it is easier to debug (because I can use line breakpoints), on the other hand, it will perform worse and is longer.
Btw: if we want to be more catholic than the pope, it would have to be .map(project::getProject)
, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Java Streams ideology becomes an argument since @svor uses Java Streams API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And btw talking about your btw: if we want to be more catholic than the pope, it would be .map(MavenProject::getProject)
:-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think popes are good people :)
String MAVEN_ARCHETYPE_CHANEL_NAME = "maven:archetype:output"; | ||
|
||
|
||
String MAVEN_CHANEL_SUBSCRIBE = "maven/subscribe"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be mavenOutput/subscribe ?
private final MavenOutputEvent mavenOutputEvent; | ||
private final String notificationType; | ||
|
||
public MavenMessage(MavenOutputEvent mavenOutputEvent, String notificationType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain why do we use String
for notification type because I'm not sure that I understood the idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unnecessary class which I've forgotten to delete. Thank you!
} | ||
|
||
private void handleOperations(final WsAgentStateController wsAgentStateController) { | ||
private void handleOperations() { | ||
eventBus.addHandler(WsAgentStateEvent.TYPE, new WsAgentStateHandler() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this handler
eventBus.addHandler(WorkspaceStoppedEvent.TYPE, event -> dependencyResolver.hide());
will be enough
@@ -91,32 +75,10 @@ public void removeResolvingProjectStateListener(ResolvingProjectStateListener li | |||
|
|||
@Override | |||
public void onWsAgentStarted(WsAgentStateEvent event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Done, thank you!
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/2992/ |
@svor : Please assign milestone when merging. |
What does this PR do?
Replaces using Everrest Websocket with JSON-RPC for Maven plugin
What issues does this PR fix or reference?
#5350
Changelog
Use JSON-RPC for broadcasting maven output events