1
1
/*
2
- * Copyright (c) 2001, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2001, 2020 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
24
24
package nsk .share ;
25
25
26
26
/**
27
- * Harakiri is used to terminate a stress test with PASS exit status
27
+ * Terminator is used to terminate a stress test with PASS exit status
28
28
* before the test is terminated as timed out (and so failed).
29
29
*
30
- * <p>Harakiri class holds a thread which sleeps for the given amount
30
+ * <p>Terminator class holds a thread which sleeps for the given amount
31
31
* of time, and then wakes up and executes <tt>System.exit()</tt>
32
32
* with the given exit status. That thread is daemon, so it doesn't
33
33
* prevent application from exiting once all its threads finish
34
- * before it's time for harakiri . Appointing harakiri in zero
34
+ * before it's time for termination . Appointing terminator in zero
35
35
* delay implies immediate <tt>exit()</tt>.
36
36
*
37
- * <p>There is a limitation: you may appoint no more than one harakiri
37
+ * <p>There is a limitation: you may appoint no more than one terminator
38
38
* per application.
39
39
*/
40
- public class Harakiri {
40
+ public class Terminator {
41
41
/**
42
- * Use specific <tt>appoint()</tt> method to appoint harakiri .
42
+ * Use specific <tt>appoint()</tt> method to appoint terminator .
43
43
*
44
44
* @see #appoint(int)
45
45
* @see #appoint(int,int)
46
46
*/
47
- protected Harakiri () {}
47
+ protected Terminator () {}
48
48
49
49
/**
50
- * One harakiri per application, or <tt>null</tt> (by default).
50
+ * One terminator per application, or <tt>null</tt> (by default).
51
51
*/
52
- private static Thread harakiri = null ;
52
+ private static Thread terminator = null ;
53
53
54
54
/**
55
55
* <p>Return timeout (or waittime) value munus the margin
@@ -108,11 +108,11 @@ public static int parseAppointment(String args[]) {
108
108
}
109
109
110
110
/**
111
- * Appoint harakiri after the given amount of <tt>minutes</tt>,
111
+ * Appoint terminator after the given amount of <tt>minutes</tt>,
112
112
* so that exit status would be 95 (to simulate JCK-like PASS
113
113
* status).
114
114
*
115
- * @throws IllegalStateException If harakiri is already appointed.
115
+ * @throws IllegalStateException If terminator is already appointed.
116
116
*
117
117
* @see #appoint(int,int)
118
118
* @see #parseAppointment(String[])
@@ -122,23 +122,23 @@ public static void appoint(int minutes) {
122
122
}
123
123
124
124
/**
125
- * Appoint Harakiri for the given amount of <tt>minutes</tt>,
125
+ * Appoint Terminator for the given amount of <tt>minutes</tt>,
126
126
* so that the given <tt>status</tt> would be exited when time
127
127
* is over.
128
128
*
129
- * @throws IllegalStateException If harakiri is already appointed.
129
+ * @throws IllegalStateException If terminator is already appointed.
130
130
*
131
131
* @see #appoint(int)
132
132
* @see #parseAppointment(String[])
133
133
*/
134
134
public static void appoint (int minutes , int status ) {
135
- if (harakiri != null )
136
- throw new IllegalStateException ("Harakiri is already appointed." );
135
+ if (terminator != null )
136
+ throw new IllegalStateException ("Terminator is already appointed." );
137
137
138
138
final long timeToExit = System .currentTimeMillis () + 60 *1000L *minutes ;
139
139
final int exitStatus = status ;
140
140
141
- harakiri = new Thread (Harakiri .class .getName ()) {
141
+ terminator = new Thread (Terminator .class .getName ()) {
142
142
public void run () {
143
143
long timeToSleep = timeToExit - System .currentTimeMillis ();
144
144
if (timeToSleep > 0 )
@@ -155,21 +155,21 @@ public void run() {
155
155
} catch (InterruptedException exception ) {
156
156
exception .printStackTrace (System .err );
157
157
//
158
- // OOPS, the dagger for harakiri looks broken:
158
+ // OOPS, the dagger for terminator looks broken:
159
159
//
160
160
return ;
161
161
};
162
162
//
163
163
// OK, lets do it now:
164
164
//
165
165
System .err .println (
166
- "#\n # Harakiri : prescheduled program termination.\n #" );
167
- System .exit (exitStatus ); // harakiri to all threads
166
+ "#\n # Terminator : prescheduled program termination.\n #" );
167
+ System .exit (exitStatus ); // terminator to all threads
168
168
}
169
169
};
170
170
171
- harakiri .setPriority (Thread .MAX_PRIORITY );
172
- harakiri .setDaemon (true );
173
- harakiri .start ();
171
+ terminator .setPriority (Thread .MAX_PRIORITY );
172
+ terminator .setDaemon (true );
173
+ terminator .start ();
174
174
}
175
175
}
0 commit comments