src/jdk.jfr/share/classes/jdk/jfr/Recording.java
branchJEP-349-branch
changeset 58357 fe78b5a87287
parent 58112 e7754025004b
child 58374 a5ef6febbd26
equal deleted inserted replaced
58343:ca19b94eac7a 58357:fe78b5a87287
   411             throw new IllegalArgumentException("Max size of recording can't be negative");
   411             throw new IllegalArgumentException("Max size of recording can't be negative");
   412         }
   412         }
   413         internal.setMaxSize(maxSize);
   413         internal.setMaxSize(maxSize);
   414     }
   414     }
   415 
   415 
   416     /**
   416         /**
   417      * Determines how often events are made available for streaming.
   417          * Determines how often events are made available for streaming.
   418      *
   418          *
   419      * @param interval the interval at which events are made available for streaming.
   419          * @param interval the interval at which events are made available for streaming.
   420      *
   420          *
   421      * @throws IllegalArgumentException if <code>interval</code> is negative
   421          * @throws IllegalArgumentException if <code>interval</code> is negative
   422      *
   422          *
   423      * @throws IllegalStateException if the recording is in the {@code CLOSED} state
   423          * @throws IllegalStateException if the recording is in the {@code CLOSED} state
   424      */
   424          *
   425     public void setFlushInterval(Duration interval) {
   425          * @since 14
   426         Objects.nonNull(interval);
   426          */
   427         if (interval.isNegative()) {
   427         public void setFlushInterval(Duration interval) {
   428             throw new IllegalArgumentException("Stream interval can't be negative");
   428             Objects.nonNull(interval);
   429         }
   429             if (interval.isNegative()) {
   430         internal.setFlushInterval(interval);
   430                 throw new IllegalArgumentException("Stream interval can't be negative");
   431     }
   431             }
       
   432             internal.setFlushInterval(interval);
       
   433         }
   432 
   434 
   433     /**
   435     /**
   434      * Returns how often events are made available for streaming purposes.
   436      * Returns how often events are made available for streaming purposes.
   435      *
   437      *
   436      * @return the flush interval, or {@code null} if no interval has been set
   438      * @return the flush interval, or {@code null} if no interval has been set
       
   439      *
       
   440      * @since 14
   437      */
   441      */
   438     public Duration getFlushInterval() {
   442     public Duration getFlushInterval() {
   439         return internal.getFlushInterval();
   443         return internal.getFlushInterval();
   440     }
   444     }
   441 
   445