Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jdk17u
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
openjdk
jdk17u
Commits
2b128f12
Commit
2b128f12
authored
Jun 27, 2024
by
Andrew Lu
Browse files
Options
Downloads
Patches
Plain Diff
8222884: ConcurrentClassDescLookup.java times out intermittently
Backport-of: bd046d9b9e79e4eea89c72af358961ef6e98e660
parent
dae2d6c7
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/jdk/java/io/Serializable/concurrentClassDescLookup/ConcurrentClassDescLookup.java
+29
-29
29 additions, 29 deletions
.../concurrentClassDescLookup/ConcurrentClassDescLookup.java
with
29 additions
and
29 deletions
test/jdk/java/io/Serializable/concurrentClassDescLookup/ConcurrentClassDescLookup.java
+
29
−
29
View file @
2b128f12
/*
/*
* Copyright (c) 2001, 20
19
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 20
24
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
*/
*/
import
java.io.*
;
import
java.io.*
;
import
java.util.concurrent.CountDownLatch
;
class
Good
implements
Serializable
{
class
Good
implements
Serializable
{
private
static
final
long
serialVersionUID
=
6319710844400051132L
;
private
static
final
long
serialVersionUID
=
6319710844400051132L
;
...
@@ -51,19 +52,20 @@ class Bad implements Serializable {
...
@@ -51,19 +52,20 @@ class Bad implements Serializable {
class
SuccessfulLookup
extends
Thread
{
class
SuccessfulLookup
extends
Thread
{
Class
<?>
cl
;
Class
<?>
cl
;
long
suid
;
long
suid
;
Object
barrier
;
final
CountDownLatch
lookupLatch
;
boolean
ok
;
boolean
ok
;
SuccessfulLookup
(
Class
<?>
cl
,
long
suid
,
Object
barrier
)
{
SuccessfulLookup
(
Class
<?>
cl
,
long
suid
,
CountDownLatch
lookupLatch
)
{
this
.
cl
=
cl
;
this
.
cl
=
cl
;
this
.
suid
=
suid
;
this
.
suid
=
suid
;
this
.
barrier
=
barrier
;
this
.
lookupLatch
=
lookupLatch
;
}
}
public
void
run
()
{
public
void
run
()
{
synchronized
(
barrier
)
{
lookupLatch
.
countDown
();
// let others know we are ready
try
{
barrier
.
wait
();
}
catch
(
InterruptedException
ex
)
{}
try
{
}
lookupLatch
.
await
();
// await for others
}
catch
(
InterruptedException
ex
)
{}
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
if
(
ObjectStreamClass
.
lookup
(
cl
).
getSerialVersionUID
()
!=
suid
)
{
if
(
ObjectStreamClass
.
lookup
(
cl
).
getSerialVersionUID
()
!=
suid
)
{
return
;
return
;
...
@@ -75,18 +77,19 @@ class SuccessfulLookup extends Thread {
...
@@ -75,18 +77,19 @@ class SuccessfulLookup extends Thread {
class
FailingLookup
extends
Thread
{
class
FailingLookup
extends
Thread
{
Class
<?>
cl
;
Class
<?>
cl
;
final
Object
barrier
;
final
CountDownLatch
lookupLatch
;
boolean
ok
;
boolean
ok
;
FailingLookup
(
Class
<?>
cl
,
Object
barrier
)
{
FailingLookup
(
Class
<?>
cl
,
CountDownLatch
lookupLatch
)
{
this
.
cl
=
cl
;
this
.
cl
=
cl
;
this
.
barrier
=
barrier
;
this
.
lookupLatch
=
lookupLatch
;
}
}
public
void
run
()
{
public
void
run
()
{
synchronized
(
barrier
)
{
lookupLatch
.
countDown
();
// let others know we are ready
try
{
barrier
.
wait
();
}
catch
(
InterruptedException
ex
)
{}
try
{
}
lookupLatch
.
await
();
// await for others
}
catch
(
InterruptedException
ex
)
{}
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
try
{
try
{
ObjectStreamClass
.
lookup
(
cl
);
ObjectStreamClass
.
lookup
(
cl
);
...
@@ -102,39 +105,36 @@ public class ConcurrentClassDescLookup {
...
@@ -102,39 +105,36 @@ public class ConcurrentClassDescLookup {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ClassLoader
loader
=
ConcurrentClassDescLookup
.
class
.
getClassLoader
();
ClassLoader
loader
=
ConcurrentClassDescLookup
.
class
.
getClassLoader
();
Class
<?>
cl
=
Class
.
forName
(
"Good"
,
false
,
loader
);
Class
<?>
cl
=
Class
.
forName
(
"Good"
,
false
,
loader
);
Object
barrier
=
new
Object
();
int
numSuccessfulLookups
=
50
;
SuccessfulLookup
[]
slookups
=
new
SuccessfulLookup
[
50
];
CountDownLatch
sLookupLatch
=
new
CountDownLatch
(
numSuccessfulLookups
);
SuccessfulLookup
[]
slookups
=
new
SuccessfulLookup
[
numSuccessfulLookups
];
for
(
int
i
=
0
;
i
<
slookups
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
slookups
.
length
;
i
++)
{
slookups
[
i
]
=
slookups
[
i
]
=
new
SuccessfulLookup
(
cl
,
6319710844400051132L
,
sLookupLatch
);
new
SuccessfulLookup
(
cl
,
6319710844400051132L
,
barrier
);
slookups
[
i
].
start
();
slookups
[
i
].
start
();
}
}
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
"awaiting completion of "
+
slookups
.
length
+
" SuccessfulLookup"
);
synchronized
(
barrier
)
{
barrier
.
notifyAll
();
}
for
(
int
i
=
0
;
i
<
slookups
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
slookups
.
length
;
i
++)
{
slookups
[
i
].
join
();
slookups
[
i
].
join
();
if
(!
slookups
[
i
].
ok
)
{
if
(!
slookups
[
i
].
ok
)
{
throw
new
Error
();
throw
new
Error
();
}
}
}
}
System
.
out
.
println
(
"all "
+
slookups
.
length
+
" SuccessfulLookup completed"
);
cl
=
Class
.
forName
(
"Bad"
,
false
,
loader
);
cl
=
Class
.
forName
(
"Bad"
,
false
,
loader
);
FailingLookup
[]
flookups
=
new
FailingLookup
[
50
];
int
numFailingLookups
=
50
;
CountDownLatch
fLookupLatch
=
new
CountDownLatch
(
numFailingLookups
);
FailingLookup
[]
flookups
=
new
FailingLookup
[
numFailingLookups
];
for
(
int
i
=
0
;
i
<
flookups
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
flookups
.
length
;
i
++)
{
flookups
[
i
]
=
new
FailingLookup
(
cl
,
barrier
);
flookups
[
i
]
=
new
FailingLookup
(
cl
,
fLookupLatch
);
flookups
[
i
].
start
();
flookups
[
i
].
start
();
}
}
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
"awaiting completion of "
+
flookups
.
length
+
" FailingLookup"
);
synchronized
(
barrier
)
{
for
(
int
i
=
0
;
i
<
flookups
.
length
;
i
++)
{
barrier
.
notifyAll
();
}
for
(
int
i
=
0
;
i
<
slookups
.
length
;
i
++)
{
flookups
[
i
].
join
();
flookups
[
i
].
join
();
if
(!
flookups
[
i
].
ok
)
{
if
(!
flookups
[
i
].
ok
)
{
throw
new
Error
();
throw
new
Error
();
}
}
}
}
System
.
out
.
println
(
"all "
+
flookups
.
length
+
" FailingLookup completed"
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment