< prev index next >

test/java/nio/file/WatchService/MayFlies.java

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 7164570 7191467
  26  * @summary Test that CREATE and DELETE events are paired for very
  27  *     short lived files
  28  * @library ..
  29  * @run main MayFlies

  30  */
  31 
  32 import java.nio.file.*;
  33 import static java.nio.file.StandardWatchEventKinds.*;
  34 import java.util.*;
  35 import java.util.concurrent.*;
  36 
  37 public class MayFlies {
  38 
  39     static volatile boolean stopped;
  40 
  41     static volatile boolean failure;
  42 
  43     /**
  44      * Continuously creates short-lived files in a directory until {@code
  45      * stopped} is set to {@code true}.
  46      */
  47     static class MayFlyHatcher implements Runnable {
  48         static final Random rand = new Random();
  49 




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 7164570 7191467
  26  * @summary Test that CREATE and DELETE events are paired for very
  27  *     short lived files
  28  * @library ..
  29  * @run main MayFlies
  30  * @key randomness
  31  */
  32 
  33 import java.nio.file.*;
  34 import static java.nio.file.StandardWatchEventKinds.*;
  35 import java.util.*;
  36 import java.util.concurrent.*;
  37 
  38 public class MayFlies {
  39 
  40     static volatile boolean stopped;
  41 
  42     static volatile boolean failure;
  43 
  44     /**
  45      * Continuously creates short-lived files in a directory until {@code
  46      * stopped} is set to {@code true}.
  47      */
  48     static class MayFlyHatcher implements Runnable {
  49         static final Random rand = new Random();
  50 


< prev index next >