public class TimestampedObserver extends ObservableInputStream.Observer
For example:
final TimestampedObserver timetampedObserver = new TimestampedObserver(); try (final ObservableInputStream inputStream = new ObservableInputStream(...), timetampedObserver)) { ... } System.out.printf("IO duration: %s%n", timetampedObserver.getOpenToCloseDuration());
Constructor and Description |
---|
TimestampedObserver() |
Modifier and Type | Method and Description |
---|---|
void |
closed()
Called to indicate that the
ObservableInputStream has been closed. |
Instant |
getCloseInstant()
Gets the instant for when this instance was closed.
|
Instant |
getOpenInstant()
Gets the instant for when this instance was created.
|
Duration |
getOpenToCloseDuration()
Gets the Duration between creation and close.
|
Duration |
getOpenToNowDuration()
Gets the Duration between creation and now.
|
String |
toString() |
data, data, error, finished
public void closed() throws IOException
ObservableInputStream.Observer
ObservableInputStream
has been closed.closed
in class ObservableInputStream.Observer
IOException
- if an I/O error occurs.public Instant getCloseInstant()
public Duration getOpenToCloseDuration()
public Duration getOpenToNowDuration()
public Instant getOpenInstant()
Copyright © 2002–2021 The Apache Software Foundation. All rights reserved.