APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.event

public Class SocketReadEvent

extends Event
Class Inheritance
Imports
java.net.InetSocketAddress, .SocketAddress, .UnixDomainSocketAddress

A JFR event for socket read operations. This event is mirrored in jdk.jfr.events.SocketReadEvent where the metadata for the event is provided with annotations. Some of the methods are replaced by generated methods when jfr is enabled. Note that the order of the arguments of the commit(long, long, String, String, int, long, long, boolean) method must be the same as the order of the fields.

Field Summary

Modifier and TypeField and Description
public String
public long
public boolean
public String
public int
public long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
commit(long
timestamp of the start of the operation
start
,
long
time in nanoseconds to complete the operation
duration
,
String
remote host of the transfer
host
,
String
remote address of the transfer
address
,
int
remote port of the transfer
port
,
long
timeout setting for the read
timeout
,
long
number of bytes that were transferred
bytes
,
boolean
has the end of the stream been reached
endOfStream
)

Actually commit a socket read event.

public static void
emit(long
the start time
start
,
long
the duration
duration
,
long
how many bytes were transferred
nbytes
,
SocketAddress
the address of the remote socket
remote
,
long
maximum time to wait
timeout
)

Helper method to perform a common task of getting event data ready and then emitting the event by calling commit(long, long, String, String, int, long, long, boolean).

public static boolean

Returns:

true if socket read events are enabled, false otherwise
enabled
()

Determine if this kind of event is enabled.

public static void
offer(long
the start time
start
,
long
how many bytes were transferred
nbytes
,
SocketAddress
the address of the remote socket
remote
,
long
maximum time to wait
timeout
)

Helper method to offer the data needed to potentially commit an event.

public static boolean

Returns:

true if the event should be commited
shouldThrottleCommit
(long
time in nanoseconds to complete the operation
duration
,
long
timestamp at the end of the operation
end
)

Determine if an event should be emitted.

public static long

Returns:

the current timestamp value
timestamp
()

Fetch the current timestamp in nanoseconds.

Inherited from jdk.internal.event.Event:
begincommitendisEnabledsetshouldCommit

Field Detail

addressback to summary
public String address
bytesReadback to summary
public long bytesRead
endOfStreamback to summary
public boolean endOfStream
hostback to summary
public String host
portback to summary
public int port
timeoutback to summary
public long timeout

Constructor Detail

SocketReadEventback to summary
public SocketReadEvent()

Method Detail

commitback to summary
public static void commit(long start, long duration, String host, String address, int port, long timeout, long bytes, boolean endOfStream)

Actually commit a socket read event. The implementation of this method is generated automatically if jfr is enabled. The order of the fields must be the same as the parameters in this method. commit(..., String, String, int, long, long, boolean)

Parameters
start:long

timestamp of the start of the operation

duration:long

time in nanoseconds to complete the operation

host:String

remote host of the transfer

address:String

remote address of the transfer

port:int

remote port of the transfer

timeout:long

timeout setting for the read

bytes:long

number of bytes that were transferred

endOfStream:boolean

has the end of the stream been reached

emitback to summary
public static void emit(long start, long duration, long nbytes, SocketAddress remote, long timeout)

Helper method to perform a common task of getting event data ready and then emitting the event by calling commit(long, long, String, String, int, long, long, boolean).

Parameters
start:long

the start time

duration:long

the duration

nbytes:long

how many bytes were transferred

remote:SocketAddress

the address of the remote socket

timeout:long

maximum time to wait

enabledback to summary
public static boolean enabled()

Determine if this kind of event is enabled. The implementation of this method is generated automatically if jfr is enabled.

Returns:boolean

true if socket read events are enabled, false otherwise

offerback to summary
public static void offer(long start, long nbytes, SocketAddress remote, long timeout)

Helper method to offer the data needed to potentially commit an event. The duration of the operation is computed using the current timestamp and the given start time. If the duration is meets or exceeds the configured value (determined by calling the generated method shouldCommit(long)), an event will be emitted by calling emit(long, long, long, SocketAddress, long)

Parameters
start:long

the start time

nbytes:long

how many bytes were transferred

remote:SocketAddress

the address of the remote socket

timeout:long

maximum time to wait

shouldThrottleCommitback to summary
public static boolean shouldThrottleCommit(long duration, long end)

Determine if an event should be emitted. The duration of the operation must exceed some threshold in order to commit the event. The implementation of this method is generated automatically if jfr is enabled.

Parameters
duration:long

time in nanoseconds to complete the operation

end:long

timestamp at the end of the operation

Returns:boolean

true if the event should be commited

timestampback to summary
public static long timestamp()

Fetch the current timestamp in nanoseconds. This method is used to determine the start and end of an operation. The implementation of this method is generated automatically if jfr is enabled.

Returns:long

the current timestamp value