Skip to content
Permalink
Browse files
8257534: misc tests failed with "NoClassDefFoundError: Could not init…
…ialize class java.util.concurrent.ThreadLocalRandom"

Reviewed-by: hseigel
  • Loading branch information
coleenp committed Oct 21, 2021
1 parent 819d2df commit cd07b3cab00e6656e73a29f82210e2dedf26df8c
Showing 1 changed file with 7 additions and 7 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -203,19 +203,19 @@ public static int eatMemory(ExecutionController stresser, GarbageProducer gp, lo
*
* It is Important that the impl is not inlined.
*/

public static int eatMemory(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) {
try {
// Using a methodhandle invoke of eatMemoryImpl to prevent inlining of it
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodType mt = MethodType.methodType(
private static MethodType mt = MethodType.methodType(
int.class,
ExecutionController.class,
GarbageProducer.class,
long.class,
long.class,
long.class,
OOM_TYPE.class);

public static int eatMemory(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) {
try {
// Using a methodhandle invoke of eatMemoryImpl to prevent inlining of it
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodHandle eat = lookup.findStatic(GarbageUtils.class, "eatMemoryImpl", mt);
return (int) eat.invoke(stresser, gp, initialFactor, minMemoryChunk, factor, type);
} catch (OutOfMemoryError e) {

1 comment on commit cd07b3c

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on cd07b3c Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.