neilcsmith-net commented on code in PR #7668:
URL: https://github.com/apache/netbeans/pull/7668#discussion_r1715100864
##########
platform/o.n.bootstrap/src/org/netbeans/NbClipboard.java:
##########
@@ -435,20 +436,22 @@ public void run() {
// that is used because accessing the clipboard can block
// indefinitely. Running the access loop here is deemed similar
// in nature.
- final int MAX_TRIES = 50;
+ final int MAX_TRIES = 10;
final long start = System.currentTimeMillis();
+ int delay = 20;
for (int i = 0; i < MAX_TRIES; i++) {
try {
transferable = systemClipboard.getContents(this);
break;
} catch (IllegalStateException ex) {
// Throw exception if retries failed
- if (i == (MAX_TRIES - 1) ||
(System.currentTimeMillis() - start) > 980L) {
+ if (i == (MAX_TRIES - 1) ||
(System.currentTimeMillis() + delay - start) > 1000L) {
throw ex;
} else {
- log.log(Level.INFO, "systemClipboard#getContents
threw IllegalStateException (try: {0})", i + 1); // NOI18N
+ log.log(Level.INFO, "systemClipboard#getContents
ISE, attempt {0}", i + 1); // NOI18N
}
- Thread.sleep(20); // Give system time to settle
+ Thread.sleep(delay); // Give system time to settle
+ delay *= 2;
Review Comment:
Am I missing something here?! If the delay is multiplied by two each
iteration, how do we get anywhere near `MAX_TRIES` before timing out?
--
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