Skip to content

Commit 03d54e6

Browse files
committedJun 28, 2021
Merge
2 parents e9b2c05 + 5624069 commit 03d54e6

File tree

20 files changed

+209
-61
lines changed

20 files changed

+209
-61
lines changed
 

‎src/hotspot/share/logging/logAsyncWriter.cpp

+32-16
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class AsyncLogWriter::AsyncLogLocker : public StackObj {
4141
};
4242

4343
void AsyncLogWriter::enqueue_locked(const AsyncLogMessage& msg) {
44-
if (_buffer.size() >= _buffer_max_size) {
44+
if (_buffer.size() >= _buffer_max_size) {
4545
bool p_created;
4646
uint32_t* counter = _stats.add_if_absent(msg.output(), 0, &p_created);
4747
*counter = *counter + 1;
@@ -50,13 +50,12 @@ void AsyncLogWriter::enqueue_locked(const AsyncLogMessage& msg) {
5050
return;
5151
}
5252

53-
assert(_buffer.size() < _buffer_max_size, "_buffer is over-sized.");
5453
_buffer.push_back(msg);
5554
_sem.signal();
5655
}
5756

5857
void AsyncLogWriter::enqueue(LogFileOutput& output, const LogDecorations& decorations, const char* msg) {
59-
AsyncLogMessage m(output, decorations, os::strdup(msg));
58+
AsyncLogMessage m(&output, decorations, os::strdup(msg));
6059

6160
{ // critical area
6261
AsyncLogLocker locker;
@@ -70,13 +69,13 @@ void AsyncLogWriter::enqueue(LogFileOutput& output, LogMessageBuffer::Iterator m
7069
AsyncLogLocker locker;
7170

7271
for (; !msg_iterator.is_at_end(); msg_iterator++) {
73-
AsyncLogMessage m(output, msg_iterator.decorations(), os::strdup(msg_iterator.message()));
72+
AsyncLogMessage m(&output, msg_iterator.decorations(), os::strdup(msg_iterator.message()));
7473
enqueue_locked(m);
7574
}
7675
}
7776

7877
AsyncLogWriter::AsyncLogWriter()
79-
: _lock(1), _sem(0), _io_sem(1),
78+
: _lock(1), _sem(0), _flush_sem(0),
8079
_initialized(false),
8180
_stats(17 /*table_size*/) {
8281
if (os::create_thread(this, os::asynclog_thread)) {
@@ -98,10 +97,10 @@ class AsyncLogMapIterator {
9897
using none = LogTagSetMapping<LogTag::__NO_TAG>;
9998

10099
if (*counter > 0) {
101-
LogDecorations decorations(LogLevel::Warning, none::tagset(), output->decorators());
100+
LogDecorations decorations(LogLevel::Warning, none::tagset(), LogDecorators::All);
102101
stringStream ss;
103102
ss.print(UINT32_FORMAT_W(6) " messages dropped due to async logging", *counter);
104-
AsyncLogMessage msg(*output, decorations, ss.as_string(true /*c_heap*/));
103+
AsyncLogMessage msg(output, decorations, ss.as_string(true /*c_heap*/));
105104
_logs.push_back(msg);
106105
*counter = 0;
107106
}
@@ -118,7 +117,6 @@ void AsyncLogWriter::write() {
118117
// The operation 'pop_all()' is done in O(1). All I/O jobs are then performed without
119118
// lock protection. This guarantees I/O jobs don't block logsites.
120119
AsyncLogBuffer logs;
121-
bool own_io = false;
122120

123121
{ // critical region
124122
AsyncLogLocker locker;
@@ -127,24 +125,29 @@ void AsyncLogWriter::write() {
127125
// append meta-messages of dropped counters
128126
AsyncLogMapIterator dropped_counters_iter(logs);
129127
_stats.iterate(&dropped_counters_iter);
130-
own_io = _io_sem.trywait();
131128
}
132129

133130
LinkedListIterator<AsyncLogMessage> it(logs.head());
134-
if (!own_io) {
135-
_io_sem.wait();
136-
}
137131

132+
int req = 0;
138133
while (!it.is_empty()) {
139134
AsyncLogMessage* e = it.next();
140135
char* msg = e->message();
141136

142137
if (msg != nullptr) {
143138
e->output()->write_blocking(e->decorations(), msg);
144139
os::free(msg);
140+
} else if (e->output() == nullptr) {
141+
// This is a flush token. Record that we found it and then
142+
// signal the flushing thread after the loop.
143+
req++;
145144
}
146145
}
147-
_io_sem.signal();
146+
147+
if (req > 0) {
148+
assert(req == 1, "AsyncLogWriter::flush() is NOT MT-safe!");
149+
_flush_sem.signal(req);
150+
}
148151
}
149152

150153
void AsyncLogWriter::run() {
@@ -181,10 +184,23 @@ AsyncLogWriter* AsyncLogWriter::instance() {
181184
return _instance;
182185
}
183186

184-
// write() acquires and releases _io_sem even _buffer is empty.
185-
// This guarantees all logging I/O of dequeued messages are done when it returns.
187+
// Inserts a flush token into the async output buffer and waits until the AsyncLog thread
188+
// signals that it has seen it and completed all dequeued message processing.
189+
// This method is not MT-safe in itself, but is guarded by another lock in the usual
190+
// usecase - see the comments in the header file for more details.
186191
void AsyncLogWriter::flush() {
187192
if (_instance != nullptr) {
188-
_instance->write();
193+
{
194+
using none = LogTagSetMapping<LogTag::__NO_TAG>;
195+
AsyncLogLocker locker;
196+
LogDecorations d(LogLevel::Off, none::tagset(), LogDecorators::None);
197+
AsyncLogMessage token(nullptr, d, nullptr);
198+
199+
// Push directly in-case we are at logical max capacity, as this must not get dropped.
200+
_instance->_buffer.push_back(token);
201+
_instance->_sem.signal();
202+
}
203+
204+
_instance->_flush_sem.wait();
189205
}
190206
}

‎src/hotspot/share/logging/logAsyncWriter.hpp

+10-12
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ class LinkedListDeque : private LinkedListImpl<E, ResourceObj::C_HEAP, F> {
9191
};
9292

9393
class AsyncLogMessage {
94-
LogFileOutput& _output;
94+
LogFileOutput* _output;
9595
const LogDecorations _decorations;
9696
char* _message;
9797

9898
public:
99-
AsyncLogMessage(LogFileOutput& output, const LogDecorations& decorations, char* msg)
99+
AsyncLogMessage(LogFileOutput* output, const LogDecorations& decorations, char* msg)
100100
: _output(output), _decorations(decorations), _message(msg) {}
101101

102102
// placeholder for LinkedListImpl.
103103
bool equals(const AsyncLogMessage& o) const { return false; }
104104

105-
LogFileOutput* output() const { return &_output; }
105+
LogFileOutput* output() const { return _output; }
106106
const LogDecorations& decorations() const { return _decorations; }
107107
char* message() const { return _message; }
108108
};
@@ -121,17 +121,16 @@ typedef KVHashtable<LogFileOutput*, uint32_t, mtLogging> AsyncLogMap;
121121
// initialize() is called once when JVM is initialized. It creates and initializes the singleton instance of AsyncLogWriter.
122122
// Once async logging is established, there's no way to turn it off.
123123
//
124-
// instance() is MT-safe and returns the pointer of the singleton instance if and only if async logging is enabled and has well
125-
// initialized. Clients can use its return value to determine async logging is established or not.
124+
// instance() is MT-safe and returns the pointer of the singleton instance if and only if async logging is enabled and has
125+
// successfully initialized. Clients can use its return value to determine async logging is established or not.
126126
//
127-
// The basic operation of AsyncLogWriter is enqueue(). 2 overloading versions of it are provided to match LogOutput::write().
127+
// enqueue() is the basic operation of AsyncLogWriter. Two overloading versions of it are provided to match LogOutput::write().
128128
// They are both MT-safe and non-blocking. Derived classes of LogOutput can invoke the corresponding enqueue() in write() and
129129
// return 0. AsyncLogWriter is responsible of copying neccessary data.
130130
//
131-
// The static member function flush() is designated to flush out all pending messages when JVM is terminating.
132-
// In normal JVM termination, flush() is invoked in LogConfiguration::finalize(). flush() is MT-safe and can be invoked arbitrary
133-
// times. It is no-op if async logging is not established.
134-
//
131+
// flush() ensures that all pending messages have been written out before it returns. It is not MT-safe in itself. When users
132+
// change the logging configuration via jcmd, LogConfiguration::configure_output() calls flush() under the protection of the
133+
// ConfigurationLock. In addition flush() is called during JVM termination, via LogConfiguration::finalize.
135134
class AsyncLogWriter : public NonJavaThread {
136135
class AsyncLogLocker;
137136

@@ -141,8 +140,7 @@ class AsyncLogWriter : public NonJavaThread {
141140
// _sem is a semaphore whose value denotes how many messages have been enqueued.
142141
// It decreases in AsyncLogWriter::run()
143142
Semaphore _sem;
144-
// A lock of IO
145-
Semaphore _io_sem;
143+
Semaphore _flush_sem;
146144

147145
volatile bool _initialized;
148146
AsyncLogMap _stats; // statistics for dropped messages

‎src/hotspot/share/logging/logConfiguration.cpp

+23-8
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,21 @@ void LogConfiguration::delete_output(size_t idx) {
211211
delete output;
212212
}
213213

214+
// MT-SAFETY
215+
//
216+
// The ConfigurationLock guarantees that only one thread is performing reconfiguration. This function still needs
217+
// to be MT-safe because logsites in other threads may be executing in parallel. Reconfiguration means unified
218+
// logging allows users to dynamically change tags and decorators of a log output via DCMD(logDiagnosticCommand.hpp).
219+
//
220+
// A RCU-style synchronization 'wait_until_no_readers()' is used inside of 'ts->set_output_level(output, level)'
221+
// if a setting has changed. It guarantees that all logs, either synchronous writes or enqueuing to the async buffer
222+
// see the new tags and decorators. It's worth noting that the synchronization occurs even if the level does not change.
223+
//
224+
// LogDecorator is a set of decorators represented in a uint. ts->update_decorators(decorators) is a union of the
225+
// current decorators and new_decorators. It's safe to do output->set_decorators(decorators) because new_decorators
226+
// is a subset of relevant tagsets decorators. After updating output's decorators, it is still safe to shrink all
227+
// decorators of tagsets.
228+
//
214229
void LogConfiguration::configure_output(size_t idx, const LogSelectionList& selections, const LogDecorators& decorators) {
215230
assert(ConfigurationLock::current_thread_has_lock(), "Must hold configuration lock to call this function.");
216231
assert(idx < _n_outputs, "Invalid index, idx = " SIZE_FORMAT " and _n_outputs = " SIZE_FORMAT, idx, _n_outputs);
@@ -253,6 +268,10 @@ void LogConfiguration::configure_output(size_t idx, const LogSelectionList& sele
253268
on_level[level]++;
254269
}
255270

271+
// For async logging we have to ensure that all enqueued messages, which may refer to previous decorators,
272+
// or a soon-to-be-deleted output, are written out first. The flush() call ensures this.
273+
AsyncLogWriter::flush();
274+
256275
// It is now safe to set the new decorators for the actual output
257276
output->set_decorators(decorators);
258277

@@ -262,10 +281,6 @@ void LogConfiguration::configure_output(size_t idx, const LogSelectionList& sele
262281
}
263282

264283
if (!enabled && idx > 1) {
265-
// User may disable a logOuput like this:
266-
// LogConfiguration::parse_log_arguments(filename, "all=off", "", "", &stream);
267-
// Just be conservative. Flush them all before deleting idx.
268-
AsyncLogWriter::flush();
269284
// Output is unused and should be removed, unless it is stdout/stderr (idx < 2)
270285
delete_output(idx);
271286
return;
@@ -283,10 +298,10 @@ void LogConfiguration::disable_outputs() {
283298
ts->disable_outputs();
284299
}
285300

286-
// Handle jcmd VM.log disable
287-
// ts->disable_outputs() above has deleted output_list with RCU synchronization.
288-
// Therefore, no new logging entry can enter AsyncLog buffer for the time being.
289-
// flush pending entries before LogOutput instances die.
301+
// Handle 'jcmd VM.log disable' and JVM termination.
302+
// ts->disable_outputs() above has disabled all output_lists with RCU synchronization.
303+
// Therefore, no new logging message can enter the async buffer for the time being.
304+
// flush out all pending messages before LogOutput instances die.
290305
AsyncLogWriter::flush();
291306

292307
while (idx > 0) {

‎src/hotspot/share/logging/logDecorators.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@
2525
#include "logging/logDecorators.hpp"
2626
#include "runtime/os.hpp"
2727

28+
template <LogDecorators::Decorator d>
29+
struct AllBitmask {
30+
// Use recursive template deduction to calculate the bitmask of all decorations.
31+
static const uint _value = (1 << d) | AllBitmask<static_cast<LogDecorators::Decorator>(d + 1)>::_value;
32+
};
33+
34+
template<>
35+
struct AllBitmask<LogDecorators::Count> {
36+
static const uint _value = 0;
37+
};
38+
2839
const LogDecorators LogDecorators::None = LogDecorators(0);
40+
const LogDecorators LogDecorators::All = LogDecorators(AllBitmask<time_decorator>::_value);
2941

3042
const char* LogDecorators::_name[][2] = {
3143
#define DECORATOR(n, a) {#n, #a},

‎src/hotspot/share/logging/logDecorators.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class LogDecorators {
8282

8383
public:
8484
static const LogDecorators None;
85+
static const LogDecorators All;
8586

8687
LogDecorators() : _decorators(DefaultDecoratorsMask) {
8788
}

‎src/hotspot/share/logging/logTagSet.cpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -73,15 +73,24 @@ bool LogTagSet::has_output(const LogOutput* output) {
7373
}
7474

7575
void LogTagSet::log(LogLevelType level, const char* msg) {
76+
// Increasing the atomic reader counter in iterator(level) must
77+
// happen before the creation of LogDecorations instance so
78+
// wait_until_no_readers() in LogConfiguration::configure_output()
79+
// synchronizes _decorations as well. The order is guaranteed by
80+
// the implied memory order of Atomic::add().
81+
LogOutputList::Iterator it = _output_list.iterator(level);
7682
LogDecorations decorations(level, *this, _decorators);
77-
for (LogOutputList::Iterator it = _output_list.iterator(level); it != _output_list.end(); it++) {
83+
84+
for (; it != _output_list.end(); it++) {
7885
(*it)->write(decorations, msg);
7986
}
8087
}
8188

8289
void LogTagSet::log(const LogMessageBuffer& msg) {
90+
LogOutputList::Iterator it = _output_list.iterator(msg.least_detailed_level());
8391
LogDecorations decorations(LogLevel::Invalid, *this, _decorators);
84-
for (LogOutputList::Iterator it = _output_list.iterator(msg.least_detailed_level()); it != _output_list.end(); it++) {
92+
93+
for (; it != _output_list.end(); it++) {
8594
(*it)->write(msg.iterator(it.level(), decorations));
8695
}
8796
}

‎src/hotspot/share/opto/compile.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -4514,7 +4514,9 @@ bool Compile::coarsened_locks_consistent() {
45144514
bool modified = false; // track locks kind modifications
45154515
Lock_List* locks_list = (Lock_List*)_coarsened_locks.at(i);
45164516
uint size = locks_list->size();
4517-
if (size != locks_list->origin_cnt()) {
4517+
if (size == 0) {
4518+
unbalanced = false; // All locks were eliminated - good
4519+
} else if (size != locks_list->origin_cnt()) {
45184520
unbalanced = true; // Some locks were removed from list
45194521
} else {
45204522
for (uint j = 0; j < size; j++) {

‎src/java.base/share/classes/java/lang/String.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -2169,9 +2169,9 @@ public boolean regionMatches(int toffset, String other, int ooffset, int len) {
21692169
* ignoring case if and only if {@code ignoreCase} is true.
21702170
* The sequences {@code tsequence} and {@code osequence} are compared,
21712171
* where {@code tsequence} is the sequence produced as if by calling
2172-
* {@code this.substring(toffset, len).codePoints()} and {@code osequence}
2173-
* is the sequence produced as if by calling
2174-
* {@code other.substring(ooffset, len).codePoints()}.
2172+
* {@code this.substring(toffset, toffset + len).codePoints()} and
2173+
* {@code osequence} is the sequence produced as if by calling
2174+
* {@code other.substring(ooffset, ooffset + len).codePoints()}.
21752175
* The result is {@code true} if and only if all of the following
21762176
* are true:
21772177
* <ul><li>{@code toffset} is non-negative.

‎test/hotspot/gtest/logging/logTestFixture.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ LogTestFixture::LogTestFixture() : _n_snapshots(0), _configuration_snapshot(NULL
4646
}
4747

4848
LogTestFixture::~LogTestFixture() {
49-
AsyncLogWriter::flush();
5049
restore_config();
5150
clear_snapshot();
5251
delete_file(TestLogFileName);

‎test/hotspot/gtest/logging/test_logConfiguration.cpp

+87-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
2323

2424
#include "precompiled.hpp"
2525
#include "jvm.h"
26+
#include "concurrentTestRunner.inline.hpp"
2627
#include "logTestFixture.hpp"
2728
#include "logTestUtils.inline.hpp"
2829
#include "logging/logConfiguration.hpp"
@@ -228,6 +229,91 @@ TEST_VM_F(LogConfigurationTest, reconfigure_decorators) {
228229
EXPECT_TRUE(is_described("#1: stderr all=off none (reconfigured)\n")) << "Expecting no decorators";
229230
}
230231

232+
class ConcurrentLogsite : public TestRunnable {
233+
int _id;
234+
235+
public:
236+
ConcurrentLogsite(int id) : _id(id) {}
237+
void runUnitTest() const override {
238+
log_debug(logging)("ConcurrentLogsite %d emits a log", _id);
239+
}
240+
};
241+
242+
// Dynamically change decorators while loggings are emitting.
243+
TEST_VM_F(LogConfigurationTest, reconfigure_decorators_MT) {
244+
const int nrOfThreads = 2;
245+
ConcurrentLogsite logsites[nrOfThreads] = {0, 1};
246+
Semaphore done(0);
247+
const long testDurationMillis = 1000;
248+
UnitTestThread* t[nrOfThreads];
249+
250+
set_log_config(TestLogFileName, "logging=debug", "none", "filecount=0");
251+
set_log_config("stdout", "all=off", "none");
252+
set_log_config("stderr", "all=off", "none");
253+
for (int i = 0; i < nrOfThreads; ++i) {
254+
t[i] = new UnitTestThread(&logsites[i], &done, testDurationMillis);
255+
}
256+
257+
for (int i = 0; i < nrOfThreads; i++) {
258+
t[i]->doit();
259+
}
260+
261+
jlong time_start = os::elapsed_counter();
262+
while (true) {
263+
jlong elapsed = (jlong)TimeHelper::counter_to_millis(os::elapsed_counter() - time_start);
264+
if (elapsed > testDurationMillis) {
265+
break;
266+
}
267+
268+
// Take turn logging with different decorators, either None or All.
269+
set_log_config(TestLogFileName, "logging=debug", "none");
270+
set_log_config(TestLogFileName, "logging=debug", _all_decorators);
271+
}
272+
273+
for (int i = 0; i < nrOfThreads; ++i) {
274+
done.wait();
275+
}
276+
}
277+
278+
// Dynamically change tags while loggings are emitting.
279+
TEST_VM_F(LogConfigurationTest, reconfigure_tags_MT) {
280+
const int nrOfThreads = 2;
281+
ConcurrentLogsite logsites[nrOfThreads] = {0, 1};
282+
Semaphore done(0);
283+
const long testDurationMillis = 1000;
284+
UnitTestThread* t[nrOfThreads];
285+
286+
set_log_config(TestLogFileName, "logging=debug", "", "filecount=0");
287+
set_log_config("stdout", "all=off", "none");
288+
set_log_config("stderr", "all=off", "none");
289+
290+
for (int i = 0; i < nrOfThreads; ++i) {
291+
t[i] = new UnitTestThread(&logsites[i], &done, testDurationMillis);
292+
}
293+
294+
for (int i = 0; i < nrOfThreads; i++) {
295+
t[i]->doit();
296+
}
297+
298+
jlong time_start = os::elapsed_counter();
299+
while (true) {
300+
jlong elapsed = (jlong)TimeHelper::counter_to_millis(os::elapsed_counter() - time_start);
301+
if (elapsed > testDurationMillis) {
302+
break;
303+
}
304+
305+
// turn on/off the tagset 'logging'.
306+
set_log_config(TestLogFileName, "logging=off");
307+
set_log_config(TestLogFileName, "logging=debug", "", "filecount=0");
308+
// sleep a prime number milliseconds to allow concurrent logsites to write logs
309+
os::naked_short_nanosleep(37);
310+
}
311+
312+
for (int i = 0; i < nrOfThreads; ++i) {
313+
done.wait();
314+
}
315+
}
316+
231317
// Test that invalid options cause configuration errors
232318
TEST_VM_F(LogConfigurationTest, invalid_configure_options) {
233319
LogConfiguration::disable_logging();

‎test/hotspot/gtest/logging/test_logDecorators.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -210,6 +210,13 @@ TEST(LogDecorators, none) {
210210
}
211211
}
212212

213+
TEST(LogDecorators, all) {
214+
LogDecorators dec = LogDecorators::All;
215+
for (size_t i = 0; i < LogDecorators::Count; i++) {
216+
EXPECT_TRUE(dec.is_decorator(decorator_array[i]));
217+
}
218+
}
219+
213220
TEST(LogDecorators, is_empty) {
214221
LogDecorators def, none = LogDecorators::None;
215222
EXPECT_FALSE(def.is_empty());

‎test/jdk/ProblemList.txt

-2
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,6 @@ com/sun/jdi/AfterThreadDeathTest.java 8232839 linux-al
785785

786786
# jdk_util
787787

788-
java/util/concurrent/locks/Lock/TimedAcquireLeak.java 8262897 macosx-aarch64
789-
790788
############################################################################
791789

792790
# jdk_instrument

‎test/jdk/java/lang/invoke/t8150782/TestAccessClass.java ‎test/jdk/java/lang/invoke/accessClassAndFindClass/TestAccessClass.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
/* @test
2727
* @bug 8150782 8207027 8266269
2828
* @compile TestAccessClass.java TestCls.java p/Foo.java q/Bar.java
29-
* @run testng/othervm -ea -esa test.java.lang.invoke.t8150782.TestAccessClass
29+
* @run testng/othervm -ea -esa test.java.lang.invoke.TestAccessClass
3030
*/
31-
package test.java.lang.invoke.t8150782;
31+
package test.java.lang.invoke;
3232

3333
import java.lang.invoke.*;
3434
import java.lang.reflect.Modifier;

‎test/jdk/java/lang/invoke/t8150782/TestCls.java ‎test/jdk/java/lang/invoke/accessClassAndFindClass/TestCls.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* or visit www.oracle.com if you need additional information or have any
2323
* questions.
2424
*/
25-
package test.java.lang.invoke.t8150782;
25+
package test.java.lang.invoke;
2626

2727
import static java.lang.invoke.MethodHandles.*;
2828

‎test/jdk/java/lang/invoke/t8150782/TestFindClass.java ‎test/jdk/java/lang/invoke/accessClassAndFindClass/TestFindClass.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
/* @test
2727
* @bug 8150782 8207027 8266269
2828
* @compile TestFindClass.java TestCls.java p/Foo.java q/Bar.java
29-
* @run testng/othervm -ea -esa test.java.lang.invoke.t8150782.TestFindClass
29+
* @run testng/othervm -ea -esa test.java.lang.invoke.TestFindClass
3030
*/
31-
package test.java.lang.invoke.t8150782;
31+
package test.java.lang.invoke;
3232

3333
import java.lang.invoke.*;
3434
import p.Foo;
@@ -42,7 +42,7 @@
4242

4343
public class TestFindClass {
4444

45-
private static final String PACKAGE_PREFIX = "test.java.lang.invoke.t8150782.";
45+
private static final String PACKAGE_PREFIX = "test.java.lang.invoke.";
4646

4747
private static boolean initializedClass1;
4848

‎test/jdk/java/lang/invoke/t8150782/TestLookup.java ‎test/jdk/java/lang/invoke/accessClassAndFindClass/TestLookup.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
/* @test
2727
* @compile TestLookup.java TestCls.java
28-
* @run testng/othervm -ea -esa test.java.lang.invoke.t8150782.TestLookup
28+
* @run testng/othervm -ea -esa test.java.lang.invoke.TestLookup
2929
*/
30-
package test.java.lang.invoke.t8150782;
30+
package test.java.lang.invoke;
3131

3232
import org.testng.annotations.Test;
3333

@@ -48,7 +48,7 @@ public void testClassLoaderChange() {
4848
@Test(expectedExceptions = {ClassNotFoundException.class})
4949
public void testPublicCannotLoadUserClass() throws IllegalAccessException, ClassNotFoundException {
5050
Lookup lookup = publicLookup();
51-
lookup.findClass("test.java.lang.invoke.t8150782.TestCls");
51+
lookup.findClass("test.java.lang.invoke.TestCls");
5252
}
5353

5454
@Test

‎test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -249,7 +249,9 @@ public Result executeAndRepeatUntilExitCode(int expectedCode, int max, int wait)
249249

250250
try {
251251
Thread.sleep(wait * 1000);
252-
} catch (Exception ex) {} // Ignore
252+
} catch (InterruptedException ex) {
253+
throw new RuntimeException(ex);
254+
}
253255

254256
count++;
255257
} while (count < max);

‎test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,11 @@ public void executeAndVerifyOutput(String... args) {
399399

400400
public void executeAndVerifyOutput(boolean removePath,
401401
List<String> launcherArgs, List<String> appArgs) {
402-
getExecutor(launcherArgs.toArray(new String[0])).dumpOutput()
403-
.setRemovePath(removePath).execute();
402+
final int attempts = 3;
403+
final int waitBetweenAttemptsSeconds = 5;
404+
getExecutor(launcherArgs.toArray(new String[0])).dumpOutput().setRemovePath(
405+
removePath).executeAndRepeatUntilExitCode(0, attempts,
406+
waitBetweenAttemptsSeconds);
404407
Path outputFile = TKit.workDir().resolve(OUTPUT_FILENAME);
405408
verifyOutputFile(outputFile, appArgs, params);
406409
}

0 commit comments

Comments
 (0)
Please sign in to comment.