758N/A/*
2362N/A * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
758N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
758N/A *
758N/A * This code is free software; you can redistribute it and/or modify it
758N/A * under the terms of the GNU General Public License version 2 only, as
758N/A * published by the Free Software Foundation.
758N/A *
758N/A * This code is distributed in the hope that it will be useful, but WITHOUT
758N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
758N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
758N/A * version 2 for more details (a copy is included in the LICENSE file that
758N/A * accompanied this code).
758N/A *
758N/A * You should have received a copy of the GNU General Public License version
758N/A * 2 along with this work; if not, write to the Free Software Foundation,
758N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
758N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
758N/A */
758N/A
758N/A/*
758N/A * @test
758N/A * @bug 6731826
758N/A * @summary There should be no RuntimeException.
758N/A * @run main TestRaceCond
758N/A */
758N/A
758N/Aimport javax.print.PrintService;
758N/Aimport javax.print.PrintServiceLookup;
758N/A
758N/A
758N/Apublic class TestRaceCond {
758N/A
758N/A public static void main(String argv[]) {
758N/A trial();
758N/A }
758N/A
758N/A static void trial() {
758N/A PrintService pserv1 = PrintServiceLookup.lookupDefaultPrintService();
758N/A PrintService[] pservs = PrintServiceLookup.lookupPrintServices(null, null);
758N/A PrintService pserv2 = PrintServiceLookup.lookupDefaultPrintService();
758N/A
1183N/A if ((pserv1 == null) || (pserv2==null)) {
1183N/A return;
1183N/A }
1183N/A
758N/A if (pserv1.hashCode() != pserv2.hashCode()) {
758N/A throw new RuntimeException("Different hashCodes for equal print "
758N/A + "services: " + pserv1.hashCode() + " "
758N/A + pserv2.hashCode());
758N/A }
758N/A }
758N/A}
758N/A