[ 
https://issues.apache.org/jira/browse/IO-706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17275769#comment-17275769
 ] 

David Mollitor edited comment on IO-706 at 1/31/21, 3:48 AM:
-------------------------------------------------------------

{code:java}
private volatile Instant closeInstant;
 {code}
What was the rationale for making this {{volatile}} ?

Also, I was thinking it more appropriate to use {{System#nanoTime()}}, as I 
think it is better designed for timing these sorts of things.

And finally, somewhat related/unrelated, I think the trendy thing these todays 
would be to add an "of" method on {{ObservableInputStream}}.
{code:java}
final TimetampedObserver timetampedObserver = new TimetampedObserver(); 
try (final ObservableInputStream inputStream = ObservableInputStream.of(new 
(...), timetampedObserver)) {
  ...
} 
System.out.printf("IO duration: %s%n", 
timetampedObserver.getOpenToCloseDuration());
{code}


was (Author: belugabehr):
{code:java}
private volatile Instant closeInstant;
 {code}

What was the rationale for making this {{volatile}] ?

Also, I was thinking it more appropriate to use {{System#nanoTime()}}, as I 
think it is better designed for timing these sorts of things.

And finally, somewhat related/unrelated, I think the trendy thing these todays 
would be to add an "of" method on {{ObservableInputStream}}.

{code:java}
final TimetampedObserver timetampedObserver = new TimetampedObserver(); 
try (final ObservableInputStream inputStream = ObservableInputStream.of(new 
(...), timetampedObserver)) {
  ...
} 
System.out.printf("IO duration: %s%n", 
timetampedObserver.getOpenToCloseDuration());
{code}

> TimedOutputStream/TimedInputStream 
> -----------------------------------
>
>                 Key: IO-706
>                 URL: https://issues.apache.org/jira/browse/IO-706
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Streams/Writers
>            Reporter: David Mollitor
>            Priority: Major
>
> Create a {{FilterInputStream}} {{FilterOutputStream}} that records the time 
> it was opened (instantiated) and the time it was closed.  Add method to 
> return the delta so that users can request the amount of time required to 
> read from (or write to) the underlying Stream.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to