1282
1283 // Calculate how long it'll be until the next PeriodicTask work
1284 // should be done, and sleep that amount of time.
1285 int time_waited = sleep();
1286
1287 if (is_error_reported()) {
1288 // A fatal error has happened, the error handler(VMError::report_and_die)
1289 // should abort JVM after creating an error log file. However in some
1290 // rare cases, the error handler itself might deadlock. Here we try to
1291 // kill JVM if the fatal error handler fails to abort in 2 minutes.
1292 //
1293 // This code is in WatcherThread because WatcherThread wakes up
1294 // periodically so the fatal error handler doesn't need to do anything;
1295 // also because the WatcherThread is less likely to crash than other
1296 // threads.
1297
1298 for (;;) {
1299 if (!ShowMessageBoxOnError
1300 && (OnError == NULL || OnError[0] == '\0')
1301 && Arguments::abort_hook() == NULL) {
1302 os::sleep(this, ErrorLogTimeout * 60 * 1000, false);
1303 fdStream err(defaultStream::output_fd());
1304 err.print_raw_cr("# [ timer expired, abort... ]");
1305 // skip atexit/vm_exit/vm_abort hooks
1306 os::die();
1307 }
1308
1309 // Wake up 5 seconds later, the fatal handler may reset OnError or
1310 // ShowMessageBoxOnError when it is ready to abort.
1311 os::sleep(this, 5 * 1000, false);
1312 }
1313 }
1314
1315 if (_should_terminate) {
1316 // check for termination before posting the next tick
1317 break;
1318 }
1319
1320 PeriodicTask::real_time_tick(time_waited);
1321 }
1322
|
1282
1283 // Calculate how long it'll be until the next PeriodicTask work
1284 // should be done, and sleep that amount of time.
1285 int time_waited = sleep();
1286
1287 if (is_error_reported()) {
1288 // A fatal error has happened, the error handler(VMError::report_and_die)
1289 // should abort JVM after creating an error log file. However in some
1290 // rare cases, the error handler itself might deadlock. Here we try to
1291 // kill JVM if the fatal error handler fails to abort in 2 minutes.
1292 //
1293 // This code is in WatcherThread because WatcherThread wakes up
1294 // periodically so the fatal error handler doesn't need to do anything;
1295 // also because the WatcherThread is less likely to crash than other
1296 // threads.
1297
1298 for (;;) {
1299 if (!ShowMessageBoxOnError
1300 && (OnError == NULL || OnError[0] == '\0')
1301 && Arguments::abort_hook() == NULL) {
1302 os::sleep(this, ErrorLogTimeout * 1000, false); // in seconds
1303 fdStream err(defaultStream::output_fd());
1304 err.print_raw_cr("# [ timer expired, abort... ]");
1305 // skip atexit/vm_exit/vm_abort hooks
1306 os::die();
1307 }
1308
1309 // Wake up 5 seconds later, the fatal handler may reset OnError or
1310 // ShowMessageBoxOnError when it is ready to abort.
1311 os::sleep(this, 5 * 1000, false);
1312 }
1313 }
1314
1315 if (_should_terminate) {
1316 // check for termination before posting the next tick
1317 break;
1318 }
1319
1320 PeriodicTask::real_time_tick(time_waited);
1321 }
1322
|