You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "pepness (via GitHub)" <gi...@apache.org> on 2023/10/06 19:30:23 UTC
[PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
pepness opened a new pull request, #6542:
URL: https://github.com/apache/netbeans/pull/6542
Library Notes:
- Add support for Java 21
- Refactoring and maintenance of code base
- Fix processing of the Multi-Release libraries in EAR application
- Bug fixes and updates of various components
NetBeans GlassFish module notes:
- Add support for GlassFish version 7.0.7, 7.0.8, and 7.0.9
- Add new ConfigBuilderProvider for GlassFish 7.0.9 and newer versions that support Java 21
- Add support for JavaSE constants up to version 22
- Bump `javac.source` and `javac.target` to version 11 for all 4 GlassFish modules `common`, `eecommon`, `javaee`, and `tooling`
- Refactor creation of `ServerWizardIterator` with one private array
- Remove some unnecessary imports
- Make final some fields
- Refactor long switch statement to one `if if-else else` statement
- Use ConcurrentMap for `builders`, set initial capacity, use atomic operations `computeIfPresent` and `computeIfAbsent`, and remove some synchronized blocks because the ConcurrentHashMap implementation already use synchronized at a field level
NetBeans Testing:
- Verify successful execution of libraries and licenses Ant test
- Verify successful execution of Verify Sigtests
- Verify successful execution of `ant -Dcluster.config=release commit-validation`
- Verify successful execution of unit tests for modules `glassfish.common`, `glassfish.javaee`, `glassfish.tooling`, and `glassfish.eecommon`
- Started NetBeans and ensure the log didn't have any ERROR or new WARNINGS
- Successfully register GlassFish 7.0.7, 7.0.8, and 7.0.9, create a web app and verify that it works.
[Release Notes](https://github.com/eclipse-ee4j/glassfish/releases/tag/7.0.9)
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "pepness (via GitHub)" <gi...@apache.org>.
pepness commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1353708741
##########
enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java:
##########
@@ -193,16 +209,13 @@ public static ConfigBuilder getBuilder(final GlassFishServer server) {
"GlassFish server entity shall not be null");
}
ConfigBuilder builder;
- synchronized (builders) {
- builder = builders.get(server);
- if (builder != null) {
- return builder;
- }
- String serverHome = server.getServerHome();
- builder = new ConfigBuilder(config, serverHome, serverHome, serverHome);
- builders.put(server, builder);
+ builder = builders.computeIfPresent(server, (key, value) -> value);
+ if (builder != null) {
+ return builder;
}
- return builder;
+ String serverHome = server.getServerHome();
+ return builders.computeIfAbsent(server, key ->
+ new ConfigBuilder(config, serverHome, serverHome, serverHome));
Review Comment:
The `computeIfPresent` implementation from `ConcurrentHashMap` synchronize at a node level (`Node<K,V>`). I use `computeIfPresent` to circumvent the need of synchronize the entire map. It does work like a `get()` (`get()` does not synchronize) and it does not have the `@Deprecated` as of now.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "pepness (via GitHub)" <gi...@apache.org>.
pepness commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1357696057
##########
enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java:
##########
@@ -193,16 +209,13 @@ public static ConfigBuilder getBuilder(final GlassFishServer server) {
"GlassFish server entity shall not be null");
}
ConfigBuilder builder;
- synchronized (builders) {
- builder = builders.get(server);
- if (builder != null) {
- return builder;
- }
- String serverHome = server.getServerHome();
- builder = new ConfigBuilder(config, serverHome, serverHome, serverHome);
- builders.put(server, builder);
+ builder = builders.computeIfPresent(server, (key, value) -> value);
+ if (builder != null) {
+ return builder;
}
- return builder;
+ String serverHome = server.getServerHome();
+ return builders.computeIfAbsent(server, key ->
+ new ConfigBuilder(config, serverHome, serverHome, serverHome));
Review Comment:
You are right!, everything will be done in one atomic and concurrent statement, great work @mbien.
I will re-test everything and push the update.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1357765685
##########
enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java:
##########
@@ -193,16 +209,13 @@ public static ConfigBuilder getBuilder(final GlassFishServer server) {
"GlassFish server entity shall not be null");
}
ConfigBuilder builder;
- synchronized (builders) {
- builder = builders.get(server);
- if (builder != null) {
- return builder;
- }
- String serverHome = server.getServerHome();
- builder = new ConfigBuilder(config, serverHome, serverHome, serverHome);
- builders.put(server, builder);
+ builder = builders.computeIfPresent(server, (key, value) -> value);
+ if (builder != null) {
+ return builder;
}
- return builder;
+ String serverHome = server.getServerHome();
+ return builders.computeIfAbsent(server, key ->
+ new ConfigBuilder(config, serverHome, serverHome, serverHome));
Review Comment:
figured out how to create a jackpot rule for this, nb can refactor it now with one click:
https://github.com/mbien/jackpot-inspections/commit/8eadafc5c45c3a1898ebadaa16455c5019537c9c
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "pepness (via GitHub)" <gi...@apache.org>.
pepness merged PR #6542:
URL: https://github.com/apache/netbeans/pull/6542
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#issuecomment-1762886557
@pepness can you squash so that it is ready for merge?
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1351280366
##########
enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java:
##########
@@ -193,16 +209,13 @@ public static ConfigBuilder getBuilder(final GlassFishServer server) {
"GlassFish server entity shall not be null");
}
ConfigBuilder builder;
- synchronized (builders) {
- builder = builders.get(server);
- if (builder != null) {
- return builder;
- }
- String serverHome = server.getServerHome();
- builder = new ConfigBuilder(config, serverHome, serverHome, serverHome);
- builders.put(server, builder);
+ builder = builders.computeIfPresent(server, (key, value) -> value);
+ if (builder != null) {
+ return builder;
}
- return builder;
+ String serverHome = server.getServerHome();
+ return builders.computeIfAbsent(server, key ->
+ new ConfigBuilder(config, serverHome, serverHome, serverHome));
Review Comment:
something is wrong here. Please take another look.
`computeIfPresent(server, (key, value) -> value)` is essentially `get()` and I believe this was meant to be removed?
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1359373175
##########
enterprise/glassfish.common/nbproject/org-netbeans-modules-glassfish-common.sig:
##########
@@ -620,6 +635,8 @@ CLSS public abstract interface java.util.EventListener
CLSS public abstract interface java.util.Map<%0 extends java.lang.Object, %1 extends java.lang.Object>
innr public abstract interface static Entry
+meth public !varargs static <%0 extends java.lang.Object, %1 extends java.lang.Object> java.util.Map<{%%0},{%%1}> ofEntries(java.util.Map$Entry<? extends {%%0},? extends {%%1}>[])
+ anno 0 java.lang.SafeVarargs()
meth public abstract boolean containsKey(java.lang.Object)
Review Comment:
the sig generator is probably not filtering out JDK classes, which means if the public API uses JDK classes in declarations, the sig changes when JDK level changes.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1353972471
##########
enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java:
##########
@@ -193,16 +209,13 @@ public static ConfigBuilder getBuilder(final GlassFishServer server) {
"GlassFish server entity shall not be null");
}
ConfigBuilder builder;
- synchronized (builders) {
- builder = builders.get(server);
- if (builder != null) {
- return builder;
- }
- String serverHome = server.getServerHome();
- builder = new ConfigBuilder(config, serverHome, serverHome, serverHome);
- builders.put(server, builder);
+ builder = builders.computeIfPresent(server, (key, value) -> value);
+ if (builder != null) {
+ return builder;
}
- return builder;
+ String serverHome = server.getServerHome();
+ return builders.computeIfAbsent(server, key ->
+ new ConfigBuilder(config, serverHome, serverHome, serverHome));
Review Comment:
the old version:
```java
synchronized {
// checked if `server` was in the map, if it was, it returned it's value.
// if it wasn't in the map, it created a new ConfigBuilder, registered it in the map and returned it
}
```
this is the same as:
```java
String serverHome = server.getServerHome();
return builders.computeIfAbsent(server, key ->
new ConfigBuilder(config, serverHome, serverHome, serverHome));
```
(If i am missing something, please explain)
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1353972471
##########
enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java:
##########
@@ -193,16 +209,13 @@ public static ConfigBuilder getBuilder(final GlassFishServer server) {
"GlassFish server entity shall not be null");
}
ConfigBuilder builder;
- synchronized (builders) {
- builder = builders.get(server);
- if (builder != null) {
- return builder;
- }
- String serverHome = server.getServerHome();
- builder = new ConfigBuilder(config, serverHome, serverHome, serverHome);
- builders.put(server, builder);
+ builder = builders.computeIfPresent(server, (key, value) -> value);
+ if (builder != null) {
+ return builder;
}
- return builder;
+ String serverHome = server.getServerHome();
+ return builders.computeIfAbsent(server, key ->
+ new ConfigBuilder(config, serverHome, serverHome, serverHome));
Review Comment:
the old version:
```java
synchronized {
// checked if `server` was in the map, if it was, it returned it.
// if it wasn't in the map, it created a new ConfigBuilder, registered it in the map and returned it
}
```
this is the same as:
```java
String serverHome = server.getServerHome();
return builders.computeIfAbsent(server, key ->
new ConfigBuilder(config, serverHome, serverHome, serverHome));
```
(If i am missing something, please explain)
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "pepness (via GitHub)" <gi...@apache.org>.
pepness commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1355932410
##########
enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java:
##########
@@ -193,16 +209,13 @@ public static ConfigBuilder getBuilder(final GlassFishServer server) {
"GlassFish server entity shall not be null");
}
ConfigBuilder builder;
- synchronized (builders) {
- builder = builders.get(server);
- if (builder != null) {
- return builder;
- }
- String serverHome = server.getServerHome();
- builder = new ConfigBuilder(config, serverHome, serverHome, serverHome);
- builders.put(server, builder);
+ builder = builders.computeIfPresent(server, (key, value) -> value);
+ if (builder != null) {
+ return builder;
}
- return builder;
+ String serverHome = server.getServerHome();
+ return builders.computeIfAbsent(server, key ->
+ new ConfigBuilder(config, serverHome, serverHome, serverHome));
Review Comment:
Both versions will compute the same results. But the old version does not allow concurrent modifications to the map, the new version will allow concurrent modifications to the map.
Old version:
```java
synchronized (entireMap) {
// checked if `server` key was in the map, if it was, it returned it's value.
// if it wasn't in the map, it created a new ConfigBuilder, registered it in the map and returned it
}
```
New version restrict modifications at a node level e.g. `Node[K1,V1]` until it finish, but allows concurrent modifications to every other node e.g. `Node[K2,V2]`:
```java
synchronized (Node[K1,V1]) {
// Thread 1
// No one can modify this node until I finish
}
synchronized (Node[K2,V2]) {
// Thread 2
// Modifying this node at the same time that Thread 1 is working on Node[K1,V1]
}
```
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1350233495
##########
enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/ServerDetails.java:
##########
@@ -480,6 +459,9 @@ public static int getVersionFromInstallDirectory(File glassfishDir) {
case GF_7_0_4: return GLASSFISH_SERVER_7_0_4.getVersion();
case GF_7_0_5: return GLASSFISH_SERVER_7_0_5.getVersion();
case GF_7_0_6: return GLASSFISH_SERVER_7_0_6.getVersion();
+ case GF_7_0_7: return GLASSFISH_SERVER_7_0_7.getVersion();
+ case GF_7_0_8: return GLASSFISH_SERVER_7_0_8.getVersion();
+ case GF_7_0_9: return GLASSFISH_SERVER_7_0_9.getVersion();
Review Comment:
can this switch be eliminated by putting `GLASSFISH_SERVER_` enums into `GF_7_` enums during construction?
##########
enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/ServerDetails.java:
##########
@@ -367,7 +350,56 @@ public enum ServerDetails {
"https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/7.0.6/glassfish-7.0.6.zip", // NOI18N
"https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/7.0.6/glassfish-7.0.6.zip", // NOI18N
"http://www.eclipse.org/legal/epl-2.0" //NOI18N
+ ),
+
+ /**
+ * details for an instance of GlassFish Server 7.0.7
+ */
+ GLASSFISH_SERVER_7_0_7(NbBundle.getMessage(ServerDetails.class, "STR_707_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:gfv700ee10", // NOI18N
+ 707,
+ "https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/7.0.7/glassfish-7.0.7.zip", // NOI18N
+ "https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/7.0.7/glassfish-7.0.7.zip", // NOI18N
+ "http://www.eclipse.org/legal/epl-2.0" //NOI18N
+ ),
+
+ /**
+ * details for an instance of GlassFish Server 7.0.8
+ */
+ GLASSFISH_SERVER_7_0_8(NbBundle.getMessage(ServerDetails.class, "STR_708_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:gfv700ee10", // NOI18N
+ 708,
+ "https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/7.0.8/glassfish-7.0.8.zip", // NOI18N
+ "https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/7.0.8/glassfish-7.0.8.zip", // NOI18N
+ "http://www.eclipse.org/legal/epl-2.0" //NOI18N
+ ),
+
+ /**
+ * details for an instance of GlassFish Server 7.0.9
+ */
+ GLASSFISH_SERVER_7_0_9(NbBundle.getMessage(ServerDetails.class, "STR_709_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:gfv700ee10", // NOI18N
+ 709,
+ "https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/7.0.9/glassfish-7.0.9.zip", // NOI18N
+ "https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/7.0.9/glassfish-7.0.9.zip", // NOI18N
+ "http://www.eclipse.org/legal/epl-2.0" //NOI18N
);
+
+ /**
+ * Array with all GlassFish {@code ServerDetails} versions.
+ */
+ private static final ServerDetails[] serverDetails = new ServerDetails[] {
+ GLASSFISH_SERVER_3, GLASSFISH_SERVER_3_0_1, GLASSFISH_SERVER_3_1,
+ GLASSFISH_SERVER_3_1_1, GLASSFISH_SERVER_3_1_2, GLASSFISH_SERVER_3_1_2_2,
+ GLASSFISH_SERVER_4_0, GLASSFISH_SERVER_4_0_1, GLASSFISH_SERVER_4_1,
+ GLASSFISH_SERVER_4_1_1, GLASSFISH_SERVER_4_1_2, GLASSFISH_SERVER_5_0,
+ GLASSFISH_SERVER_5_0_1, GLASSFISH_SERVER_5_1_0, GLASSFISH_SERVER_6,
+ GLASSFISH_SERVER_6_1_0, GLASSFISH_SERVER_6_2_0, GLASSFISH_SERVER_6_2_1,
+ GLASSFISH_SERVER_6_2_2, GLASSFISH_SERVER_6_2_3, GLASSFISH_SERVER_6_2_4,
+ GLASSFISH_SERVER_6_2_5, GLASSFISH_SERVER_7_0_0, GLASSFISH_SERVER_7_0_1,
+ GLASSFISH_SERVER_7_0_2, GLASSFISH_SERVER_7_0_3, GLASSFISH_SERVER_7_0_4,
+ GLASSFISH_SERVER_7_0_5, GLASSFISH_SERVER_7_0_6, GLASSFISH_SERVER_7_0_7,
+ GLASSFISH_SERVER_7_0_8, GLASSFISH_SERVER_7_0_9 };
Review Comment:
this is now the same as `ServerDetails.values()`, no?
##########
enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/JavaSEPlatform.java:
##########
@@ -202,6 +212,8 @@ public String toString() {
case v18: return V18_STR;
case v19: return V19_STR;
case v20: return V20_STR;
+ case v21: return V21_STR;
+ case v22: return V22_STR;
Review Comment:
the whole `toString` body can be replaced with:
```
String n = name();
return n.startsWith("v1_") ? "1."+n.substring(3) : n.substring(1);
```
after that the package private Strings can be removed too
alternative:
add string to enum, e.g v22("22") but its a bit redundant.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1353972471
##########
enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java:
##########
@@ -193,16 +209,13 @@ public static ConfigBuilder getBuilder(final GlassFishServer server) {
"GlassFish server entity shall not be null");
}
ConfigBuilder builder;
- synchronized (builders) {
- builder = builders.get(server);
- if (builder != null) {
- return builder;
- }
- String serverHome = server.getServerHome();
- builder = new ConfigBuilder(config, serverHome, serverHome, serverHome);
- builders.put(server, builder);
+ builder = builders.computeIfPresent(server, (key, value) -> value);
+ if (builder != null) {
+ return builder;
}
- return builder;
+ String serverHome = server.getServerHome();
+ return builders.computeIfAbsent(server, key ->
+ new ConfigBuilder(config, serverHome, serverHome, serverHome));
Review Comment:
the old version:
```java
synchronized {
// checked if `server` key was in the map, if it was, it returned it's value.
// if it wasn't in the map, it created a new ConfigBuilder, registered it in the map and returned it
}
```
this is the same as:
```java
String serverHome = server.getServerHome();
return builders.computeIfAbsent(server, key ->
new ConfigBuilder(config, serverHome, serverHome, serverHome));
```
(If i am missing something, please explain)
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1350233495
##########
enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/ServerDetails.java:
##########
@@ -480,6 +459,9 @@ public static int getVersionFromInstallDirectory(File glassfishDir) {
case GF_7_0_4: return GLASSFISH_SERVER_7_0_4.getVersion();
case GF_7_0_5: return GLASSFISH_SERVER_7_0_5.getVersion();
case GF_7_0_6: return GLASSFISH_SERVER_7_0_6.getVersion();
+ case GF_7_0_7: return GLASSFISH_SERVER_7_0_7.getVersion();
+ case GF_7_0_8: return GLASSFISH_SERVER_7_0_8.getVersion();
+ case GF_7_0_9: return GLASSFISH_SERVER_7_0_9.getVersion();
Review Comment:
can this switch be eliminated by putting `GLASSFISH_SERVER_` enums into `GF_` enums during construction?
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1356042841
##########
enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java:
##########
@@ -193,16 +209,13 @@ public static ConfigBuilder getBuilder(final GlassFishServer server) {
"GlassFish server entity shall not be null");
}
ConfigBuilder builder;
- synchronized (builders) {
- builder = builders.get(server);
- if (builder != null) {
- return builder;
- }
- String serverHome = server.getServerHome();
- builder = new ConfigBuilder(config, serverHome, serverHome, serverHome);
- builders.put(server, builder);
+ builder = builders.computeIfPresent(server, (key, value) -> value);
+ if (builder != null) {
+ return builder;
}
- return builder;
+ String serverHome = server.getServerHome();
+ return builders.computeIfAbsent(server, key ->
+ new ConfigBuilder(config, serverHome, serverHome, serverHome));
Review Comment:
the the task of the method, which is to return the value of the map or compute it if it isn't there yet, can be written with one operation on the map:
```java
public static ConfigBuilder getBuilder(final GlassFishServer server) {
if (server == null) {
throw new ServerConfigException(
"GlassFish server entity shall not be null");
}
String serverHome = server.getServerHome();
return builders.computeIfAbsent(server, key ->
new ConfigBuilder(config, serverHome, serverHome, serverHome));
}
```
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Add support for GlassFish 7.0.6, 7.0.7, and 7.0.9 [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #6542:
URL: https://github.com/apache/netbeans/pull/6542#discussion_r1359102609
##########
enterprise/glassfish.common/nbproject/org-netbeans-modules-glassfish-common.sig:
##########
@@ -620,6 +635,8 @@ CLSS public abstract interface java.util.EventListener
CLSS public abstract interface java.util.Map<%0 extends java.lang.Object, %1 extends java.lang.Object>
innr public abstract interface static Entry
+meth public !varargs static <%0 extends java.lang.Object, %1 extends java.lang.Object> java.util.Map<{%%0},{%%1}> ofEntries(java.util.Map$Entry<? extends {%%0},? extends {%%1}>[])
+ anno 0 java.lang.SafeVarargs()
meth public abstract boolean containsKey(java.lang.Object)
Review Comment:
@ebarboni @matthiasblaesing why are there JDK classes in the sig file of this module?
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists