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

public Class SocketWriteEvent

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

A JFR event for socket write operations. This event is mirrored in jdk.jfr.events.SocketWriteEvent 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) method must be the same as the order of the fields.

Field Summary

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

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
number of bytes that were transferred
bytes
)

Actually commit a socket write event.

public static void
emit(long
the start time
start
,
long
the duration
duration
,
long
how many bytes were sent
bytesWritten
,
SocketAddress
the address of the remote socket being written to
remote
)

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).

public static boolean

Returns:

true if socket write 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 sent
bytesWritten
,
SocketAddress
the address of the remote socket being written to
remote
)

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 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
bytesWrittenback to summary
public long bytesWritten
hostback to summary
public String host
portback to summary
public int port

Constructor Detail

SocketWriteEventback to summary
public SocketWriteEvent()

Method Detail

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

Actually commit a socket write event. This is generated automatically. The order of the fields must be the same as the parameters in this method. commit(..., String, String, int, long)

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

bytes:long

number of bytes that were transferred

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

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).

Parameters
start:long

the start time

duration:long

the duration

bytesWritten:long

how many bytes were sent

remote:SocketAddress

the address of the remote socket being written to

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 write events are enabled, false otherwise

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

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 shouldThrottleCommit(long)), an event will be emitted by calling emit(long, long, long, SocketAddress).

Parameters
start:long

the start time

bytesWritten:long

how many bytes were sent

remote:SocketAddress

the address of the remote socket being written to

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 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