CGCompleteDisplayConfiguration hangs in macos12 Beta

I work in JDK maintaining Java Client library..Apple has contributed macosx port to JDK 6 which we stil currently use in Java and we are running JDK18.

We have one test where we create a Child Java process where we try to set fullscreen window and then find a display mode which is different from current display and then again revert back to normal windowed mode. The test in question is https://github.com/openjdk/jdk/blob/master/test/jdk/java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java

This test has worked till now till Macos BigSur but on recent Macos 12 Beta os version, it is hanging in CGCompleteDisplayConfiguration() https://github.com/openjdk/jdk/blob/master/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m#L297

I see that we have displayId:724860118, w:1280, h:720, bpp:32, refrate 60 when we call nativeSetDisplayMode() to fullscreen and

displayId:724860118, w:1920, h:1080, bpp:32, refrate 60 when we go back to normal mode.

We see that in BigSur we get the same values but CGCompleteDisplayConfiguration() executes ok.

We see that if we change performOnMainThreadWaiting to NO in https://github.com/openjdk/jdk/blob/master/src/java.desktop/macosx/native/libosxapp/ThreadUtilities.m#L102

where ThreadUtilities performOnMainThreadWaiting method is defined in [1] it works ok in macos12 but was told it's not the correct way to fix this in https://github.com/openjdk/jdk/pull/5647/ and report this to Apple

Can you please suggest how to fix this for osx 12? the device used is Macmini8_1 running Intel_R__Core_TM__i7-8700B_CPU___3.20GHz

[1] https://github.com/openjdk/jdk/blob/master/src/java.desktop/macosx/native/libosxapp/ThreadUtilities.m#L102