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-4015 Module admingui/common-console replaced synchronized classes... #4096

Conversation

@svendiedrichsen
Copy link
Contributor

commented Jul 18, 2019

... with unsynchronized. extracted a method for code copy.

Apologies for the reformatting of one of the classes. The formatting was way off.

The replacement of the used Stack class in the inner class JsonChars is thread-safe because every call creates a new instance of the JsonChars class. Thus only a single thread will enter it.

@jbee
Copy link
Contributor

left a comment

Thanks @svendiedrichsen for the PR, only a few minor naming issues and suggestions.

private static String[] getSelectedCiphersList(String selectedCiphers){
List<String> selItems = new ArrayList<>();
if(selectedCiphers != null){
String[] sel = selectedCiphers.split(","); //NOI18N

This comment has been minimized.

Copy link
@jbee

jbee Jul 24, 2019

Contributor

We try to avoid short names or abbreviations for variable names. Maybe this can just be inlined in the for loop?

Vector ciphersVector = null;
Object ciphers = (Object)handlerCtx.getInputValue("ciphers");
List<String> ciphersList = null;
Object ciphers = handlerCtx.getInputValue("ciphers");
if (ciphers != null) {
if (ciphers instanceof String) {
String[] ary = getSelectedCiphersList((String) ciphers);

This comment has been minimized.

Copy link
@jbee

jbee Jul 24, 2019

Contributor

Inline to avoid short variable name?

return sb.toString();
}

private static List<String> getCiphers(String[] allCiphers){

This comment has been minimized.

Copy link
@jbee

jbee Jul 24, 2019

Contributor

Couldn't this method be replaced with Arrays.asList(allCiphers) or does the resulting List have to be modifiable?

}
return listCiphers;

This comment has been minimized.

Copy link
@jbee

jbee Jul 24, 2019

Contributor

If all methods using filterCiphers convert the returned list to an array directly maybe that common part could be done here as well?

return filterCiphers(ciphers, BIT_CIPHERS).toArray(new String[0]);
}

private static List<String> filterCiphers(List<String> ciphers, Set<String> filterList){

This comment has been minimized.

Copy link
@jbee

jbee Jul 24, 2019

Contributor

If filterCiphers would take a Predicate<String> evaluating if a cipher is accepted all the filters could be done with the same function (breakUpCiphers could also use filter) and in one pass (breakUpCiphers would not needed to be called multiple times) and the code would be more readable formulating the condition of the ciphers to keep as a lambda. WDYT?

@svendiedrichsen

This comment has been minimized.

Copy link
Contributor Author

commented Jul 25, 2019

@jbee I have made the requested changes.

@jbee
jbee approved these changes Jul 26, 2019

@Pandrex247 Pandrex247 changed the title Module admingui/common-console replaced synchronized classes... PAYARA-4015 Module admingui/common-console replaced synchronized classes... Jul 26, 2019

@Pandrex247

This comment has been minimized.

Copy link
Member

commented Jul 26, 2019

Jenkins test please

@jbee jbee merged commit 6e73c4c into payara:master Jul 26, 2019

59 checks passed

Payara Quick Build and Test Quick build and test passed!
Details
security/snyk - api/payara-api/pom.xml (payara-ci) No new issues
Details
security/snyk - api/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/admin/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/admingui/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/ant-tasks/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/appclient/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/batch/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/common/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/concurrent/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/connectors/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/core/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/deployment/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/distributions/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/ejb/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/extras/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/featuresets/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/flashlight/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/grizzly/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/ha/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/installer/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/javaee-api/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/jdbc/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/jms/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/load-balancer/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/orb/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/osgi-platforms/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/packager/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/payara-appserver-modules/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/persistence/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/registration/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/resources/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/security/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/tests/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/transaction/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/web/pom.xml (payara-ci) No new issues
Details
security/snyk - appserver/webservices/pom.xml (payara-ci) No new issues
Details
security/snyk - copyright/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/admin/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/cluster/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/common/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/core/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/deployment/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/diagnostics/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/distributions/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/flashlight/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/grizzly/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/hk2/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/osgi-platforms/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/packager/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/payara-modules/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/resources-l10n/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/resources/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/security/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/test-utils/pom.xml (payara-ci) No new issues
Details
security/snyk - nucleus/tests/pom.xml (payara-ci) No new issues
Details
security/snyk - pom.xml (payara-ci) No new issues
Details

@svendiedrichsen svendiedrichsen deleted the svendiedrichsen:admingui-console-common-synchronized-classes branch Jul 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.