APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.jfr.internal.management

public final Class StreamBarrier

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable, .IOException

Purpose of this class is to provide a synchronization point when stopping a recording. Without it, a race can happen where a stream advances beyond the last chunk of the recording. Code that is processing the stream calls check() and Unless the recording is in the process of being stopped, it will just return. On the other hand, if the recording is stopping, the thread waits and when it wakes up an end position should have been set (last chunk position) beyond which the stream processing should not continue.

Field Summary

Modifier and TypeField and Description
private boolean
private long
private final HiddenWait
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
public synchronized void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public long
public void
setStreamEnd(long timestamp)

public boolean
used()

Returns {@code true) if barrier is, or has been, in active state, {@code false) otherwise.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

activatedback to summary
private boolean activated
endback to summary
private long end
lockback to summary
private final HiddenWait lock
usedback to summary
private boolean used

Constructor Detail

StreamBarrierback to summary
public StreamBarrier()

Method Detail

activateback to summary
public void activate()
checkback to summary
public void check()
closeback to summary
public synchronized void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getStreamEndback to summary
public long getStreamEnd()
setStreamEndback to summary
public void setStreamEnd(long timestamp)
usedback to summary
public boolean used()

Returns {@code true) if barrier is, or has been, in active state, {@code false) otherwise.