mbien commented on code in PR #6596:
URL: https://github.com/apache/netbeans/pull/6596#discussion_r1375298606
##########
enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstance.java:
##########
@@ -201,20 +203,13 @@ public void clear() {
public String get(Object key) {
if (GlassfishModule.PASSWORD_ATTR.equals(key)) {
String value;
- synchronized(delegate) {
- value = delegate.get(key);
- }
- if (value == null) {
- value = getPasswordFromKeyring(
- delegate.get(GlassfishModule.DISPLAY_NAME_ATTR),
- delegate.get(GlassfishModule.USERNAME_ATTR));
- synchronized(delegate) {
- delegate.put((String)key, value);
- }
- }
+ value = delegate.computeIfAbsent((String)key, k ->
+ getPasswordFromKeyring(
+
delegate.get(GlassfishModule.DISPLAY_NAME_ATTR),
+ delegate.get(GlassfishModule.USERNAME_ATTR)));
return value;
} else {
- synchronized(delegate) {return delegate.get(key);}
+ return delegate.computeIfPresent((String)key, (k, v) -> v);
Review Comment:
please elaborate. Why is this here needed and in
`java.util.Properties().get()` not?
same question for
enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists