Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/awt/FullScreen/MultimonFullscreenTest/MultimonDeadlockTest.java
38828 views
/*1* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24@test25@bug 812911626@summary Deadlock with multimonitor fullscreen windows.27@run main/timeout=20 MultimonDeadlockTest28*/29import java.awt.*;30import java.awt.event.WindowAdapter;31import java.awt.event.WindowEvent;32import java.lang.reflect.InvocationTargetException;3334public class MultimonDeadlockTest {3536public static void main(String argv[]) {37final GraphicsDevice[] devices = GraphicsEnvironment38.getLocalGraphicsEnvironment()39.getScreenDevices();40if (devices.length < 2) {41System.out.println("It's a multiscreen test... skipping!");42return;43}4445Frame frames[] = new Frame[devices.length];46try {47EventQueue.invokeAndWait(() -> {48for (int i = 0; i < devices.length; i++) {49frames[i] = new Frame();50frames[i].setSize(100, 100);51frames[i].setBackground(Color.BLUE);52devices[i].setFullScreenWindow(frames[i]);53}54});55Thread.sleep(5000);56} catch (InterruptedException | InvocationTargetException ex) {57} finally {58for (int i = 0; i < devices.length; i++) {59devices[i].setFullScreenWindow(null);60frames[i].dispose();61}62}6364}65}666768