sdedic commented on code in PR #6514:
URL: https://github.com/apache/netbeans/pull/6514#discussion_r1347071211
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -559,29 +587,123 @@ void stopHardReferencingMavenPoject() {
return newproject;
}
+ /**
+ * Task that potential project reloads should wait on. If set, a {@link
fireProjectReload}(true) will be scheduled only after this blocker finishes.
+ */
+ private RequestProcessor.Task reloadBlocker;
-
+ /**
+ * Schedules project operation that delays potential reloads. If a reload
is posted, it will be performed only after
+ * this operation compeltes (successfully, or erroneously). Multiple
project operations can be scheduled, an eventual project reload
+ * should happen after all those operations complete. It is possible to
postpone project reload indefinitely, avoid unnecessary
+ * operation schedules.
+ *
+ * @param r operation to run
+ * @return controlling task.
+ */
+ public RequestProcessor.Task
scheduleProjectOperation(RequestProcessor.Task t) {
+ if (Boolean.getBoolean("test.reload.sync")) {
+ LOG.log(Level.FINE, "Running the blocking task synchronously
(test.reload.sync set)");
+ t.run();
+ return t;
+ } else {
+ synchronized (this) {
+ if (reloadBlocker == null) {
+ LOG.log(Level.FINER, "Blocking project reload on task
{0}", t);
+ reloadBlocker = t;
+ return t;
+ } else {
Review Comment:
Good point. I'm glad that this is not a public API ... will follow the
advice.
--
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