RFR: 8313697: [XWayland][Screencast] consequent getPixelColor calls are slow [v3]

Laurent Bourgès lbourges at openjdk.org
Tue Aug 15 10:02:08 UTC 2023


On Mon, 14 Aug 2023 22:46:16 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> src/java.desktop/unix/classes/sun/awt/screencast/ScreencastHelper.java line 127:
>> 
>>> 125:             @Override
>>> 126:             public void run() {
>>> 127:                 closeSession();
>> 
>> What happen if the "closeSession" is executed why the new Robot#getRGBPixels is called? In the robot code we call timerCloseSessionRestart to restart/cancel timer, but I think it could be possible that closeSession() is already executed and may close session right before it will be used by the robot but after we "open" it. 
>> 
>> Or this case is not possible?
>
> Both `ScreencastHelper#getRGBPixels`(`Robot#getRGBPixels` calls it internally) and `ScreencastHelper#closeSession` are synchronized. 
> So `ScreencastHelper#closeSession` will wait until the execution of `ScreencastHelper#getRGBPixels` is finished and vice versa.
> 
> Many hours of testing with random delays close to DELAY_BEFORE_SESSION_CLOSE worked fine.

Java part looks good to me. Why 2s and not more or less ? 
The delay could be set through a system property ?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15250#discussion_r1294410046


More information about the client-libs-dev mailing list