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

Provide option to run LT plugin stop comand when the stop action is used #412

Merged
merged 5 commits into from
Jul 6, 2023

Conversation

scottkurz
Copy link
Member

@scottkurz scottkurz commented Jul 3, 2023

Fixes #248

  • Adds warning message with prompt to call plugin stop.
  • Uses a Job to do stop
  • Job can be cancelled. We'll issue a Process.destroy() but we don't try to go any further (too much trouble, not worth it)
  • Adds Maven/Gradle automated test

NOTE: I use the phrase "the Liberty Maven or Gradle stop command" in user-facing error messages. I know we've also tried the phrase "Liberty plugin stop" to abstract across each of Maven/Gradle. I wonder if it's obvious that that means "Liberty Maven or Gradle plugin" (which we could also write), however.

@scottkurz scottkurz force-pushed the issueLPStopCmd branch 2 times, most recently from aa3f057 to b95ef07 Compare July 5, 2023 15:01
Copy link
Member

@mezarin mezarin left a comment

Choose a reason for hiding this comment

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

LGTM, just had a couple of comments.

/*
* Check for bad exit value
*/
Object rc = event.getJob().getProperty(STOP_JOB_COMPLETION_EXIT_CODE);
Copy link
Member

Choose a reason for hiding this comment

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

The rc value can be null if the job is cancelled before it completes. Line 867 will exit the job and one would get a message with a null exit value: "Stop failed with exitValue = null ...". Also the message can be a bit misleading in this case (stop may have worked because of timing), so perhaps along with checking the the rc value for null, etc, perhaps no message would be better unless we detected that the cancel failed?

/**
* Cancel running jobs and avoid error message, e.g. on closing Eclipse IDE
*/
public void cancelRunningJobs() {
Copy link
Member

Choose a reason for hiding this comment

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

This method seems like it should be removing the jobs from the map and cancelling them.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, thought this map was going away anyway but I'll add a clear() at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, the JobChangeAdapter.done() will remove the job so it's not really needed.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, that sounds good.

Signed-off-by: Scott Kurz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants