src/jdk.jfr/share/classes/jdk/jfr/Recording.java
changeset 58863 c16ac7a2eba4
parent 53016 9f13f8aad8dc
equal deleted inserted replaced
58861:2c3cc4b01880 58863:c16ac7a2eba4
     1 /*
     1 /*
     2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   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         /**
       
   417          * Determines how often events are made available for streaming.
       
   418          *
       
   419          * @param interval the interval at which events are made available for streaming.
       
   420          *
       
   421          * @throws IllegalArgumentException if {@code interval} is negative
       
   422          *
       
   423          * @throws IllegalStateException if the recording is in the {@code CLOSED} state
       
   424          *
       
   425          * @since 14
       
   426          */
       
   427         public void setFlushInterval(Duration interval) {
       
   428             Objects.nonNull(interval);
       
   429             if (interval.isNegative()) {
       
   430                 throw new IllegalArgumentException("Stream interval can't be negative");
       
   431             }
       
   432             internal.setFlushInterval(interval);
       
   433         }
       
   434 
       
   435     /**
       
   436      * Returns how often events are made available for streaming purposes.
       
   437      *
       
   438      * @return the flush interval, or {@code null} if no interval has been set
       
   439      *
       
   440      * @since 14
       
   441      */
       
   442     public Duration getFlushInterval() {
       
   443         return internal.getFlushInterval();
       
   444     }
       
   445 
   416     /**
   446     /**
   417      * Determines how far back data is kept in the disk repository.
   447      * Determines how far back data is kept in the disk repository.
   418      * <p>
   448      * <p>
   419      * To control the amount of recording data stored on disk, the maximum length of
   449      * To control the amount of recording data stored on disk, the maximum length of
   420      * time to retain the data can be specified. Data stored on disk that is older
   450      * time to retain the data can be specified. Data stored on disk that is older