jdk/test/java/util/Locale/Bug6989440.java
author mfang
Wed, 17 Aug 2011 14:18:26 -0700
changeset 10294 8fcdae2a7ec7
parent 6835 859aa05172b6
child 10710 b18db2d63e3b
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6835
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
     1
/*
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
     4
 *
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
     7
 * published by the Free Software Foundation.
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
     8
 *
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    13
 * accompanied this code).
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    14
 *
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    18
 *
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    21
 * questions.
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    22
 */
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    23
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    24
/*
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    25
 * @test
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    26
 * @bug 6989440
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    27
 * @summary Verify ConcurrentModificationException is not thrown with multiple
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    28
 *     thread accesses.
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    29
 * @compile -XDignore.symbol.file=true Bug6989440.java
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    30
 * @run main Bug6989440
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    31
 */
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    32
import java.text.spi.DateFormatProvider;
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    33
import java.util.spi.LocaleNameProvider;
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    34
import java.util.spi.LocaleServiceProvider;
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    35
import java.util.spi.TimeZoneNameProvider;
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    36
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    37
import sun.util.LocaleServiceProviderPool;
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    38
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    39
public class Bug6989440 {
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    40
    public static void main(String[] args) {
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    41
        TestThread t1 = new TestThread(LocaleNameProvider.class);
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    42
        TestThread t2 = new TestThread(TimeZoneNameProvider.class);
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    43
        TestThread t3 = new TestThread(DateFormatProvider.class);
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    44
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    45
        t1.start();
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    46
        t2.start();
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    47
        t3.start();
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    48
    }
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    49
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    50
    static class TestThread extends Thread {
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    51
        private Class<? extends LocaleServiceProvider> cls;
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    52
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    53
        public TestThread(Class<? extends LocaleServiceProvider> providerClass) {
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    54
            cls = providerClass;
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    55
        }
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    56
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    57
        public void run() {
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    58
            LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(cls);
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    59
            pool.getAvailableLocales();
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    60
        }
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    61
    }
859aa05172b6 6989440: tomcat test from dacapo benchmark fails with ConcurrentModificationException
naoto
parents:
diff changeset
    62
}