author | egahlin |
Wed, 18 Sep 2019 08:20:10 +0200 | |
branch | JEP-349-branch |
changeset 58201 | 2654d1b665bf |
parent 58200 | 2d147d680311 |
child 58209 | 7993ced88081 |
permissions | -rw-r--r-- |
57361 | 1 |
/* |
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package jdk.jfr.consumer; |
|
27 |
||
28 |
import java.io.IOException; |
|
29 |
import java.nio.file.Path; |
|
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
30 |
import java.security.AccessControlContext; |
57434 | 31 |
import java.security.AccessController; |
57361 | 32 |
import java.time.Duration; |
57372
50ca040843ea
Prepare infrastructure for multiple implementations of EventStream
egahlin
parents:
57361
diff
changeset
|
33 |
import java.time.Instant; |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
34 |
import java.util.Objects; |
57361 | 35 |
import java.util.function.Consumer; |
36 |
||
57717
4ce66d271065
Security handling, but two tests fails with driver
egahlin
parents:
57690
diff
changeset
|
37 |
import jdk.jfr.internal.SecuritySupport; |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
38 |
import jdk.jfr.internal.Utils; |
58145
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
39 |
import jdk.jfr.internal.consumer.EventDirectoryStream; |
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
40 |
import jdk.jfr.internal.consumer.EventFileStream; |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
41 |
import jdk.jfr.internal.consumer.FileAccess; |
57627 | 42 |
|
57361 | 43 |
/** |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
44 |
* Represents a stream of events. |
58129 | 45 |
* <p> |
46 |
* A stream is a sequence of events and the way to interact with a stream is to |
|
58200 | 47 |
* register actions. The {@code EventStream} interface is not to be implemented |
48 |
* and future versions of the JDK may prevent this completely. |
|
58129 | 49 |
* <p> |
50 |
* To receive a notification when an event arrives, register an action using the |
|
51 |
* {@link #onEvent(Consumer)} method. To filter the stream for an event with a |
|
52 |
* specific name, use {@link #onEvent(String, Consumer)} method. |
|
58200 | 53 |
* <p> |
58129 | 54 |
* By default, the same {@code RecordedEvent} object can be used for |
55 |
* representing two or more distinct events. The object can be delivered |
|
56 |
* multiple times to the same action as well as to other actions. If the life |
|
58201 | 57 |
* span of the event object exceeds that of the action, the |
58129 | 58 |
* {@link #setReuse(boolean)} method should be set to {@code false} so that a |
59 |
* new object is allocated for each event. |
|
60 |
* <p> |
|
61 |
* Events are delivered in batches. To receive a notification when a batch is |
|
62 |
* complete, register an action using the {@link #onFlush(Runnable)} method. |
|
63 |
* This is an opportunity to aggregate or push data to external systems while |
|
64 |
* the Java Virtual Machine (JVM) is preparing the next batch. |
|
65 |
* <p> |
|
66 |
* Events within a batch are sorted chronologically by their end time. If |
|
67 |
* ordering is not a concern, sorting can be disabled using the |
|
68 |
* {@link #setOrdered(boolean)} method. |
|
69 |
* <p> |
|
70 |
* To dispatch events to registered actions, the stream must be started. To |
|
71 |
* start processing in the current thread, invoke the {@link #start()} method. |
|
72 |
* To process actions asynchronously in a separate thread, invoke the |
|
73 |
* {@link #startAsync()} method. To await completion of the stream, use the |
|
74 |
* awaitTermination {@link #awaitTermination()} or the {link |
|
75 |
* {@link #awaitTermination(Duration)} method. |
|
76 |
* <p> |
|
77 |
* When a stream ends it is automatically closed. To manually stop processing of |
|
58200 | 78 |
* events, close the stream by invoking the {@link #close()} method. A stream |
58201 | 79 |
* can also be automatically closed in exceptional circumstances, for example if |
80 |
* the JVM that is being monitored exits. To receive a notification in any of |
|
58200 | 81 |
* these occasions, use the {@link #onClose(Runnable)} method to register an |
82 |
* action. |
|
58129 | 83 |
* <p> |
84 |
* If an unexpected exception occurs in an action, it is possible to catch the |
|
85 |
* exception in an error handler. An error handler can be registered using the |
|
86 |
* {@link #onError(Runnable)} method. If no error handler is registered, the |
|
87 |
* default behavior is to print the exception and its backtrace to the standard |
|
88 |
* error stream. |
|
89 |
* <p> |
|
58200 | 90 |
* The following example shows how an {@code EventStream} can be used to listen |
91 |
* to events on a JVM running Flight Recorder |
|
92 |
* |
|
58152 | 93 |
* <pre> |
94 |
* <code> |
|
95 |
* try (EventStream es = EventStream.openRepository()) { |
|
96 |
* es.onEvent("jdk.CPULoad", event -> { |
|
97 |
* System.out.println("CPU Load " + event.getEndTime()); |
|
98 |
* System.out.println(" Machine total: " + 100 * event.getFloat("machineTotal") + "%"); |
|
99 |
* System.out.println(" JVM User: " + 100 * event.getFloat("jvmUser") + "%"); |
|
100 |
* System.out.println(" JVM System: " + 100 * event.getFloat("jvmSystem") + "%"); |
|
101 |
* System.out.println(); |
|
102 |
* System.gc(); |
|
103 |
* }); |
|
104 |
* es.onEvent("jdk.GarbageCollection", event -> { |
|
105 |
* System.out.println("Garbage collection: " + event.getLong("gcId")); |
|
106 |
* System.out.println(" Cause: " + event.getString("cause")); |
|
107 |
* System.out.println(" Total pause: " + event.getDuration("sumOfPauses")); |
|
108 |
* System.out.println(" Longest pause: " + event.getDuration("longestPause")); |
|
109 |
* System.out.println(); |
|
110 |
* }); |
|
111 |
* es.start(); |
|
112 |
* } |
|
113 |
* </code> |
|
114 |
* </pre> |
|
58129 | 115 |
* <p> |
58152 | 116 |
* To start recording together with the stream, see {@link RecordingStream}. |
58129 | 117 |
* |
58200 | 118 |
* @since 14 |
57361 | 119 |
*/ |
120 |
public interface EventStream extends AutoCloseable { |
|
121 |
/** |
|
58129 | 122 |
* Creates a stream from the repository of the current Java Virtual Machine |
123 |
* (JVM). |
|
57627 | 124 |
* <p> |
125 |
* By default, the stream starts with the next event flushed by Flight |
|
126 |
* Recorder. |
|
127 |
* |
|
128 |
* @return an event stream, not {@code null} |
|
129 |
* |
|
130 |
* @throws IOException if a stream can't be opened, or an I/O error occurs |
|
131 |
* when trying to access the repository |
|
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
132 |
* |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
133 |
* @throws SecurityException if a security manager exists and the caller |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
134 |
* does not have |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
135 |
* {@code FlightRecorderPermission("accessFlightRecorder")} |
57627 | 136 |
*/ |
137 |
public static EventStream openRepository() throws IOException { |
|
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
138 |
Utils.checkAccessFlightRecorder(); |
57717
4ce66d271065
Security handling, but two tests fails with driver
egahlin
parents:
57690
diff
changeset
|
139 |
return new EventDirectoryStream(AccessController.getContext(), null, SecuritySupport.PRIVILIGED, false); |
57627 | 140 |
} |
141 |
||
142 |
/** |
|
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
143 |
* Creates an event stream from a disk repository. |
57449 | 144 |
* <p> |
57627 | 145 |
* By default, the stream starts with the next event flushed by Flight |
146 |
* Recorder. |
|
57361 | 147 |
* |
148 |
* @param directory location of the disk repository, not {@code null} |
|
57449 | 149 |
* |
57361 | 150 |
* @return an event stream, not {@code null} |
57449 | 151 |
* |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
152 |
* @throws IOException if a stream can't be opened, or an I/O error occurs |
57627 | 153 |
* when trying to access the repository |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
154 |
* |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
155 |
* @throws SecurityException if a security manager exists and its |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
156 |
* {@code checkRead} method denies read access to the directory, or |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
157 |
* files in the directory. |
57361 | 158 |
*/ |
159 |
public static EventStream openRepository(Path directory) throws IOException { |
|
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
160 |
Objects.nonNull(directory); |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
161 |
AccessControlContext acc = AccessController.getContext(); |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
162 |
return new EventDirectoryStream(acc, directory, FileAccess.UNPRIVILIGED, false); |
57361 | 163 |
} |
164 |
||
165 |
/** |
|
57449 | 166 |
* Creates an event stream from a file. |
167 |
* <p> |
|
57452
6fabe73e5d9a
Reduced allocation pressure. Fix getValue for startTime and duration
egahlin
parents:
57449
diff
changeset
|
168 |
* By default, the stream starts with the first event in the file. |
57361 | 169 |
* |
170 |
* @param file location of the file, not {@code null} |
|
57449 | 171 |
* |
57361 | 172 |
* @return an event stream, not {@code null} |
57372
50ca040843ea
Prepare infrastructure for multiple implementations of EventStream
egahlin
parents:
57361
diff
changeset
|
173 |
* |
58129 | 174 |
* @throws IOException if the file can't be opened, or an I/O error occurs |
57376 | 175 |
* during reading |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
176 |
* |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
177 |
* @throws SecurityException if a security manager exists and its |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
178 |
* {@code checkRead} method denies read access to the file |
57361 | 179 |
*/ |
58197 | 180 |
static EventStream openFile(Path file) throws IOException { |
57985 | 181 |
return new EventFileStream(AccessController.getContext(), file); |
57372
50ca040843ea
Prepare infrastructure for multiple implementations of EventStream
egahlin
parents:
57361
diff
changeset
|
182 |
} |
50ca040843ea
Prepare infrastructure for multiple implementations of EventStream
egahlin
parents:
57361
diff
changeset
|
183 |
|
50ca040843ea
Prepare infrastructure for multiple implementations of EventStream
egahlin
parents:
57361
diff
changeset
|
184 |
/** |
58129 | 185 |
* Registers an action to perform on all events in the stream. |
57361 | 186 |
* |
58129 | 187 |
* @param action an action to perform on each {@code RecordedEvent}, not |
188 |
* {@code null} |
|
57361 | 189 |
*/ |
190 |
void onEvent(Consumer<RecordedEvent> action); |
|
191 |
||
192 |
/** |
|
58129 | 193 |
* Registers an action to perform on all events matching a name. |
57361 | 194 |
* |
195 |
* @param eventName the name of the event, not {@code null} |
|
57449 | 196 |
* |
58129 | 197 |
* @param action an action to perform on each {@code RecordedEvent} matching |
198 |
* the event name, not {@code null} |
|
57361 | 199 |
*/ |
200 |
void onEvent(String eventName, Consumer<RecordedEvent> action); |
|
201 |
||
202 |
/** |
|
58129 | 203 |
* Registers an action to perform after the stream has been flushed. |
57361 | 204 |
* |
58129 | 205 |
* @param action an action to perform after the stream has been |
206 |
* flushed, not {@code null} |
|
57361 | 207 |
*/ |
208 |
void onFlush(Runnable action); |
|
209 |
||
210 |
/** |
|
58129 | 211 |
* Registers an action to perform if an exception occurs. |
57971 | 212 |
* <p> |
58129 | 213 |
* if an action is not registered, an exception stack trace is printed to |
214 |
* standard error. |
|
57971 | 215 |
* <p> |
58129 | 216 |
* Registering an action overrides the default behavior. If multiple actions |
217 |
* have been registered, they are performed in the order of registration. |
|
218 |
* <p> |
|
219 |
* If this method itself throws an exception, resulting behavior is |
|
220 |
* undefined. |
|
57971 | 221 |
* |
58129 | 222 |
* @param action an action to perform if an exception occurs, not |
57971 | 223 |
* {@code null} |
224 |
*/ |
|
225 |
void onError(Consumer<Throwable> action); |
|
226 |
||
227 |
/** |
|
58129 | 228 |
* Registers an action to perform when the stream is closed. |
57449 | 229 |
* <p> |
58129 | 230 |
* If the stream is already closed, the action will be performed immediately |
57449 | 231 |
* in the current thread. |
57361 | 232 |
* |
58129 | 233 |
* @param action an action to perform after the stream is closed, not |
234 |
* {@code null} |
|
235 |
* @see #close() |
|
57361 | 236 |
*/ |
237 |
void onClose(Runnable action); |
|
238 |
||
239 |
/** |
|
58129 | 240 |
* Releases all resources associated with this stream. |
57361 | 241 |
*/ |
242 |
void close(); |
|
243 |
||
244 |
/** |
|
58129 | 245 |
* Unregisters an action. |
57361 | 246 |
* <p> |
58129 | 247 |
* If the action has been registered multiple times, all instances are |
248 |
* unregistered. |
|
57361 | 249 |
* |
58129 | 250 |
* @param action the action to unregister, not {@code null} |
57449 | 251 |
* |
58129 | 252 |
* @return {@code true} if the action was unregistered, {@code false} |
253 |
* otherwise |
|
57361 | 254 |
* |
255 |
* @see #onEvent(Consumer) |
|
256 |
* @see #onEvent(String, Consumer) |
|
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
257 |
* @see #onFlush(Runnable) |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
258 |
* @see #onClose(Runnable) |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
259 |
* @see #onError(Consumer) |
57361 | 260 |
*/ |
261 |
boolean remove(Object action); |
|
262 |
||
263 |
/** |
|
57449 | 264 |
* Specifies that the event object in an {@link #onEvent(Consumer)} action |
58129 | 265 |
* can be reused. |
57376 | 266 |
* <p> |
58129 | 267 |
* If reuse is set to {@code true), an action should not keep a reference |
268 |
* to the event object after the action has completed. |
|
57380
6a7e7743b82f
setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents:
57377
diff
changeset
|
269 |
* |
58129 | 270 |
* @param reuse {@code true} if an event object can be reused, {@code false} |
271 |
* otherwise |
|
57376 | 272 |
*/ |
58129 | 273 |
void setReuse(boolean reuse); |
57376 | 274 |
|
275 |
/** |
|
57449 | 276 |
* Specifies that events arrives in chronological order, sorted by the time |
58129 | 277 |
* they were committed to the stream. |
57380
6a7e7743b82f
setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents:
57377
diff
changeset
|
278 |
* |
57449 | 279 |
* @param ordered if event objects arrive in chronological order to |
280 |
* {@code #onEvent(Consumer)} |
|
57380
6a7e7743b82f
setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents:
57377
diff
changeset
|
281 |
*/ |
58129 | 282 |
void setOrdered(boolean ordered); |
57380
6a7e7743b82f
setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents:
57377
diff
changeset
|
283 |
|
6a7e7743b82f
setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents:
57377
diff
changeset
|
284 |
/** |
58129 | 285 |
* Specifies the start time of the stream. |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
286 |
* <p> |
58129 | 287 |
* The start time must be set before starting the stream |
57449 | 288 |
* |
289 |
* @param startTime the start time, not {@code null} |
|
290 |
* |
|
58129 | 291 |
* @throws IllegalStateException if the stream is already started |
292 |
* |
|
293 |
* @see #start() |
|
294 |
* @see #startAsync() |
|
57449 | 295 |
*/ |
58129 | 296 |
void setStartTime(Instant startTime); |
57449 | 297 |
|
298 |
/** |
|
58129 | 299 |
* Specifies the end time of the stream. |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
300 |
* <p> |
58129 | 301 |
* The end time must be set before starting the stream. |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
302 |
* <p> |
58129 | 303 |
* At end time, the stream is closed. |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
304 |
* |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
305 |
* @param endTime the end time, not {@code null} |
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
306 |
* |
58129 | 307 |
* @throws IllegalStateException if the stream is already started |
308 |
* |
|
309 |
* @see #start() |
|
310 |
* @see #startAsync() |
|
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
311 |
*/ |
58129 | 312 |
void setEndTime(Instant endTime); |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
313 |
|
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57627
diff
changeset
|
314 |
/** |
58129 | 315 |
* Start processing of actions. |
57361 | 316 |
* <p> |
58129 | 317 |
* Actions are performed in the current thread. |
57361 | 318 |
* |
58129 | 319 |
* @throws IllegalStateException if the stream is already started or closed |
57361 | 320 |
*/ |
321 |
void start(); |
|
322 |
||
323 |
/** |
|
58129 | 324 |
* Start asynchronous processing of actions. |
57361 | 325 |
* <p> |
58129 | 326 |
* Actions are performed in a single separate thread. |
57361 | 327 |
* |
58129 | 328 |
* @throws IllegalStateException if the stream is already started or closed |
57361 | 329 |
*/ |
330 |
void startAsync(); |
|
331 |
||
332 |
/** |
|
58129 | 333 |
* Blocks until all actions are completed, or the stream is closed, or the |
334 |
* timeout occurs, or the current thread is interrupted, whichever happens |
|
335 |
* first. |
|
57361 | 336 |
* |
337 |
* @param timeout the maximum time to wait, not {@code null} |
|
338 |
* |
|
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
339 |
* @throws IllegalArgumentException if timeout is negative |
58129 | 340 |
* @throws InterruptedException if interrupted while waiting |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
341 |
* |
57361 | 342 |
* @see #start() |
343 |
* @see #startAsync() |
|
58129 | 344 |
* @see Thread#interrupt() |
57361 | 345 |
*/ |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
346 |
void awaitTermination(Duration timeout) throws InterruptedException; |
57361 | 347 |
|
348 |
/** |
|
58129 | 349 |
* Blocks until all actions are completed, or the stream is closed, or the |
350 |
* current thread is interrupted, whichever happens first. |
|
57361 | 351 |
* |
58129 | 352 |
* @throws InterruptedException if interrupted while waiting |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
353 |
* |
57361 | 354 |
* @see #start() |
355 |
* @see #startAsync() |
|
58129 | 356 |
* @see Thread#interrupt() |
57361 | 357 |
*/ |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
358 |
void awaitTermination() throws InterruptedException; |
58180 | 359 |
} |