-
Notifications
You must be signed in to change notification settings - Fork 541
8248381: Create a daemon thread for MonocleTimer #256
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
Conversation
|
👋 Welcome back jgneff! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
It looks simple enough for a single reviewer. Since it is in Monocle, @johanvos will probably want to review it. |
|
Note that this is a regression error that is not present in JavaFX 14, so it would be good to fix it before JavaFX 15 is released. |
|
The regression was caused by the fix for JDK-8176499. See PR #117. |
| */ | ||
| final class MonocleTimer extends Timer { | ||
| private static final String THREAD_NAME = "Monocle Timer"; | ||
| private static final int POOL_SIZE = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a usecase where POOL_SIZE would be different from 1, so this could be skipped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
On second thought, this seems more like a workaround than a fix. Maybe it would be better to shutdown the timer to shut it down in an orderly fashion with the FX runtime is terminated. The |
|
/reviewers 2 |
|
@kevinrushforth |
This change just restores the thread daemon status to the way it was before in JavaFX 14, where if (timer == null) {
timer = new java.util.Timer(true);
}I tried setting |
|
OK, that seems fine then. I'll take a closer look and then finish my review. |
Actually, I think you may be right, though. Sorry for replying before looking into it. I now think the |
|
I think the code in the The Changing the Furthermore, whether it's a user or daemon thread, if the call to java.lang.InterruptedException:
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit
.lambda$runToolkit$12(QuantumToolkit.java:345)
at java.base/java.util.concurrent.Executors$RunnableAdapter
.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask
.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask
.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor
.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker
.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread
.run(Thread.java:832)So the call to Changing the java.util.concurrent.RejectedExecutionException:
Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@b1fe89
[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@1f85c96
[Wrapped task = com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$111/0x34563828@141859b]]
rejected from java.util.concurrent.ScheduledThreadPoolExecutor@55f462
[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
at java.base/java.util.concurrent.ThreadPoolExecutor$AbortPolicy
.rejectedExecution(ThreadPoolExecutor.java:2057)
at java.base/java.util.concurrent.ThreadPoolExecutor
.reject(ThreadPoolExecutor.java:827)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor
.delayedExecute(ScheduledThreadPoolExecutor.java:340)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor
.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:632)
at javafx.graphics/com.sun.glass.ui.monocle.MonocleTimer
._start(MonocleTimer.java:64)
at javafx.graphics/com.sun.glass.ui.Timer
.start(Timer.java:96)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit
.runToolkit(QuantumToolkit.java:384)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit
.lambda$startup$10(QuantumToolkit.java:280)
at javafx.graphics/com.sun.glass.ui.Application
.lambda$run$1(Application.java:153)
at javafx.graphics/com.sun.glass.ui.monocle.RunnableProcessor
.runLoop(RunnableProcessor.java:92)
at javafx.graphics/com.sun.glass.ui.monocle.RunnableProcessor
.run(RunnableProcessor.java:51)
at java.base/java.lang.Thread
.run(Thread.java:832)So if we want |
|
While the PR should indeed fix the original issue, I'm unsure about the behavior of multiple invocations of start/stop rather than using the (nop) pause method. However, it seems this behavior is similar on other platforms, so I assume it is by design. |
|
Given that this is a regression introduced in JavaFX 14, this fix seems like a good candidate for JavaFX 15, so I recommend to not merge the master branch. Go ahead and retarget your PR to the |
Actually, this is a regression introduced in JavaFX 15, so we have the chance to fix it before it's ever released.
Like this? I'll try that now. |
kevinrushforth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I verified that it does, in fact, fix the regression. As long as @johanvos also approves, then this is fine to go in for jfx15
I think we can address any issues relating to Timer start / stop / pause / resume in a subsequent release. There was some work done to support pause / resume as part of JDK-8189926, but it was only implemented on macOS (with follow-up issues filed to implement it on Windows and Linux). It didn't address any issues with start / stop. In particular we have never supported restarting the JavaFX runtime, so unless there are other uses of stop besides shutting down the runtime, I don't know that it matters if the timer can be restarted.
johanvos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with this, as it fixes regression.
A longer-term requirement could be the addition of platform-independent start/stop and pause/resume methods, similar to http://hg.openjdk.java.net/openjfx/jfx-dev/rt/rev/4e1e2f56c7af (https://bugs.openjdk.java.net/browse/JDK-8189926)
|
@jgneff This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type
Since the source branch of this PR was last updated there have been 26 commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge As you are not a known OpenJDK Author, an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth, @johanvos) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
/integrate |
|
/sponsor |
|
@kevinrushforth @jgneff The following commits have been pushed to jfx15 since your change was applied:
Your commit was automatically rebased without conflicts. Pushed as commit 5f60ea5. |

Fixes JDK-8248381.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jfx pull/256/head:pull/256$ git checkout pull/256