Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/security/auth/login/Configuration/Synchronize.java
51695 views
1
/*
2
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 4464458
27
* @summary ConfigFile.refresh should be synchronized
28
*
29
* @run main/othervm -Djava.security.auth.login.config=file:${test.src}/Synchronize.config Synchronize
30
*/
31
32
import javax.security.auth.login.*;
33
34
public class Synchronize extends Thread {
35
36
private static final int loop = 500;
37
38
public void run() {
39
try {
40
System.out.println("attempting to access configuration...");
41
Configuration config = Configuration.getConfiguration();
42
AppConfigurationEntry[] entries = config.getAppConfigurationEntry
43
("Synchronize");
44
config.refresh();
45
System.out.println("done accessing configuration...");
46
} catch (Exception e) {
47
e.printStackTrace();
48
throw new RuntimeException();
49
}
50
}
51
52
public static void main(String[] args) {
53
try {
54
Synchronize[] threads = new Synchronize[loop];
55
for (int i = 0; i < loop; i++) {
56
threads[i] = new Synchronize();
57
}
58
59
for (int i = 0; i < loop; i++) {
60
threads[i].start();
61
}
62
63
for (int i = 0; i < loop; i++) {
64
threads[i].join();
65
}
66
System.out.println("test passed");
67
} catch (Exception e) {
68
e.printStackTrace();
69
System.out.println("test failed");
70
throw new SecurityException(e.toString());
71
}
72
}
73
}
74
75