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

PAYARA-2113 Made stop-domain a little more descriptive #2169

Conversation

michaelranaldo
Copy link
Contributor

Addresses #1841

@michaelranaldo
Copy link
Contributor Author

jenkins test please

@payara-ci
Copy link
Contributor

Quick build and test failed!

@michaelranaldo
Copy link
Contributor Author

jenkins test please

@michaelranaldo michaelranaldo added this to the Payara 4.181 milestone Nov 21, 2017
@payara-ci
Copy link
Contributor

Quick build and test passed!

Copy link
Contributor

@MattGill98 MattGill98 left a comment

Choose a reason for hiding this comment

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

As the list-domains command is a local command, you can run it (without the server running) by injecting a ServiceLocator and running serviceLocator.getService(ListDomainsCommand.class). This may help prevent the code duplication

@michaelranaldo michaelranaldo force-pushed the PAYARA-2113-Misleading-Message-For-Stop-Domain-If-Domain1-Not-Running branch 2 times, most recently from deece11 to 64f148e Compare November 21, 2017 14:53
@michaelranaldo michaelranaldo force-pushed the PAYARA-2113-Misleading-Message-For-Stop-Domain-If-Domain1-Not-Running branch from 64f148e to 5149308 Compare November 21, 2017 14:59
@michaelranaldo
Copy link
Contributor Author

jenkins test please

@payara-ci
Copy link
Contributor

Quick build and test passed!

throw new CommandException(ex.getLocalizedMessage());
}
return 0;
}

protected List<String> getRunningDomains() throws IOException, DomainException, CommandException {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably have this method return something more generic. Maybe a Map<String, String> mapping domains to their status or something similar. IMHO, the list-domains command shouldn't care about whether the domain is running or not. It's just me being pedantic, but I think it's better to invert the control on this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, makes sense. I shall bow to the pedantry in this case ;)

@michaelranaldo
Copy link
Contributor Author

jenkins test please

@payara-ci
Copy link
Contributor

Quick build and test passed!

Copy link
Contributor

@MattGill98 MattGill98 left a comment

Choose a reason for hiding this comment

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

Looking much nicer, just one or two semantic things I noticed with the most recent commit. Sorry for being persistent!

@@ -65,7 +65,7 @@
@PerLookup
public final class ListDomainsCommand extends LocalDomainCommand {

private static final LocalStringsImpl strings = new LocalStringsImpl(ListDomainsCommand.class);
private static final LocalStringsImpl Strings = new LocalStringsImpl(ListDomainsCommand.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should follow naming conventions of all capitals

}
} catch(Exception e) {
}
runningDomains =
(runningDomains.length() < 1)
? "\nNo domains are currently running."
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this change, but could it be implemented using a different message name in the LocalString.properties?

return 0;
}
// If it has gotten this far, the domain has failed to be stopped so the command has failed
return 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have you changed the return value for the command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this point the command has failed to find a valid running instance that matches the input, so it would make more sense to have the command report it as a failure.

@michaelranaldo
Copy link
Contributor Author

jenkins test please

@payara-ci
Copy link
Contributor

Quick build and test passed!

Copy link
Contributor

@lprimak lprimak left a comment

Choose a reason for hiding this comment

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

StopAllDomainsCommand.java line 111,
getDomains() copy should be removed and HK2 "magic" used instead

Otherwise, everything is looking good.

@Cousjava
Copy link
Contributor

Cousjava commented Dec 4, 2017

HK2 cannot be used as it may be run when there is no running server and so it does not have access to HK2.

@Pandrex247
Copy link
Member

Sounds like something that should be done in a separate PR

@Pandrex247 Pandrex247 merged commit f1d3bc5 into payara:master Dec 4, 2017
@MattGill98
Copy link
Contributor

I believe Jonathan's comment is pertinent to the PR. If HK2 can't be used, the current code won't work. I believe it works just fine, but it does need clarifying

@michaelranaldo
Copy link
Contributor Author

Interesting; definitely something worth investigating.

michaelranaldo pushed a commit to michaelranaldo/Payara that referenced this pull request Dec 4, 2017
…ding-Message-For-Stop-Domain-If-Domain1-Not-Running

PAYARA-2113 Made stop-domain a little more descriptive
smillidge pushed a commit that referenced this pull request Dec 9, 2017
…essage-For-Stop-Domain-If-Domain1-Not-Running (#2197)

PAYARA-2113 Made stop-domain a little more descriptive
lprimak pushed a commit to flowlogix/Payara that referenced this pull request Dec 15, 2017
…ding-Message-For-Stop-Domain-If-Domain1-Not-Running

PAYARA-2113 Made stop-domain a little more descriptive
lprimak pushed a commit to flowlogix/Payara that referenced this pull request Dec 15, 2017
…ain-If-Domain1-Not-Running-fs (pull request payara#167)

Merge pull request payara#2169 from michaelranaldo/PAYARA-2113-Misleading-Message-For-Stop-Domain-If-Domain1-Not-Running
lprimak pushed a commit to flowlogix/Payara that referenced this pull request Dec 15, 2017
…3-Misleading-Message-For-Stop-Domain-If-Domain1-Not-Running (pull request payara#167)"

This reverts pull request payara#167.

> PAYARA-2113 Made stop-domain a little more descriptive
lprimak pushed a commit to flowlogix/Payara that referenced this pull request Dec 15, 2017
Revert "Merge pull request payara#2169 from michaelranaldo/PAYARA-2113-Misleading-Message-For-Stop-Domain-If-Domain1-Not-Running (pull request payara#167)"
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.

7 participants