src/jdk.jfr/share/classes/jdk/jfr/consumer/EventStream.java
author egahlin
Thu, 27 Jun 2019 10:41:01 +0200
branchJEP-349-branch
changeset 57434 216bf2e3b542
parent 57386 acdd0dbe37ee
child 57449 099789ceff7d
permissions -rw-r--r--
Add support for EventStrem::openRepository
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
57361
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
     1
/*
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
     4
 *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    10
 *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    15
 * accompanied this code).
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    16
 *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    20
 *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    23
 * questions.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    24
 */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    25
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    26
package jdk.jfr.consumer;
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    27
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    28
import java.io.IOException;
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    29
import java.nio.file.Path;
57434
216bf2e3b542 Add support for EventStrem::openRepository
egahlin
parents: 57386
diff changeset
    30
import java.security.AccessController;
57361
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    31
import java.time.Duration;
57372
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    32
import java.time.Instant;
57361
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    33
import java.util.function.Consumer;
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    34
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    35
/**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    36
 * Represents a stream of event that actions can be performed up on.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    37
 */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    38
public interface EventStream extends AutoCloseable {
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    39
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    40
    /**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    41
     * Creates a stream starting from the next written event in a disk
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    42
     * repository.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    43
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    44
     * @param directory location of the disk repository, not {@code null}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    45
     * @return an event stream, not {@code null}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    46
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    47
    public static EventStream openRepository(Path directory) throws IOException {
57434
216bf2e3b542 Add support for EventStrem::openRepository
egahlin
parents: 57386
diff changeset
    48
        return new EventDirectoryStream(AccessController.getContext(), directory);
57361
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    49
    }
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    50
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    51
    /**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    52
     * Creates an event stream starting from the first event in a file.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    53
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    54
     * @param file location of the file, not {@code null}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    55
     * @return an event stream, not {@code null}
57372
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    56
     *
57376
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
    57
     * @throws IOException if a stream can't be opened,or an I/O error occurs
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
    58
     *         during reading
57361
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    59
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    60
    public static EventStream openFile(Path file) throws IOException {
57377
528d85d2fce5 Add EventStream::setReuse. Works for file streams
egahlin
parents: 57376
diff changeset
    61
        return new EventFileStream(file);
57361
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    62
    }
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    63
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    64
    /**
57372
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    65
     * Creates an event stream starting start time and end time in a file.
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    66
     *
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    67
     * @param file location of the file, not {@code null}
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    68
     *
57376
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
    69
     * @param the start start time for the stream, or {@code null} to get data
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
    70
     *        from the beginning of the
57372
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    71
     *
57376
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
    72
     * @param the end end time for the stream, or {@code null} to get data until
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
    73
     *        the end.
57372
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    74
     *
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    75
     * @throws IllegalArgumentException if {@code end} happens before
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    76
     *         {@code start}
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    77
     *
57376
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
    78
     * @throws IOException if a stream can't be opened,or an I/O error occurs
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
    79
     *         during reading
57372
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    80
     */
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    81
    public static EventStream openFile(Path file, Instant from, Instant to) throws IOException {
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    82
        throw new UnsupportedOperationException("Not yet implemented");
57376
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
    83
        // return new EventFileStream(file);
57372
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    84
    }
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    85
50ca040843ea Prepare infrastructure for multiple implementations of EventStream
egahlin
parents: 57361
diff changeset
    86
    /**
57361
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    87
     * Performs an action on all events in the stream.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    88
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    89
     * @param action an action to be performed on each {@code RecordedEvent},
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    90
     *        not {@code null}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    91
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    92
    void onEvent(Consumer<RecordedEvent> action);
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    93
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    94
    /**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    95
     * Performs an action on all events in the stream with a specified name.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    96
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    97
     * @param eventName the name of the event, not {@code null}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    98
     * @param action an action to be performed on each {@code RecordedEvent}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
    99
     *        that matches the event name, not {@code null}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   100
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   101
    void onEvent(String eventName, Consumer<RecordedEvent> action);
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   102
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   103
    /**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   104
     * Performs an action when the event stream has been flushed.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   105
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   106
     * @param action an action to be performed after stream has been flushed,
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   107
     *        not {@code null}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   108
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   109
    void onFlush(Runnable action);
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   110
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   111
    /**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   112
     * Performs an action when the event stream is closed.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   113
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   114
     * @param action an action to be performed after the stream has been closed,
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   115
     *        not {@code null}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   116
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   117
    void onClose(Runnable action);
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   118
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   119
    /**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   120
     * Releases all resources associated with this event stream.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   121
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   122
    void close();
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   123
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   124
    /**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   125
     * Removes an action from the stream.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   126
     * <p>
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   127
     * If the action has been added multiple times, all instance of it will be
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   128
     * removed.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   129
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   130
     * @param action the action to remove, not {@code null}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   131
     * @return {@code true} if the action was removed, {@code false} otherwise
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   132
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   133
     * @see #onClose(Runnable)
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   134
     * @see #onFlush(Runnable)
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   135
     * @see #onEvent(Consumer)
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   136
     * @see #onEvent(String, Consumer)
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   137
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   138
    boolean remove(Object action);
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   139
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   140
    /**
57380
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   141
     * Hint that the event object in an {@link #onEvent(Consumer)} action
57376
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
   142
     * may be reused.
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
   143
     * <p>
57380
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   144
     * If reuse is set to {@code true), a callback should not keep a reference
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   145
     * to the event object after the callback from {@code onEvent} has returned.
57376
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
   146
     * <p>
57380
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   147
     * By default reuse is set to {@code true}
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   148
     *
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   149
     * @param resuse if event objects can be reused between calls to {@code #onEvent(Consumer)}
57376
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
   150
     *
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
   151
     */
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
   152
    public void setReuse(boolean reuse);
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
   153
8e8a06a3059c Add foundation for event object reuse
egahlin
parents: 57372
diff changeset
   154
    /**
57380
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   155
     * Orders events in chronological order aft the end timestamp
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   156
     *
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   157
     * TODO: WHAT ABOUT EVENTS THAT OCCUR WAY OUT OF ORDER
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   158
     * <p>
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   159
     * By default ordered is set to {@code true}
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   160
     *
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   161
     * @param ordered if event objects arrive in chronological order to {@code #onEvent(Consumer)}
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   162
     */
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   163
    public void setOrdered(boolean ordered);
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   164
6a7e7743b82f setOrdered and setReuse implemented for file stream, incl. unit tests
egahlin
parents: 57377
diff changeset
   165
    /**
57361
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   166
     * Starts processing events in the stream.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   167
     * <p>
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   168
     * All actions will performed on this stream will happen in the current
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   169
     * thread.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   170
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   171
     * @throws IllegalStateException if the stream is already started or if it
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   172
     *         has been closed
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   173
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   174
    void start();
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   175
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   176
    /**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   177
     * Starts processing events in the stream asynchronously.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   178
     * <p>
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   179
     * All actions on this stream will be performed in a separate thread.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   180
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   181
     * @throws IllegalStateException if the stream is already started or if it
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   182
     *         has been closed
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   183
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   184
    void startAsync();
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   185
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   186
    /**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   187
     * Blocks the current thread until the stream is finished, closed, or it
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   188
     * times out.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   189
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   190
     * @param timeout the maximum time to wait, not {@code null}
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   191
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   192
     * @see #start()
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   193
     * @see #startAsync()
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   194
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   195
    void awaitTermination(Duration timeout);
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   196
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   197
    /**
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   198
     * Blocks the current thread until the stream is finished or closed.
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   199
     *
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   200
     * @see #start()
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   201
     * @see #startAsync()
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   202
     */
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   203
    void awaitTermination();
53dccc90a5be Preview-addendum
mgronlun
parents:
diff changeset
   204
}